• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1var common = require('../common-tap.js')
2var test = require('tap').test
3var path = require('path')
4var cwd = path.resolve(__dirname, '..', '..')
5var testscript = require('../../package.json').scripts.test
6var tsregexp = testscript.replace(/([[.*\]])/g, '\\$1')
7
8test('default', function (t) {
9  common.npm(['run'], { cwd: cwd }, function (er, code, so) {
10    if (er) throw er
11    t.notOk(code)
12    t.similar(so, new RegExp('\\n  test\\n    ' + tsregexp + '\\n'))
13    t.end()
14  })
15})
16
17test('parseable', function (t) {
18  common.npm(['run', '-p'], { cwd: cwd }, function (er, code, so) {
19    if (er) throw er
20    t.notOk(code)
21    t.similar(so, new RegExp('\\ntest:' + tsregexp + '\\n'))
22    t.end()
23  })
24})
25
26test('parseable', function (t) {
27  common.npm(['run', '--json'], { cwd: cwd }, function (er, code, so) {
28    if (er) throw er
29    t.notOk(code)
30    t.equal(JSON.parse(so).test, testscript)
31    t.end()
32  })
33})
34