Skip to content

Commit

Permalink
chore(default-rules): rename test suites
Browse files Browse the repository at this point in the history
  • Loading branch information
boneskull committed Oct 11, 2023
1 parent 3953388 commit a5ad1ef
Show file tree
Hide file tree
Showing 6 changed files with 578 additions and 823 deletions.
244 changes: 4 additions & 240 deletions packages/midnight-smoker/__snapshots__/cli.spec.ts.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,143 +89,14 @@ Invalid package, must have name and version
`

exports['midnight-smoker CLI basic behavior when packing fails when in verbose mode should provide more detail [snapshot] 1'] = `
2023-10-11T06:36:39.069Z midnight-smoker:cli Final options: { _: [], verbose: true, pm: [ 'npm@latest' ], '$0': 'smoker' }
2023-10-11T06:36:39.070Z midnight-smoker:plugin-registry Found entry point /home/boneskull/projects/boneskull/midnight-smoker/packages/plugin-default-rules/dist/index.js for plugin @midnight-smoker/plugin-default-rules
2023-10-11T06:36:39.094Z midnight-smoker:plugin-registry Attempting to load plugin @midnight-smoker/plugin-default-rules@0.0.0 (/home/boneskull/projects/boneskull/midnight-smoker/packages/plugin-default-rules/dist/index.js)
2023-10-11T06:36:39.105Z midnight-smoker:plugin-registry Loaded plugin @midnight-smoker/plugin-default-rules@0.0.0 (/home/boneskull/projects/boneskull/midnight-smoker/packages/plugin-default-rules/dist/index.js)
2023-10-11T06:36:39.108Z midnight-smoker:plugin-registry Found 4 rule(s) in plugin @midnight-smoker/plugin-default-rules@0.0.0 (/home/boneskull/projects/boneskull/midnight-smoker/packages/plugin-default-rules/dist/index.js)
2023-10-11T06:36:39.110Z midnight-smoker:options Normalized options: {
add: [],
all: false,
bail: false,
includeRoot: false,
json: false,
linger: false,
verbose: true,
workspace: [],
pm: [ 'npm@latest' ],
script: [],
scripts: [],
loose: false,
checks: true,
rules: {
'no-banned-files': { severity: 'error', opts: [Object] },
'no-missing-entry-point': { severity: 'error', opts: {} },
'no-missing-exports': { severity: 'error', opts: [Object] },
'no-missing-pkg-files': { severity: 'error', opts: [Object] }
},
plugin: []
}
2023-10-11T06:36:39.118Z midnight-smoker:pm:loader Requested package managers: [ 'npm@<version>' ]
2023-10-11T06:36:39.119Z midnight-smoker:pm:loader Loading package managers: [ 'npm@<version>' ]
💨 midnight-smoker v<version>
- Packing current project…
2023-10-11T06:36:39.122Z midnight-smoker:smoker Packing into /tmp/midnight-smoker-p5szsB using npm@<version>
2023-10-11T06:36:39.516Z midnight-smoker:pm:npm9 (pack) Failed: Error: Command failed with exit code 1: <path/to/>/bin/node <path/to/>/.bin/corepack npm@<version> pack --json --pack-destination=<path/to/dir> --foreground-scripts=false
npm ERR! Invalid package, must have name and version
npm ERR! A complete log of this run can be found in: <path/to/some>.log
{
"error": {
"code": null,
"summary": "Invalid package, must have name and version",
"detail": ""
}
}
at makeError (<path/to/file>:<line>:<col>)
at handlePromise (<path/to/file>:<line>:<col>)
at processTicksAndRejections (<path/to/file>:<line>:<col>)
at CorepackExecutor.exec (<path/to/file>:<line>:<col>)
at Npm9.pack (<path/to/file>:<line>:<col>)
at Smoker.pack (<path/to/file>:<line>:<col>)
at Smoker.smoke (<path/to/file>:<line>:<col>)
at Object.handler (<path/to/file>:<line>:<col>) {
shortMessage: 'Command failed with exit code 1: <path/to/>/bin/node <path/to/>/.bin/corepack npm@<version> pack --json --pack-destination=<path/to/dir> --foreground-scripts=false',
command: <path/to/>/bin/node <path/to/>/.bin/corepack npm@<version> pack --json --pack-destination=<path/to/dir> --foreground-scripts=false',
escapedCommand: '"<path/to/>/bin/node" "<path/to/>/.bin/corepack" "npm@<version>" pack --json "--pack-destination=<path/to/dir> "--foreground-scripts=false"',
exitCode: 1,
signal: undefined,
signalDescription: undefined,
stdout: '{\\n' +
' "error": {\\n' +
' "code": null,\\n' +
' "summary": "Invalid package, must have name and version",\\n' +
' "detail": ""\\n' +
' }\\n' +
'}',
stderr: 'npm ERR! Invalid package, must have name and version\\n' +
'\\n' +
'npm ERR! A complete log of this run can be found in: <path/to/some>.log',
failed: true,
timedOut: false,
isCanceled: false,
killed: false
}
2023-10-11T06:36:39.516Z midnight-smoker:pm:npm9 Trying to parse stdout: {
"error": {
"code": null,
"summary": "Invalid package, must have name and version",
"detail": ""
}
}
✖ Failed while packing!
PackError: Package manager "npm" failed to pack:
Package manager "npm" failed to pack:
Invalid package, must have name and version
at Npm9.pack (<path/to/file>:<line>:<col>)
at processTicksAndRejections (<path/to/file>:<line>:<col>)
at Smoker.pack (<path/to/file>:<line>:<col>)
at Smoker.smoke (<path/to/file>:<line>:<col>)
at Object.handler (<path/to/file>:<line>:<col>) {
code: 'ESMOKER_PACK',
cause: {
pm: 'npm',
error: Error: Command failed with exit code 1: <path/to/>/bin/node <path/to/>/.bin/corepack npm@<version> pack --json --pack-destination=<path/to/dir> --foreground-scripts=false
npm ERR! Invalid package, must have name and version
npm ERR! A complete log of this run can be found in: <path/to/some>.log
{
"error": {
"code": null,
"summary": "Invalid package, must have name and version",
"detail": ""
}
}
at makeError (<path/to/file>:<line>:<col>)
at handlePromise (<path/to/file>:<line>:<col>)
at processTicksAndRejections (<path/to/file>:<line>:<col>)
at CorepackExecutor.exec (<path/to/file>:<line>:<col>)
at Npm9.pack (<path/to/file>:<line>:<col>)
at Smoker.pack (<path/to/file>:<line>:<col>)
at Smoker.smoke (<path/to/file>:<line>:<col>)
at Object.handler (<path/to/file>:<line>:<col>) {
shortMessage: 'Command failed with exit code 1: <path/to/>/bin/node <path/to/>/.bin/corepack npm@<version> pack --json --pack-destination=<path/to/dir> --foreground-scripts=false',
command: <path/to/>/bin/node <path/to/>/.bin/corepack npm@<version> pack --json --pack-destination=<path/to/dir> --foreground-scripts=false',
escapedCommand: '"<path/to/>/bin/node" "<path/to/>/.bin/corepack" "npm@<version>" pack --json "--pack-destination=<path/to/dir> "--foreground-scripts=false"',
exitCode: 1,
signal: undefined,
signalDescription: undefined,
stdout: '{\\n' +
' "error": {\\n' +
' "code": null,\\n' +
' "summary": "Invalid package, must have name and version",\\n' +
' "detail": ""\\n' +
' }\\n' +
'}',
stderr: 'npm ERR! Invalid package, must have name and version\\n' +
'\\n' +
'npm ERR! A complete log of this run can be found in: <path/to/some>.log',
failed: true,
timedOut: false,
isCanceled: false,
killed: false
},
output: 'npm ERR! Invalid package, must have name and version\\n' +
'\\n' +
'npm ERR! A complete log of this run can be found in: <path/to/some>.log'
}
}
(use --verbose for more details)
`

exports['midnight-smoker CLI basic behavior when installation fails should provide a reason [snapshot] 1'] = `
Expand All @@ -240,121 +111,14 @@ Package manager "npm" failed to install packages
`

exports['midnight-smoker CLI basic behavior when installation fails when in verbose mode should provide more detail [snapshot] 1'] = `
2023-10-11T06:36:41.003Z midnight-smoker:cli Final options: { _: [], verbose: true, pm: [ 'npm@latest' ], '$0': 'smoker' }
2023-10-11T06:36:41.004Z midnight-smoker:plugin-registry Found entry point /home/boneskull/projects/boneskull/midnight-smoker/packages/plugin-default-rules/dist/index.js for plugin @midnight-smoker/plugin-default-rules
2023-10-11T06:36:41.038Z midnight-smoker:plugin-registry Attempting to load plugin @midnight-smoker/plugin-default-rules@0.0.0 (/home/boneskull/projects/boneskull/midnight-smoker/packages/plugin-default-rules/dist/index.js)
2023-10-11T06:36:41.049Z midnight-smoker:plugin-registry Loaded plugin @midnight-smoker/plugin-default-rules@0.0.0 (/home/boneskull/projects/boneskull/midnight-smoker/packages/plugin-default-rules/dist/index.js)
2023-10-11T06:36:41.052Z midnight-smoker:plugin-registry Found 4 rule(s) in plugin @midnight-smoker/plugin-default-rules@0.0.0 (/home/boneskull/projects/boneskull/midnight-smoker/packages/plugin-default-rules/dist/index.js)
2023-10-11T06:36:41.055Z midnight-smoker:options Normalized options: {
add: [],
all: false,
bail: false,
includeRoot: false,
json: false,
linger: false,
verbose: true,
workspace: [],
pm: [ 'npm@latest' ],
script: [],
scripts: [],
loose: false,
checks: true,
rules: {
'no-banned-files': { severity: 'error', opts: [Object] },
'no-missing-entry-point': { severity: 'error', opts: {} },
'no-missing-exports': { severity: 'error', opts: [Object] },
'no-missing-pkg-files': { severity: 'error', opts: [Object] }
},
plugin: []
}
2023-10-11T06:36:41.062Z midnight-smoker:pm:loader Requested package managers: [ 'npm@<version>' ]
2023-10-11T06:36:41.063Z midnight-smoker:pm:loader Loading package managers: [ 'npm@<version>' ]
💨 midnight-smoker v<version>
- Packing current project…
2023-10-11T06:36:41.067Z midnight-smoker:smoker Packing into /tmp/midnight-smoker-7sqP3X using npm@<version>
2023-10-11T06:36:41.514Z midnight-smoker:pm:npm9 (pack) Packed 1 packages
✔ Packed 1 unique package using npm@<version>…
- Installing 1 unique package from tarball using npm@<version>…
2023-10-11T06:36:41.518Z midnight-smoker:smoker Installing package(s) [ 'install-error' ] using npm@<version>
2023-10-11T06:36:41.951Z midnight-smoker:pm:npm9 Trying to parse stdout:
✖ Failed while installing!
InstallError: Package manager "npm" failed to install packages
at Npm9.install (<path/to/file>:<line>:<col>)
at processTicksAndRejections (<path/to/file>:<line>:<col>)
at Smoker.install (<path/to/file>:<line>:<col>)
at Smoker.smoke (<path/to/file>:<line>:<col>)
at Object.handler (<path/to/file>:<line>:<col>) {
code: 'ESMOKER_INSTALL',
cause: {
pm: 'npm',
error: Error: Command failed with exit code 1: <path/to/>/bin/node <path/to/>/.bin/corepack npm@<version> install --no-audit --no-package-lock --install-strategy=shallow <path/to/some>.tgz
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: undefined@undefined
npm ERR! Found: install-error@1.0.0
npm ERR! node_modules/install-error
npm ERR! <path/to/some>.tgz" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer install-error@"2.0.0" from install-error@1.0.0
npm ERR! node_modules/install-error
npm ERR! <path/to/some>.tgz" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR!
npm ERR! For a full report see:
npm ERR! <path/to/some>.txt
npm ERR! A complete log of this run can be found in: <path/to/some>.log
at makeError (<path/to/file>:<line>:<col>)
at handlePromise (<path/to/file>:<line>:<col>)
at processTicksAndRejections (<path/to/file>:<line>:<col>)
at CorepackExecutor.exec (<path/to/file>:<line>:<col>)
at Npm9.install (<path/to/file>:<line>:<col>)
at Smoker.install (<path/to/file>:<line>:<col>)
at Smoker.smoke (<path/to/file>:<line>:<col>)
at Object.handler (<path/to/file>:<line>:<col>) {
shortMessage: 'Command failed with exit code 1: <path/to/>/bin/node <path/to/>/.bin/corepack npm@<version> install --no-audit --no-package-lock --install-strategy=shallow <path/to/some>.tgz',
command: <path/to/>/bin/node <path/to/>/.bin/corepack npm@<version> install --no-audit --no-package-lock --install-strategy=shallow <path/to/some>.tgz',
escapedCommand: '"<path/to/>/bin/node" "<path/to/>/.bin/corepack" "npm@<version>" install --no-audit --no-package-lock "--install-strategy=shallow" <path/to/some>.tgz"',
exitCode: 1,
signal: undefined,
signalDescription: undefined,
stdout: '',
stderr: 'npm ERR! code ERESOLVE\\n' +
'npm ERR! ERESOLVE unable to resolve dependency tree\\n' +
'npm ERR! \\n' +
'npm ERR! While resolving: undefined@undefined\\n' +
'npm ERR! Found: install-error@1.0.0\\n' +
'npm ERR! node_modules/install-error\\n' +
'npm ERR! <path/to/some>.tgz" from the root project\\n' +
'npm ERR! \\n' +
'npm ERR! Could not resolve dependency:\\n' +
'npm ERR! peer install-error@"2.0.0" from install-error@1.0.0\\n' +
'npm ERR! node_modules/install-error\\n' +
'npm ERR! <path/to/some>.tgz" from the root project\\n' +
'npm ERR! \\n' +
'npm ERR! Fix the upstream dependency conflict, or retry\\n' +
'npm ERR! this command with --force or --legacy-peer-deps\\n' +
'npm ERR! to accept an incorrect (and potentially broken) dependency resolution.\\n' +
'npm ERR! \\n' +
'npm ERR! \\n' +
'npm ERR! For a full report see:\\n' +
'npm ERR! <path/to/some>.txt\\n' +
'\\n' +
'npm ERR! A complete log of this run can be found in: <path/to/some>.log',
failed: true,
timedOut: false,
isCanceled: false,
killed: false
}
}
}
Package manager "npm" failed to install packages
(use --verbose for more details)
`

exports['midnight-smoker CLI option --help should show help text [snapshot] 1'] = `
Expand Down
9 changes: 4 additions & 5 deletions packages/midnight-smoker/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ async function main(args: string[]): Promise<void> {
const {packageJson} = result;
const {version, homepage} = packageJson;

let verbose = false;
const verbose = false;
try {
const config = await readConfigFile();

Expand Down Expand Up @@ -123,10 +123,9 @@ async function main(args: string[]): Promise<void> {
if (opts.pm?.some((pm) => pm.startsWith('pnpm'))) {
throw new NotImplementedError('pnpm is currently unsupported');
}
verbose = Boolean(opts.verbose || Debug.enabled('midnight-smoker'));
if (verbose) {
Debug.enable('midnight-smoker*');
}
opts.verbose = Boolean(
opts.verbose || Debug.enabled('midnight-smoker'),
);
debug('Final options: %O', opts);

const smoker = await Smoker.init(opts);
Expand Down
Loading

0 comments on commit a5ad1ef

Please sign in to comment.