diff options
Diffstat (limited to 'deps/npm/test/tap')
-rw-r--r-- | deps/npm/test/tap/install-save-prefix.js | 2 | ||||
-rw-r--r-- | deps/npm/test/tap/test-run-ls.js | 33 |
2 files changed, 34 insertions, 1 deletions
diff --git a/deps/npm/test/tap/install-save-prefix.js b/deps/npm/test/tap/install-save-prefix.js index 9cb6bd9cbb..753150924a 100644 --- a/deps/npm/test/tap/install-save-prefix.js +++ b/deps/npm/test/tap/install-save-prefix.js @@ -32,7 +32,7 @@ test('"npm install --save with default save-prefix should install local pkg vers var pkgJson = JSON.parse(fs.readFileSync(pkg + '/package.json', 'utf8')) t.deepEqual(pkgJson.dependencies, { 'underscore': '^1.5.1' - }, 'Underscore dependency should specify ^1.3.1') + }, 'Underscore dependency should specify ^1.5.1') npm.config.set('save', undefined) s.close() t.end() diff --git a/deps/npm/test/tap/test-run-ls.js b/deps/npm/test/tap/test-run-ls.js new file mode 100644 index 0000000000..4c869e5e24 --- /dev/null +++ b/deps/npm/test/tap/test-run-ls.js @@ -0,0 +1,33 @@ +var common = require("../common-tap.js") +var test = require("tap").test +var path = require("path") +var cwd = path.resolve(__dirname, "..", "..") +var testscript = require("../../package.json").scripts.test +var tsregexp = testscript.replace(/([\[\.\*\]])/g, "\\$1") + +test("default", function (t) { + common.npm(["run"], { cwd: cwd }, function (er, code, so, se) { + if (er) throw er + t.notOk(code) + t.similar(so, new RegExp("\\n test\\n " + tsregexp + "\\n")) + t.end() + }) +}) + +test("parseable", function (t) { + common.npm(["run", "-p"], { cwd: cwd }, function (er, code, so, se) { + if (er) throw er + t.notOk(code) + t.similar(so, new RegExp("\\ntest:" + tsregexp + "\\n")) + t.end() + }) +}) + +test("parseable", function (t) { + common.npm(["run", "--json"], { cwd: cwd }, function (er, code, so, se) { + if (er) throw er + t.notOk(code) + t.equal(JSON.parse(so).test, testscript) + t.end() + }) +}) |