Socket
Socket
Sign inDemoInstall

memfs

Package Overview
Dependencies
Maintainers
1
Versions
152
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

memfs - npm Package Compare versions

Comparing version 2.1.2 to 2.2.0

10

CONTRIBUTING.md

@@ -7,2 +7,7 @@ # Contributing to `memfs`

Start from the `develop` branch:
git checkout develop
git checkout -b your-feature
Install dependencies:

@@ -28,3 +33,3 @@

npm run test-basic-ts
npm test

@@ -36,5 +41,6 @@ Also make sure that your test cases have your new code well, run coverage report

When done, build the project and submit a pull request:
When done, build the project:
npm run build
Submit a pull request into the `develop` branch.

@@ -306,2 +306,34 @@ "use strict";

});
describe('.closeSync(fd)', function () {
var vol = new volume_1.Volume;
it('Closes file without errors', function () {
var fd = vol.openSync('/test.txt', 'w');
vol.closeSync(fd);
});
xit('Correct error when file descriptor is not a number', function () { });
xit('Closing file descriptor that does not exist', function () { });
it('Closing same file descriptor twice throws EBADF', function () {
var fd = vol.openSync('/test.txt', 'w');
vol.closeSync(fd);
try {
vol.closeSync(fd);
throw Error('This should not throw');
}
catch (err) {
chai_1.expect(err.code).to.equal('EBADF');
}
});
it('Closing a file decreases the number of open files', function () {
var fd = vol.openSync('/test.txt', 'w');
var openFiles = vol.openFiles;
vol.closeSync(fd);
chai_1.expect(openFiles).to.be.greaterThan(vol.openFiles);
});
it('When closing a file, its descriptor is added to the pool of descriptors to be reused', function () {
var fd = vol.openSync('/test.txt', 'w');
var usedFdLength = vol.releasedFds.length;
vol.closeSync(fd);
chai_1.expect(usedFdLength).to.be.lessThan(vol.releasedFds.length);
});
});
describe('.close(fd, callback)', function () {

@@ -654,2 +686,38 @@ var vol = new volume_1.Volume;

});
describe('.existsSync(path)', function () {
var vol = volume_1.Volume.fromJSON({ '/foo': 'bar' });
it('Returns true if file exists', function () {
var result = vol.existsSync('/foo');
chai_1.expect(result).to.be.true;
});
it('Returns false if file does not exist', function () {
var result = vol.existsSync('/foo2');
chai_1.expect(result).to.be.false;
});
});
describe('.exists(path, callback)', function () {
var vol = volume_1.Volume.fromJSON({ '/foo': 'bar' });
it('Returns true if file exists', function (done) {
vol.exists('/foo', function (exists) {
chai_1.expect(exists).to.be.true;
done();
});
});
it('Returns false if file does not exist', function (done) {
vol.exists('/foo2', function (exists) {
chai_1.expect(exists).to.be.false;
done();
});
});
it('Throws correct error if callback not provided', function (done) {
try {
vol.exists('/foo', undefined);
throw new Error('not_this');
}
catch (err) {
chai_1.expect(err.message).to.equal('callback must be a function');
done();
}
});
});
describe('.linkSync(existingPath, newPath)', function () {

@@ -656,0 +724,0 @@ var vol = new volume_1.Volume;

21

package.json
{
"name": "memfs",
"version": "2.1.2",
"version": "2.2.0",
"description": "In-memory file-system with Node's fs API.",
"main": "lib/index.js",
"keywords": [
"fs", "filesystem", "fs.js", "memory-fs", "memfs",
"file", "file system", "mount", "memory", "in-memory",
"virtual", "test", "testing", "mock"
"fs",
"filesystem",
"fs.js",
"memory-fs",
"memfs",
"file",
"file system",
"mount",
"memory",
"in-memory",
"virtual",
"test",
"testing",
"mock"
],

@@ -64,3 +75,3 @@ "repository": {

"build-js": "babel src --out-dir lib",
"test": "npm run test-basic-js",
"test": "npm run test-coverage-ts",
"test-basic-js": "mocha lib/**/**/**/*.test.js",

@@ -67,0 +78,0 @@ "test-basic-ts": "mocha --require ts-node/register src/**/**/**/*.test.ts",

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc