Skip to content

Commit

Permalink
chore: convert run-script tests to snapshots (#7517)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukekarrys authored May 14, 2024
1 parent 76aef74 commit dcfc3de
Show file tree
Hide file tree
Showing 2 changed files with 312 additions and 221 deletions.
277 changes: 277 additions & 0 deletions tap-snapshots/test/lib/commands/run-script.js.test.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,277 @@
/* 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/commands/run-script.js TAP list scripts no args > basic report 1`] = `
Lifecycle scripts included in x@1.2.3:
test
exit 2
start
node server.js
stop
node kill-server.js
available via \`npm run-script\`:
preenv
echo before the env
postenv
echo after the env
`

exports[`test/lib/commands/run-script.js TAP list scripts parseable > must match snapshot 1`] = `
test:exit 2
start:node server.js
stop:node kill-server.js
preenv:echo before the env
postenv:echo after the env
`

exports[`test/lib/commands/run-script.js TAP list scripts warn json > json report 1`] = `
{
"test": "exit 2",
"start": "node server.js",
"stop": "node kill-server.js",
"preenv": "echo before the env",
"postenv": "echo after the env"
}
`

exports[`test/lib/commands/run-script.js TAP list scripts, only commands > must match snapshot 1`] = `
Lifecycle scripts included in x@1.2.3:
preversion
echo doing the version dance
`

exports[`test/lib/commands/run-script.js TAP list scripts, only non-commands > must match snapshot 1`] = `
Scripts available in x@1.2.3 via \`npm run-script\`:
glorp
echo doing the glerp glop
`

exports[`test/lib/commands/run-script.js TAP workspaces failed workspace run with succeeded runs > should log error msgs for each workspace script 1`] = `
Lifecycle script \`glorp\` failed with error:
Error: ERR
in workspace: a@1.0.0
at location: {CWD}/prefix/packages/a
`

exports[`test/lib/commands/run-script.js TAP workspaces list all scripts --json > must match snapshot 1`] = `
{
"a": {
"glorp": "echo a doing the glerp glop"
},
"b": {
"glorp": "echo b doing the glerp glop"
},
"c": {
"test": "exit 0",
"posttest": "echo posttest",
"lorem": "echo c lorem"
},
"d": {
"test": "exit 0",
"posttest": "echo posttest"
},
"e": {
"test": "exit 0",
"start": "echo start something"
},
"noscripts": {}
}
`

exports[`test/lib/commands/run-script.js TAP workspaces list all scripts --parseable > must match snapshot 1`] = `
a:glorp:echo a doing the glerp glop
b:glorp:echo b doing the glerp glop
c:test:exit 0
c:posttest:echo posttest
c:lorem:echo c lorem
d:test:exit 0
d:posttest:echo posttest
e:test:exit 0
e:start:echo start something
`

exports[`test/lib/commands/run-script.js TAP workspaces list all scripts > must match snapshot 1`] = `
Scripts available in a@1.0.0 via \`npm run-script\`:
glorp
echo a doing the glerp glop
Scripts available in b@2.0.0 via \`npm run-script\`:
glorp
echo b doing the glerp glop
Lifecycle scripts included in c@1.0.0:
test
exit 0
posttest
echo posttest
available via \`npm run-script\`:
lorem
echo c lorem
Lifecycle scripts included in d@1.0.0:
test
exit 0
posttest
echo posttest
Lifecycle scripts included in e:
test
exit 0
start
echo start something
`

exports[`test/lib/commands/run-script.js TAP workspaces list all scripts with colors > must match snapshot 1`] = `
Scripts available in a@1.0.0 via \`npm run-script\`:
glorp
echo a doing the glerp glop
Scripts available in b@2.0.0 via \`npm run-script\`:
glorp
echo b doing the glerp glop
Lifecycle scripts included in c@1.0.0:
test
exit 0
posttest
echo posttest
available via \`npm run-script\`:
lorem
echo c lorem
Lifecycle scripts included in d@1.0.0:
test
exit 0
posttest
echo posttest
Lifecycle scripts included in e:
test
exit 0
start
echo start something
`

exports[`test/lib/commands/run-script.js TAP workspaces list regular scripts, filtered by name > must match snapshot 1`] = `
Scripts available in a@1.0.0 via \`npm run-script\`:
glorp
echo a doing the glerp glop
Scripts available in b@2.0.0 via \`npm run-script\`:
glorp
echo b doing the glerp glop
`

exports[`test/lib/commands/run-script.js TAP workspaces list regular scripts, filtered by parent folder > must match snapshot 1`] = `
Scripts available in a@1.0.0 via \`npm run-script\`:
glorp
echo a doing the glerp glop
Scripts available in b@2.0.0 via \`npm run-script\`:
glorp
echo b doing the glerp glop
Lifecycle scripts included in c@1.0.0:
test
exit 0
posttest
echo posttest
available via \`npm run-script\`:
lorem
echo c lorem
Lifecycle scripts included in d@1.0.0:
test
exit 0
posttest
echo posttest
Lifecycle scripts included in e:
test
exit 0
start
echo start something
`

exports[`test/lib/commands/run-script.js TAP workspaces list regular scripts, filtered by path > must match snapshot 1`] = `
Scripts available in a@1.0.0 via \`npm run-script\`:
glorp
echo a doing the glerp glop
`

exports[`test/lib/commands/run-script.js TAP workspaces missing scripts in all workspaces > should log error msgs for each workspace script 1`] = `
Lifecycle script \`missing-script\` failed with error:
Error: Missing script: "missing-script"
To see a list of scripts, run:
npm run
in workspace: a@1.0.0
at location: {CWD}/prefix/packages/a
Lifecycle script \`missing-script\` failed with error:
Error: Missing script: "missing-script"
To see a list of scripts, run:
npm run
in workspace: b@2.0.0
at location: {CWD}/prefix/packages/b
Lifecycle script \`missing-script\` failed with error:
Error: Missing script: "missing-script"
To see a list of scripts, run:
npm run
in workspace: c@1.0.0
at location: {CWD}/prefix/packages/c
Lifecycle script \`missing-script\` failed with error:
Error: Missing script: "missing-script"
To see a list of scripts, run:
npm run
in workspace: d@1.0.0
at location: {CWD}/prefix/packages/d
Lifecycle script \`missing-script\` failed with error:
Error: Missing script: "missing-script"
To see a list of scripts, run:
npm run
in workspace: e
at location: {CWD}/prefix/packages/e
Lifecycle script \`missing-script\` failed with error:
Error: Missing script: "missing-script"
To see a list of scripts, run:
npm run
in workspace: noscripts@1.0.0
at location: {CWD}/prefix/packages/noscripts
`

exports[`test/lib/commands/run-script.js TAP workspaces missing scripts in some workspaces > should log error msgs for each workspace script 1`] = `
Lifecycle script \`test\` failed with error:
Error: Missing script: "test"
To see a list of scripts, run:
npm run
in workspace: a@1.0.0
at location: {CWD}/prefix/packages/a
Lifecycle script \`test\` failed with error:
Error: Missing script: "test"
To see a list of scripts, run:
npm run
in workspace: b@2.0.0
at location: {CWD}/prefix/packages/b
`

exports[`test/lib/commands/run-script.js TAP workspaces single failed workspace run > should log error msgs for each workspace script 1`] = `
Lifecycle script \`test\` failed with error:
Error: err
in workspace: c@1.0.0
at location: {CWD}/prefix/packages/c
`
Loading

0 comments on commit dcfc3de

Please sign in to comment.