File tree Expand file tree Collapse file tree
tap-snapshots/test/lib/utils Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ process.on('exit', code => {
5858 if ( ! code )
5959 log . info ( 'ok' )
6060 else {
61+ log . verbose ( 'code' , code )
6162 if ( ! exitHandlerCalled ) {
6263 log . error ( '' , 'Exit handler never called!' )
6364 console . error ( '' )
@@ -66,7 +67,6 @@ process.on('exit', code => {
6667 // TODO this doesn't have an npm.config.loaded guard
6768 writeLogFile ( )
6869 }
69- log . verbose ( 'code' , code )
7070 }
7171 // In timing mode we always write the log file
7272 if ( npm . config && npm . config . loaded && npm . config . get ( 'timing' ) && ! wroteLogFile )
@@ -107,8 +107,6 @@ const exit = (code, noLog) => {
107107 // background at this point, and this makes sure anything left dangling
108108 // for whatever reason gets thrown away, instead of leaving the CLI open
109109 process . stdout . write ( '' , ( ) => {
110- // `|| process.exitCode` supports a single use case, where we set the exit
111- // code to 1 if npm is called with no arguments
112110 process . exit ( code )
113111 } )
114112}
Original file line number Diff line number Diff line change 66 */
77'use strict'
88exports [ `test/lib/utils/exit-handler.js TAP handles unknown error > should have expected log contents for unknown error 1` ] = `
9- 0 verbose code 1
10- 1 error foo A complete log of this run can be found in:
11- 1 error foo {CWD}/test/lib/utils/tap-testdir-exit-handler/_logs/expecteddate-debug.log
12- 2 verbose stack Error: ERROR
13- 3 verbose cwd {CWD}
14- 4 verbose Foo 1.0.0
15- 5 verbose argv "/node" "{CWD}/test/lib/utils/exit-handler.js"
16- 6 verbose node v1.0.0
17- 7 verbose npm v1.0.0
18- 8 error foo code ERROR
19- 9 error foo ERR ERROR
20- 10 error foo ERR ERROR
21- 11 verbose exit 1
9+ 0 verbose stack Error: ERROR
10+ 1 verbose cwd {CWD}
11+ 2 verbose Foo 1.0.0
12+ 3 verbose argv "/node" "{CWD}/test/lib/utils/exit-handler.js"
13+ 4 verbose node v1.0.0
14+ 5 verbose npm v1.0.0
15+ 6 error foo code ERROR
16+ 7 error foo ERR ERROR
17+ 8 error foo ERR ERROR
18+ 9 verbose exit 1
2219
2320`
Original file line number Diff line number Diff line change @@ -109,6 +109,10 @@ process = Object.assign(
109109// in order for tap to exit properly
110110t . teardown ( ( ) => {
111111 process = _process
112+ } )
113+
114+ t . afterEach ( ( ) => {
115+ // clear out the 'A complete log' message
112116 npmlog . record . length = 0
113117} )
114118
You can’t perform that action at this time.
0 commit comments