Socket
Socket
Sign inDemoInstall

enhanced-resolve

Package Overview
Dependencies
Maintainers
1
Versions
130
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

enhanced-resolve - npm Package Compare versions

Comparing version 0.8.0 to 0.8.1

12

package.json
{
"name": "enhanced-resolve",
"version": "0.8.0",
"version": "0.8.1",
"author": "Tobias Koppers @sokra",
"description": "Offers a async require.resolve function. It's highly configurable.",
"dependencies": {
"tapable": "0.1.x",
"memory-fs": "~0.2.0",
"graceful-fs": "~2.0.3"
"tapable": "^0.1.8",
"memory-fs": "^0.2.0",
"graceful-fs": "^3.0.5"
},

@@ -19,4 +19,4 @@ "licenses": [

"istanbul": "^0.3.5",
"mocha": "1.8.x",
"should": "2.0.x"
"mocha": "^2.1.0",
"should": "^4.6.0"
},

@@ -23,0 +23,0 @@ "engines": {

@@ -9,49 +9,69 @@ var resolve = require("../");

describe("symlink", function() {
before(function() {
// Create some cool symlinks
try {
fs.mkdirSync(tempPath);
fs.symlinkSync(path.join(__dirname, "..", "lib", "node.js"), path.join(tempPath, "node.js"), "file");
fs.symlinkSync(path.join(__dirname, "..", "lib"), path.join(tempPath, "lib"), "dir");
fs.symlinkSync(path.join(__dirname, ".."), path.join(tempPath, "this"), "dir");
} catch(e) {}
});
after(function() {
fs.unlinkSync(path.join(tempPath, "node.js"));
fs.unlinkSync(path.join(tempPath, "lib"));
fs.unlinkSync(path.join(tempPath, "this"));
var isAdmin = true;
try {
fs.mkdirSync(tempPath);
fs.symlinkSync(path.join(__dirname, "..", "lib", "node.js"), path.join(tempPath, "test"), "file");
fs.symlinkSync(path.join(__dirname, "..", "lib"), path.join(tempPath, "test2"), "dir");
} catch(e) {isAdmin=false;}
try {
fs.unlinkSync(path.join(tempPath, "test"));
} catch(e) {isAdmin=false;}
try {
fs.unlinkSync(path.join(tempPath, "test2"));
} catch(e) {isAdmin=false;}
try {
fs.rmdirSync(tempPath);
});
[
[tempPath, "./node.js", "with a symlink to a file"],
[tempPath, "./lib/node.js", "with a symlink to a directory 1"],
[tempPath, "./this/lib/node.js", "with a symlink to a directory 2"],
[tempPath, "./this/test/temp/node.js", "with multiple symlinks in the path 1"],
[tempPath, "./this/test/temp/lib/node.js", "with multiple symlinks in the path 2"],
[tempPath, "./this/test/temp/this/lib/node.js", "with multiple symlinks in the path 3"],
[path.join(tempPath, "lib"), "./node.js", "with symlinked directory as context 1"],
[path.join(tempPath, "this"), "./lib/node.js", "with symlinked directory as context 2"],
[path.join(tempPath, "this"), "./test/temp/lib/node.js", "with symlinked directory as context and in path"],
[path.join(tempPath, "this", "lib"), "./node.js", "with symlinked directory in context path"],
[path.join(tempPath, "this", "test"), "./temp/node.js", "with symlinked directory in context path and symlinked file"],
[path.join(tempPath, "this", "test"), "./temp/lib/node.js", "with symlinked directory in context path and symlinked directory"],
].forEach(function(pathToIt) {
it("should resolve symlink to itself " + pathToIt[2], function(done) {
resolve(pathToIt[0], pathToIt[1], function(err, filename) {
if(err) return done(err);
} catch(e) {isAdmin=false;}
if(isAdmin) {
before(function() {
// Create some cool symlinks
try {
fs.mkdirSync(tempPath);
fs.symlinkSync(path.join(__dirname, "..", "lib", "node.js"), path.join(tempPath, "node.js"), "file");
fs.symlinkSync(path.join(__dirname, "..", "lib"), path.join(tempPath, "lib"), "dir");
fs.symlinkSync(path.join(__dirname, ".."), path.join(tempPath, "this"), "dir");
} catch(e) {}
});
after(function() {
fs.unlinkSync(path.join(tempPath, "node.js"));
fs.unlinkSync(path.join(tempPath, "lib"));
fs.unlinkSync(path.join(tempPath, "this"));
fs.rmdirSync(tempPath);
});
[
[tempPath, "./node.js", "with a symlink to a file"],
[tempPath, "./lib/node.js", "with a symlink to a directory 1"],
[tempPath, "./this/lib/node.js", "with a symlink to a directory 2"],
[tempPath, "./this/test/temp/node.js", "with multiple symlinks in the path 1"],
[tempPath, "./this/test/temp/lib/node.js", "with multiple symlinks in the path 2"],
[tempPath, "./this/test/temp/this/lib/node.js", "with multiple symlinks in the path 3"],
[path.join(tempPath, "lib"), "./node.js", "with symlinked directory as context 1"],
[path.join(tempPath, "this"), "./lib/node.js", "with symlinked directory as context 2"],
[path.join(tempPath, "this"), "./test/temp/lib/node.js", "with symlinked directory as context and in path"],
[path.join(tempPath, "this", "lib"), "./node.js", "with symlinked directory in context path"],
[path.join(tempPath, "this", "test"), "./temp/node.js", "with symlinked directory in context path and symlinked file"],
[path.join(tempPath, "this", "test"), "./temp/lib/node.js", "with symlinked directory in context path and symlinked directory"],
].forEach(function(pathToIt) {
it("should resolve symlink to itself " + pathToIt[2], function(done) {
resolve(pathToIt[0], pathToIt[1], function(err, filename) {
if(err) return done(err);
should.exist(filename);
filename.should.have.type("string");
filename.should.be.eql(path.join(__dirname, "..", "lib", "node.js"));
done();
});
});
it("should resolve symlink to itself sync " + pathToIt[2], function() {
var filename = resolve.sync(pathToIt[0], pathToIt[1]);
should.exist(filename);
filename.should.have.type("string");
filename.should.be.eql(path.join(__dirname, "..", "lib", "node.js"));
done();
});
});
it("should resolve symlink to itself sync " + pathToIt[2], function() {
var filename = resolve.sync(pathToIt[0], pathToIt[1]);
should.exist(filename);
filename.should.have.type("string");
filename.should.be.eql(path.join(__dirname, "..", "lib", "node.js"));
});
});
} else {
it("cannot test symlinks because we have no permission to create them");
}
});
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