Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornlf <quitlahok@gmail.com>2020-10-05 19:46:44 +0300
committernlf <quitlahok@gmail.com>2020-10-05 19:46:44 +0300
commitc8f0d5457dd913b425987ae30a611d4eb9e84b7d (patch)
tree585cac8a05adf60ab5afe13a8eea82a7938ca642 /test
parentd816c2efae41930cbdf4fff8657e0adc450d1dd4 (diff)
tests: tests for prefix command
Diffstat (limited to 'test')
-rw-r--r--test/lib/prefix.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/lib/prefix.js b/test/lib/prefix.js
new file mode 100644
index 000000000..a6e4d731a
--- /dev/null
+++ b/test/lib/prefix.js
@@ -0,0 +1,19 @@
+const { test } = require('tap')
+const requireInject = require('require-inject')
+
+test('prefix', (t) => {
+ t.plan(3)
+ const dir = '/prefix/dir'
+
+ const prefix = requireInject('../../lib/prefix.js', {
+ '../../lib/npm.js': { prefix: dir },
+ '../../lib/utils/output.js': (output) => {
+ t.equal(output, dir, 'prints the correct directory')
+ }
+ })
+
+ prefix([], (err) => {
+ t.ifError(err, 'npm prefix')
+ t.ok('should have printed directory')
+ })
+})