aboutsummaryrefslogtreecommitdiff
path: root/node_modules/resolve/test/resolver/nested_symlinks/mylib
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/resolve/test/resolver/nested_symlinks/mylib')
-rw-r--r--node_modules/resolve/test/resolver/nested_symlinks/mylib/async.js26
-rw-r--r--node_modules/resolve/test/resolver/nested_symlinks/mylib/package.json15
-rw-r--r--node_modules/resolve/test/resolver/nested_symlinks/mylib/sync.js12
3 files changed, 53 insertions, 0 deletions
diff --git a/node_modules/resolve/test/resolver/nested_symlinks/mylib/async.js b/node_modules/resolve/test/resolver/nested_symlinks/mylib/async.js
new file mode 100644
index 0000000..9b4846a
--- /dev/null
+++ b/node_modules/resolve/test/resolver/nested_symlinks/mylib/async.js
@@ -0,0 +1,26 @@
+var a = require.resolve('buffer/').replace(process.cwd(), '$CWD');
+var b;
+var c;
+
+var test = function test() {
+ console.log(a, ': require.resolve, preserveSymlinks ' + (process.execArgv.indexOf('preserve-symlinks') > -1 ? 'true' : 'false'));
+ console.log(b, ': preserveSymlinks true');
+ console.log(c, ': preserveSymlinks false');
+
+ if (a !== b && a !== c) {
+ throw 'async: no match';
+ }
+ console.log('async: success! a matched either b or c\n');
+};
+
+require('resolve')('buffer/', { preserveSymlinks: true }, function (err, result) {
+ if (err) { throw err; }
+ b = result.replace(process.cwd(), '$CWD');
+ if (b && c) { test(); }
+});
+require('resolve')('buffer/', { preserveSymlinks: false }, function (err, result) {
+ if (err) { throw err; }
+ c = result.replace(process.cwd(), '$CWD');
+ if (b && c) { test(); }
+});
+
diff --git a/node_modules/resolve/test/resolver/nested_symlinks/mylib/package.json b/node_modules/resolve/test/resolver/nested_symlinks/mylib/package.json
new file mode 100644
index 0000000..acfe9e9
--- /dev/null
+++ b/node_modules/resolve/test/resolver/nested_symlinks/mylib/package.json
@@ -0,0 +1,15 @@
+{
+ "name": "mylib",
+ "version": "0.0.0",
+ "description": "",
+ "private": true,
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "keywords": [],
+ "author": "",
+ "license": "ISC",
+ "dependencies": {
+ "buffer": "*"
+ }
+}
diff --git a/node_modules/resolve/test/resolver/nested_symlinks/mylib/sync.js b/node_modules/resolve/test/resolver/nested_symlinks/mylib/sync.js
new file mode 100644
index 0000000..3283efc
--- /dev/null
+++ b/node_modules/resolve/test/resolver/nested_symlinks/mylib/sync.js
@@ -0,0 +1,12 @@
+var a = require.resolve('buffer/').replace(process.cwd(), '$CWD');
+var b = require('resolve').sync('buffer/', { preserveSymlinks: true }).replace(process.cwd(), '$CWD');
+var c = require('resolve').sync('buffer/', { preserveSymlinks: false }).replace(process.cwd(), '$CWD');
+
+console.log(a, ': require.resolve, preserveSymlinks ' + (process.execArgv.indexOf('preserve-symlinks') > -1 ? 'true' : 'false'));
+console.log(b, ': preserveSymlinks true');
+console.log(c, ': preserveSymlinks false');
+
+if (a !== b && a !== c) {
+ throw 'sync: no match';
+}
+console.log('sync: success! a matched either b or c\n');