After setup process on existing workspace, I tried to test an app with nx estest app command and every test did fail with esbuild error (similar to the one on the bottom). I spent some time on debugging and I found out that comments containing special characters can lead to code injection which fails transform process.
Steps to reproduce
Add comment with : character between constructor parameters in any component and run its tests.
constructor(
// :
) {
}
Failure logs
FAIL app2 apps/app2/src/app/app.component.spec.ts
● Test suite failed to run
Transform failed with 1 error:
<stdin>:23:2: ERROR: Expected identifier but found "}"
at failureErrorWithLog (../../node_modules/esbuild/lib/main.js:1602:15)
at ../../node_modules/esbuild/lib/main.js:1391:29
at ../../node_modules/esbuild/lib/main.js:665:9
at handleIncomingPacket (../../node_modules/esbuild/lib/main.js:762:9)
at Socket.readFromStdout (../../node_modules/esbuild/lib/main.js:632:7)
After setup process on existing workspace, I tried to test an app with
nx estest app
command and every test did fail with esbuild error (similar to the one on the bottom). I spent some time on debugging and I found out that comments containing special characters can lead to code injection which fails transform process.Steps to reproduce
Add comment with
:
character between constructor parameters in any component and run its tests.Failure logs