|
| 1 | + ',use strict'; |
| 2 | + |
| 3 | +const t = require('tap'); |
| 4 | +const StackUtils = require('../'); |
| 5 | + |
| 6 | +const utils = require('./_utils'); |
| 7 | + |
| 8 | +const stackUtils = new StackUtils({ cwd: '/home/user' }); |
| 9 | + |
| 10 | +t.test('removes namespaced internal modules', t => { |
| 11 | + const stack = utils.join([ |
| 12 | + 'at Test.<anonymous> (test/test.js:99:5)', |
| 13 | + 'at TapWrap.runInAsyncScope (node:async_hooks:193:9)', |
| 14 | + 'at TapWrap.runInAsyncScope (node:async_hooks:193:9)', |
| 15 | + 'at Object.<anonymous> (test/test.js:94:3)', |
| 16 | + 'at Module._compile (node:internal/modules/cjs/loader:1083:30)', |
| 17 | + 'at Module.replacementCompile (node_modules/append-transform/index.js:58:13)', |
| 18 | + 'at Module._extensions..js (node:internal/modules/cjs/loader:1112:10)', |
| 19 | + 'at Object.<anonymous> (node_modules/append-transform/index.js:62:4)', |
| 20 | + 'at Module.load (node:internal/modules/cjs/loader:948:32)', |
| 21 | + 'at Function.Module._load (node:internal/modules/cjs/loader:789:14)', |
| 22 | + 'at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:72:12)', |
| 23 | + 'at Module._compile (node:internal/modules/cjs/loader:1083:30)', |
| 24 | + 'at Object.Module._extensions..js (node:internal/modules/cjs/loader:1112:10)', |
| 25 | + 'at Module.load (node:internal/modules/cjs/loader:948:32)', |
| 26 | + 'at Function.Module._load (node:internal/modules/cjs/loader:789:14)', |
| 27 | + 'at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:72:12)', |
| 28 | + 'at Module._compile (node:internal/modules/cjs/loader:1083:30)', |
| 29 | + 'at Object.Module._extensions..js (node:internal/modules/cjs/loader:1112:10)', |
| 30 | + 'at Module.load (node:internal/modules/cjs/loader:948:32)', |
| 31 | + 'at Function.Module._load (node:internal/modules/cjs/loader:789:14)', |
| 32 | + 'at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:72:12)', |
| 33 | + 'at node:internal/main/run_main_module:17:47' |
| 34 | + ]); |
| 35 | + const expectedStack = utils.join([ |
| 36 | + 'Test.<anonymous> (test/test.js:99:5)', |
| 37 | + 'Object.<anonymous> (test/test.js:94:3)', |
| 38 | + 'Module.replacementCompile (node_modules/append-transform/index.js:58:13)', |
| 39 | + 'Object.<anonymous> (node_modules/append-transform/index.js:62:4)', |
| 40 | + ]) |
| 41 | + t.plan(1); |
| 42 | + t.is(stackUtils.clean(stack), expectedStack); |
| 43 | +}); |
0 commit comments