Open jeffrson opened 4 years ago
I cannot reproduce the problem, I suspect it's an edge case of your particular setup - please update the reproduction snippet in your original post until Sherlock can reproduce the problem. Thanks 🙏
We couldn't reproduce your issue (all the assertions passed on master).
The reproduction case in your issue seems broken (ie it neither pass nor fail due to throwing an unmanaged exception):
Error: Command failed: /usr/bin/node /github/workspace/scripts/actions/../run-yarn.js build
Usage Error: Couldn't find a script named "build".
$ yarn run <scriptName> ...
at ChildProcess.exithandler (child_process.js:295:12)
at ChildProcess.emit (events.js:210:5)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
Remember: any non-Jest exceptions will cause the test to be reported as broken. If you expect something to pass without throwing, you must wrap it into something like await expect(...).resolves.toBeTruthy()
. If you instead expect something to throw, you need to wrap it into await expect(...).rejects.toThrow()
.
The reproduction case in your issue seems broken (ie it neither pass nor fail due to throwing an unmanaged exception):
Error: Command failed: /usr/bin/node /github/workspace/scripts/actions/../run-yarn.js build
Usage Error: Couldn't find a script named "build".
$ yarn run <scriptName> ...
at ChildProcess.exithandler (child_process.js:295:12)
at ChildProcess.emit (events.js:210:5)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
Remember: any non-Jest exceptions will cause the test to be reported as broken. If you expect something to pass without throwing, you must wrap it into something like await expect(...).resolves.toBeTruthy()
. If you instead expect something to throw, you need to wrap it into await expect(...).rejects.toThrow()
.
The reproduction case in your issue seems broken (ie it neither pass nor fail due to throwing an unmanaged exception):
Error: Command failed: /usr/bin/node /github/workspace/scripts/actions/../run-yarn.js build
index.ts(1,23): error TS2307: Cannot find module 'not_found'.
at ChildProcess.exithandler (child_process.js:295:12)
at ChildProcess.emit (events.js:210:5)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
Remember: any non-Jest exceptions will cause the test to be reported as broken. If you expect something to pass without throwing, you must wrap it into something like await expect(...).resolves.toBeTruthy()
. If you instead expect something to throw, you need to wrap it into await expect(...).rejects.toThrow()
.
This issue reproduces on master:
Error: expect(received).rejects.toThrow(expected)
Expected substring: "command not found"
Received message: "Command failed: /usr/bin/node /github/workspace/scripts/actions/../run-yarn.js build
index.ts(1,23): error TS2307: Cannot find module 'not_found'.
"
at Object.toThrow (/github/workspace/.yarn/cache/expect-npm-24.8.0-8c7640c562-2.zip/node_modules/expect/build/index.js:242:20)
at module.exports (evalmachine.<anonymous>:15:37)
at async /github/workspace/.yarn/cache/@arcanis-sherlock-npm-1.0.38-d4f5e2dbf3-2.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:56:13
at async executeInTempDirectory (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-1.0.38-d4f5e2dbf3-2.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:17:16)
at async Object.executeRepro (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-1.0.38-d4f5e2dbf3-2.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:24:12)
at async ExecCommand.execute (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-1.0.38-d4f5e2dbf3-2.zip/node_modules/@arcanis/sherlock/lib/commands/exec.js:25:38)
at async ExecCommand.validateAndExecute (/github/workspace/.yarn/cache/clipanion-npm-2.0.0-rc.16-b9444aaf89-2.zip/node_modules/clipanion/lib/advanced/Command.js:161:26)
at async Cli.run (/github/workspace/.yarn/cache/clipanion-npm-2.0.0-rc.16-b9444aaf89-2.zip/node_modules/clipanion/lib/advanced/Cli.js:74:24)
at async Cli.runExit (/github/workspace/.yarn/cache/clipanion-npm-2.0.0-rc.16-b9444aaf89-2.zip/node_modules/clipanion/lib/advanced/Cli.js:83:28)
@arcanis
Well, I'm very sorry - I give up with Sherlock. I would need to ignore stdout of yarn build
and check stderr. I couldn't find out how to do this.
I put a repo with instructions at https://github.com/jeffrson/yarn2_command_not_found.git
It's obviously related to "NoEmitOnError" in tsconfig.json. If this property is not present the spurious "command not found: tsc" disappears.
I have this script entry in package.json:
When there's a typescript error, yarn outputs the following error message:
in addition to the error reported by tsc itself.
Repro
Environment if relevant (please complete the following information):