1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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()
})
})
|