File: stack.js

package info (click to toggle)
node-tap 12.0.1+ds-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 3,916 kB
  • sloc: makefile: 84; sh: 75
file content (45 lines) | stat: -rw-r--r-- 1,423 bytes parent folder | download | duplicates (2)
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
34
35
36
37
38
39
40
41
42
43
44
45
'use strict'
const t = require('../')
const path = require('path')

t.test('in tapdir, no envs', t => {
  delete require.cache[require.resolve('../lib/stack.js')]
  process.chdir(path.resolve(__dirname, '..'))
  process.env.TAP_DEV_LONGSTACK = 0
  process.env.TAP_DEV_SHORTSTACK = 0
  const stack = require('../lib/stack.js').captureString()
  t.match(stack, /test[\/\\]stack\.js:\w+:\w+\)\n/)
  t.notMatch(stack, '\.node-spawn-wrap')
  t.end()
})
/*
t.test('in ~, no envs', t => {
  delete require.cache[require.resolve('../lib/stack.js')]
  process.chdir(process.env.HOME)
  process.env.TAP_DEV_LONGSTACK = 0
  process.env.TAP_DEV_SHORTSTACK = 0
  const stack = require('../lib/stack.js').captureString()
  t.equal(stack, '')
  t.end()
})

t.test('in home, longstack', t => {
  delete require.cache[require.resolve('../lib/stack.js')]
  process.chdir(process.env.HOME)
  process.env.TAP_DEV_LONGSTACK = 1
  process.env.TAP_DEV_SHORTSTACK = 0
  const stack = require('../lib/stack.js').captureString()
  t.match(stack, /test[\/\\]stack\.js:\w+:\w+\)\n/)
  t.notMatch(stack, '\.node-spawn-wrap')
  t.end()
})
*/
t.test('in tapdir, shortstack', t => {
  delete require.cache[require.resolve('../lib/stack.js')]
  process.chdir(path.resolve(__dirname, '..'))
  process.env.TAP_DEV_LONGSTACK = 0
  process.env.TAP_DEV_SHORTSTACK = 1
  const stack = require('../lib/stack.js').captureString()
  t.equal(stack, '')
  t.end()
})