Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mock-fs

Package Overview
Dependencies
Maintainers
1
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mock-fs - npm Package Compare versions

Comparing version 5.0.0 to 5.1.0-dev.1631911363563

lib/readfilecontext.js

2

lib/binding.js

@@ -9,3 +9,3 @@ 'use strict';

const SymbolicLink = require('./symlink');
const FSError = require('./error');
const {FSError} = require('./error');
const constants = require('constants');

@@ -12,0 +12,0 @@ const getPathParts = require('./filesystem').getPathParts;

@@ -44,4 +44,20 @@ 'use strict';

/**
* Error constructor.
* Create an abort error for when an asynchronous task was aborted.
* @constructor
*/
exports = module.exports = FSError;
function AbortError() {
Error.call(this);
this.code = 'ABORT_ERR';
this.name = 'AbortError';
Error.captureStackTrace(this, AbortError);
}
AbortError.prototype = new Error();
/**
* FSError constructor.
*/
exports.FSError = FSError;
/**
* AbortError constructor.
*/
exports.AbortError = AbortError;

@@ -8,3 +8,3 @@ 'use strict';

const File = require('./file');
const FSError = require('./error');
const {FSError} = require('./error');
const SymbolicLink = require('./symlink');

@@ -11,0 +11,0 @@

'use strict';
const Binding = require('./binding');
const FSError = require('./error');
const {FSError} = require('./error');
const FileSystem = require('./filesystem');

@@ -10,2 +10,6 @@ const realBinding = process.binding('fs');

const bypass = require('./bypass');
const {
getReadFileContextPrototype,
patchReadFileContext
} = require('./readfilecontext');
const fs = require('fs');

@@ -54,2 +58,6 @@

const readFileContextPrototype = getReadFileContextPrototype();
patchReadFileContext(readFileContextPrototype);
function overrideBinding(binding) {

@@ -99,2 +107,6 @@ realBinding._mockedBinding = binding;

function overrideReadFileContext(binding) {
readFileContextPrototype._mockedBinding = binding;
}
function restoreBinding() {

@@ -116,2 +128,6 @@ delete realBinding._mockedBinding;

function restoreReadFileContext(binding) {
delete readFileContextPrototype._mockedBinding;
}
/**

@@ -132,2 +148,4 @@ * Swap out the fs bindings for a mock file system.

overrideReadFileContext(binding);
let currentPath = process.cwd();

@@ -175,2 +193,3 @@ overrideProcess(

restoreCreateWriteStream();
restoreReadFileContext();
};

@@ -177,0 +196,0 @@

{
"name": "mock-fs",
"description": "A configurable mock file system. You know, for testing.",
"version": "5.0.0",
"version": "5.1.0-dev.1631911363563",
"main": "lib/index.js",

@@ -6,0 +6,0 @@ "homepage": "https://github.com/tschaub/mock-fs",

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