Skip to content

Commit

Permalink
fix(js): propagate error from child process to @nx/js:node executor (n…
Browse files Browse the repository at this point in the history
  • Loading branch information
jaysoo committed Apr 5, 2024
1 parent 8a9e2fd commit a9e554f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions e2e/js/src/js-executor-node.test.ts
Expand Up @@ -44,6 +44,7 @@ describe('js:node executor', () => {

const output = runCLI(`run ${esbuildLib}:run-node`, {
redirectStderr: true,
silenceError: true,
});
expect(output).toContain('Hello from my library!');
expect(output).toContain('This is an error');
Expand Down
8 changes: 7 additions & 1 deletion packages/js/src/executors/node/node.impl.ts
Expand Up @@ -175,7 +175,13 @@ export async function* nodeExecutor(
`NX Process exited with code ${code}, waiting for changes to restart...`
);
}
if (!options.watch) done();
if (!options.watch) {
if (code !== 0) {
error(new Error(`Process exited with code ${code}`));
} else {
done();
}
}
resolve();
});

Expand Down

0 comments on commit a9e554f

Please sign in to comment.