diff options
Diffstat (limited to 'tap-snapshots/test/lib/utils')
-rw-r--r-- | tap-snapshots/test/lib/utils/error-message.js.test.cjs | 83 | ||||
-rw-r--r-- | tap-snapshots/test/lib/utils/exit-handler.js.test.cjs | 62 | ||||
-rw-r--r-- | tap-snapshots/test/lib/utils/log-file.js.test.cjs | 68 |
3 files changed, 179 insertions, 34 deletions
diff --git a/tap-snapshots/test/lib/utils/error-message.js.test.cjs b/tap-snapshots/test/lib/utils/error-message.js.test.cjs index e4efb0eb9..3b82e3c05 100644 --- a/tap-snapshots/test/lib/utils/error-message.js.test.cjs +++ b/tap-snapshots/test/lib/utils/error-message.js.test.cjs @@ -255,7 +255,7 @@ Object { "summary": Array [ Array [ "notsup", - "Unsupported platform for lodash@1.0.0: wanted {\\"os\\":\\"!yours,mine\\",\\"arch\\":\\"x867,x5309\\"} (current: {\\"os\\":\\"posix\\",\\"arch\\":\\"x64\\"})", + "Unsupported platform for lodash@1.0.0: wanted {/"os/":/"!yours,mine/",/"arch/":/"x867,x5309/"} (current: {/"os/":/"posix/",/"arch/":/"x64/"})", ], ], } @@ -277,7 +277,7 @@ Object { "summary": Array [ Array [ "notsup", - "Unsupported platform for lodash@1.0.0: wanted {\\"os\\":\\"!yours\\",\\"arch\\":\\"x420\\"} (current: {\\"os\\":\\"posix\\",\\"arch\\":\\"x64\\"})", + "Unsupported platform for lodash@1.0.0: wanted {/"os/":/"!yours/",/"arch/":/"x420/"} (current: {/"os/":/"posix/",/"arch/":/"x64/"})", ], ], } @@ -394,7 +394,7 @@ Object { "", Error: whoopsie { "code": "EACCES", - "dest": "/some/cache/dir/dest", + "dest": "{CWD}/test/lib/utils/tap-testdir-error-message-eacces-eperm--windows-false-loaded-false-cachePath-false-cacheDest-true-/cache/dest", "path": "/not/cache/dir/path", }, ], @@ -428,7 +428,7 @@ Object { Error: whoopsie { "code": "EACCES", "dest": "/not/cache/dir/dest", - "path": "/some/cache/dir/path", + "path": "{CWD}/test/lib/utils/tap-testdir-error-message-eacces-eperm--windows-false-loaded-false-cachePath-true-cacheDest-false-/cache/path", }, ], ], @@ -460,8 +460,8 @@ Object { "", Error: whoopsie { "code": "EACCES", - "dest": "/some/cache/dir/dest", - "path": "/some/cache/dir/path", + "dest": "{CWD}/test/lib/utils/tap-testdir-error-message-eacces-eperm--windows-false-loaded-false-cachePath-true-cacheDest-true-/cache/dest", + "path": "{CWD}/test/lib/utils/tap-testdir-error-message-eacces-eperm--windows-false-loaded-false-cachePath-true-cacheDest-true-/cache/path", }, ], ], @@ -502,7 +502,12 @@ Object { ` exports[`test/lib/utils/error-message.js TAP eacces/eperm {"windows":false,"loaded":true,"cachePath":false,"cacheDest":false} > must match snapshot 2`] = ` -Array [] +Array [ + Array [ + "logfile", + "{CWD}/test/lib/utils/tap-testdir-error-message-eacces-eperm--windows-false-loaded-true-cachePath-false-cacheDest-false-/cache/_logs/{DATE}-debug-0.log", + ], +] ` exports[`test/lib/utils/error-message.js TAP eacces/eperm {"windows":false,"loaded":true,"cachePath":false,"cacheDest":true} > must match snapshot 1`] = ` @@ -517,7 +522,7 @@ Object { previous versions of npm which has since been addressed. To permanently fix this problem, please run: - sudo chown -R 867:5309 "/some/cache/dir" + sudo chown -R 867:5309 "{CWD}/test/lib/utils/tap-testdir-error-message-eacces-eperm--windows-false-loaded-true-cachePath-false-cacheDest-true-/cache" ), ], ], @@ -527,6 +532,10 @@ Object { exports[`test/lib/utils/error-message.js TAP eacces/eperm {"windows":false,"loaded":true,"cachePath":false,"cacheDest":true} > must match snapshot 2`] = ` Array [ Array [ + "logfile", + "{CWD}/test/lib/utils/tap-testdir-error-message-eacces-eperm--windows-false-loaded-true-cachePath-false-cacheDest-true-/cache/_logs/{DATE}-debug-0.log", + ], + Array [ "dummy stack trace", ], ] @@ -544,7 +553,7 @@ Object { previous versions of npm which has since been addressed. To permanently fix this problem, please run: - sudo chown -R 867:5309 "/some/cache/dir" + sudo chown -R 867:5309 "{CWD}/test/lib/utils/tap-testdir-error-message-eacces-eperm--windows-false-loaded-true-cachePath-true-cacheDest-false-/cache" ), ], ], @@ -554,6 +563,10 @@ Object { exports[`test/lib/utils/error-message.js TAP eacces/eperm {"windows":false,"loaded":true,"cachePath":true,"cacheDest":false} > must match snapshot 2`] = ` Array [ Array [ + "logfile", + "{CWD}/test/lib/utils/tap-testdir-error-message-eacces-eperm--windows-false-loaded-true-cachePath-true-cacheDest-false-/cache/_logs/{DATE}-debug-0.log", + ], + Array [ "dummy stack trace", ], ] @@ -571,7 +584,7 @@ Object { previous versions of npm which has since been addressed. To permanently fix this problem, please run: - sudo chown -R 867:5309 "/some/cache/dir" + sudo chown -R 867:5309 "{CWD}/test/lib/utils/tap-testdir-error-message-eacces-eperm--windows-false-loaded-true-cachePath-true-cacheDest-true-/cache" ), ], ], @@ -581,6 +594,10 @@ Object { exports[`test/lib/utils/error-message.js TAP eacces/eperm {"windows":false,"loaded":true,"cachePath":true,"cacheDest":true} > must match snapshot 2`] = ` Array [ Array [ + "logfile", + "{CWD}/test/lib/utils/tap-testdir-error-message-eacces-eperm--windows-false-loaded-true-cachePath-true-cacheDest-true-/cache/_logs/{DATE}-debug-0.log", + ], + Array [ "dummy stack trace", ], ] @@ -642,7 +659,7 @@ Object { "", Error: whoopsie { "code": "EACCES", - "dest": "/some/cache/dir/dest", + "dest": "{CWD}/test/lib/utils/tap-testdir-error-message-eacces-eperm--windows-true-loaded-false-cachePath-false-cacheDest-true-/cache/dest", "path": "/not/cache/dir/path", }, ], @@ -677,7 +694,7 @@ Object { Error: whoopsie { "code": "EACCES", "dest": "/not/cache/dir/dest", - "path": "/some/cache/dir/path", + "path": "{CWD}/test/lib/utils/tap-testdir-error-message-eacces-eperm--windows-true-loaded-false-cachePath-true-cacheDest-false-/cache/path", }, ], ], @@ -710,8 +727,8 @@ Object { "", Error: whoopsie { "code": "EACCES", - "dest": "/some/cache/dir/dest", - "path": "/some/cache/dir/path", + "dest": "{CWD}/test/lib/utils/tap-testdir-error-message-eacces-eperm--windows-true-loaded-false-cachePath-true-cacheDest-true-/cache/dest", + "path": "{CWD}/test/lib/utils/tap-testdir-error-message-eacces-eperm--windows-true-loaded-false-cachePath-true-cacheDest-true-/cache/path", }, ], ], @@ -753,7 +770,12 @@ Object { ` exports[`test/lib/utils/error-message.js TAP eacces/eperm {"windows":true,"loaded":true,"cachePath":false,"cacheDest":false} > must match snapshot 2`] = ` -Array [] +Array [ + Array [ + "logfile", + "{CWD}/test/lib/utils/tap-testdir-error-message-eacces-eperm--windows-true-loaded-true-cachePath-false-cacheDest-false-/cache/_logs/{DATE}-debug-0.log", + ], +] ` exports[`test/lib/utils/error-message.js TAP eacces/eperm {"windows":true,"loaded":true,"cachePath":false,"cacheDest":true} > must match snapshot 1`] = ` @@ -778,7 +800,7 @@ Object { "", Error: whoopsie { "code": "EACCES", - "dest": "/some/cache/dir/dest", + "dest": "{CWD}/test/lib/utils/tap-testdir-error-message-eacces-eperm--windows-true-loaded-true-cachePath-false-cacheDest-true-/cache/dest", "path": "/not/cache/dir/path", }, ], @@ -787,7 +809,12 @@ Object { ` exports[`test/lib/utils/error-message.js TAP eacces/eperm {"windows":true,"loaded":true,"cachePath":false,"cacheDest":true} > must match snapshot 2`] = ` -Array [] +Array [ + Array [ + "logfile", + "{CWD}/test/lib/utils/tap-testdir-error-message-eacces-eperm--windows-true-loaded-true-cachePath-false-cacheDest-true-/cache/_logs/{DATE}-debug-0.log", + ], +] ` exports[`test/lib/utils/error-message.js TAP eacces/eperm {"windows":true,"loaded":true,"cachePath":true,"cacheDest":false} > must match snapshot 1`] = ` @@ -813,7 +840,7 @@ Object { Error: whoopsie { "code": "EACCES", "dest": "/not/cache/dir/dest", - "path": "/some/cache/dir/path", + "path": "{CWD}/test/lib/utils/tap-testdir-error-message-eacces-eperm--windows-true-loaded-true-cachePath-true-cacheDest-false-/cache/path", }, ], ], @@ -821,7 +848,12 @@ Object { ` exports[`test/lib/utils/error-message.js TAP eacces/eperm {"windows":true,"loaded":true,"cachePath":true,"cacheDest":false} > must match snapshot 2`] = ` -Array [] +Array [ + Array [ + "logfile", + "{CWD}/test/lib/utils/tap-testdir-error-message-eacces-eperm--windows-true-loaded-true-cachePath-true-cacheDest-false-/cache/_logs/{DATE}-debug-0.log", + ], +] ` exports[`test/lib/utils/error-message.js TAP eacces/eperm {"windows":true,"loaded":true,"cachePath":true,"cacheDest":true} > must match snapshot 1`] = ` @@ -846,8 +878,8 @@ Object { "", Error: whoopsie { "code": "EACCES", - "dest": "/some/cache/dir/dest", - "path": "/some/cache/dir/path", + "dest": "{CWD}/test/lib/utils/tap-testdir-error-message-eacces-eperm--windows-true-loaded-true-cachePath-true-cacheDest-true-/cache/dest", + "path": "{CWD}/test/lib/utils/tap-testdir-error-message-eacces-eperm--windows-true-loaded-true-cachePath-true-cacheDest-true-/cache/path", }, ], ], @@ -855,7 +887,12 @@ Object { ` exports[`test/lib/utils/error-message.js TAP eacces/eperm {"windows":true,"loaded":true,"cachePath":true,"cacheDest":true} > must match snapshot 2`] = ` -Array [] +Array [ + Array [ + "logfile", + "{CWD}/test/lib/utils/tap-testdir-error-message-eacces-eperm--windows-true-loaded-true-cachePath-true-cacheDest-true-/cache/_logs/{DATE}-debug-0.log", + ], +] ` exports[`test/lib/utils/error-message.js TAP enoent without a file > must match snapshot 1`] = ` @@ -863,7 +900,7 @@ Object { "detail": Array [ Array [ "enoent", - "This is related to npm not being able to find a file.\\n", + "This is related to npm not being able to find a file./n", ], ], "summary": Array [ diff --git a/tap-snapshots/test/lib/utils/exit-handler.js.test.cjs b/tap-snapshots/test/lib/utils/exit-handler.js.test.cjs index eb383c104..523aabca2 100644 --- a/tap-snapshots/test/lib/utils/exit-handler.js.test.cjs +++ b/tap-snapshots/test/lib/utils/exit-handler.js.test.cjs @@ -5,16 +5,56 @@ * Make sure to inspect the output below. Do not ignore changes! */ 'use strict' -exports[`test/lib/utils/exit-handler.js TAP handles unknown error > should have expected log contents for unknown error 1`] = ` -24 verbose stack Error: ERROR -25 verbose cwd {CWD} -26 verbose Foo 1.0.0 -27 verbose argv "/node" "{CWD}/test/lib/utils/exit-handler.js" -28 verbose node v1.0.0 -29 verbose npm v1.0.0 -30 error code ERROR -31 error ERR ERROR -32 error ERR ERROR -33 verbose exit 1 +exports[`test/lib/utils/exit-handler.js TAP handles unknown error with logs and debug file > debug file contents 1`] = ` +0 timing npm:load:whichnode Completed in {TIME}ms +15 timing config:load Completed in {TIME}ms +16 timing npm:load:configload Completed in {TIME}ms +17 timing npm:load:setTitle Completed in {TIME}ms +19 timing npm:load:display Completed in {TIME}ms +20 verbose logfile {CWD}/test/lib/utils/tap-testdir-exit-handler-handles-unknown-error-with-logs-and-debug-file/cache/_logs/{DATE}-debug-0.log +21 timing npm:load:logFile Completed in {TIME}ms +22 timing npm:load:timers Completed in {TIME}ms +23 timing npm:load:configScope Completed in {TIME}ms +24 timing npm:load Completed in {TIME}ms +25 verbose stack Error: Unknown error +26 verbose cwd {CWD} +27 verbose Foo 1.0.0 +28 verbose argv "/node" "{CWD}/test/lib/utils/exit-handler.js" +29 verbose node v1.0.0 +30 verbose npm v1.0.0 +31 error code ECODE +32 error ERR SUMMARY Unknown error +33 error ERR DETAIL Unknown error +34 verbose exit 1 +35 timing npm Completed in {TIME}ms +36 verbose code 1 +37 error A complete log of this run can be found in: +37 error {CWD}/test/lib/utils/tap-testdir-exit-handler-handles-unknown-error-with-logs-and-debug-file/cache/_logs/{DATE}-debug-0.log +` +exports[`test/lib/utils/exit-handler.js TAP handles unknown error with logs and debug file > logs 1`] = ` +timing npm:load:whichnode Completed in {TIME}ms +timing config:load Completed in {TIME}ms +timing npm:load:configload Completed in {TIME}ms +timing npm:load:setTitle Completed in {TIME}ms +timing npm:load:display Completed in {TIME}ms +verbose logfile {CWD}/test/lib/utils/tap-testdir-exit-handler-handles-unknown-error-with-logs-and-debug-file/cache/_logs/{DATE}-debug-0.log +timing npm:load:logFile Completed in {TIME}ms +timing npm:load:timers Completed in {TIME}ms +timing npm:load:configScope Completed in {TIME}ms +timing npm:load Completed in {TIME}ms +verbose stack Error: Unknown error +verbose cwd {CWD} +verbose Foo 1.0.0 +verbose argv "/node" "{CWD}/test/lib/utils/exit-handler.js" +verbose node v1.0.0 +verbose npm v1.0.0 +error code ECODE +error ERR SUMMARY Unknown error +error ERR DETAIL Unknown error +verbose exit 1 +timing npm Completed in {TIME}ms +verbose code 1 +error A complete log of this run can be found in: + {CWD}/test/lib/utils/tap-testdir-exit-handler-handles-unknown-error-with-logs-and-debug-file/cache/_logs/{DATE}-debug-0.log ` diff --git a/tap-snapshots/test/lib/utils/log-file.js.test.cjs b/tap-snapshots/test/lib/utils/log-file.js.test.cjs new file mode 100644 index 000000000..ecce9eafc --- /dev/null +++ b/tap-snapshots/test/lib/utils/log-file.js.test.cjs @@ -0,0 +1,68 @@ +/* IMPORTANT + * This snapshot file is auto-generated, but designed for humans. + * It should be checked into source control and tracked carefully. + * Re-generate by setting TAP_SNAPSHOT=1 and running tests. + * Make sure to inspect the output below. Do not ignore changes! + */ +'use strict' +exports[`test/lib/utils/log-file.js TAP snapshot > must match snapshot 1`] = ` +0 error no prefix +1 error prefix with prefix +2 error prefix 1 2 3 +3 verbose { obj: { with: { many: [Object] } } } +4 verbose {"obj":{"with":{"many":{"props":1}}}} +5 verbose { +5 verbose "obj": { +5 verbose "with": { +5 verbose "many": { +5 verbose "props": 1 +5 verbose } +5 verbose } +5 verbose } +5 verbose } +6 verbose [ 'test', 'with', 'an', 'array' ] +7 verbose ["test","with","an","array"] +8 verbose [ +8 verbose "test", +8 verbose "with", +8 verbose "an", +8 verbose "array" +8 verbose ] +9 verbose [ 'test', [ 'with', [ 'an', [Array] ] ] ] +10 verbose ["test",["with",["an",["array"]]]] +11 verbose [ +11 verbose "test", +11 verbose [ +11 verbose "with", +11 verbose [ +11 verbose "an", +11 verbose [ +11 verbose "array" +11 verbose ] +11 verbose ] +11 verbose ] +11 verbose ] +12 error pre has many errors Error: message +12 error pre at stack trace line 0 +12 error pre at stack trace line 1 +12 error pre at stack trace line 2 +12 error pre at stack trace line 3 +12 error pre at stack trace line 4 +12 error pre at stack trace line 5 +12 error pre at stack trace line 6 +12 error pre at stack trace line 7 +12 error pre at stack trace line 8 +12 error pre at stack trace line 9 Error: message2 +12 error pre at stack trace line 0 +12 error pre at stack trace line 1 +12 error pre at stack trace line 2 +12 error pre at stack trace line 3 +12 error pre at stack trace line 4 +12 error pre at stack trace line 5 +12 error pre at stack trace line 6 +12 error pre at stack trace line 7 +12 error pre at stack trace line 8 +12 error pre at stack trace line 9 +13 error nostack [Error: message] + +` |