-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(js): node executor should always log error (#17622)
- Loading branch information
Showing
3 changed files
with
94 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { | ||
cleanupProject, | ||
newProject, | ||
runCLI, | ||
uniq, | ||
updateFile, | ||
updateProjectConfig, | ||
} from '@nx/e2e/utils'; | ||
|
||
describe('js:node error handling', () => { | ||
let scope: string; | ||
|
||
beforeEach(() => { | ||
scope = newProject(); | ||
}); | ||
|
||
afterEach(() => cleanupProject()); | ||
|
||
it('should log out the error', () => { | ||
const esbuildLib = uniq('esbuildlib'); | ||
|
||
runCLI( | ||
`generate @nx/js:lib ${esbuildLib} --bundler=esbuild --no-interactive` | ||
); | ||
|
||
updateFile(`libs/${esbuildLib}/src/index.ts`, () => { | ||
return ` | ||
console.log('Hello from my library!'); | ||
throw new Error('This is an error'); | ||
`; | ||
}); | ||
|
||
updateProjectConfig(esbuildLib, (config) => { | ||
config.targets['run-node'] = { | ||
executor: '@nx/js:node', | ||
options: { | ||
buildTarget: `${esbuildLib}:build`, | ||
watch: false, | ||
}, | ||
}; | ||
return config; | ||
}); | ||
|
||
const output = runCLI(`run ${esbuildLib}:run-node`, { | ||
redirectStderr: true, | ||
}); | ||
expect(output).toContain('Hello from my library!'); | ||
expect(output).toContain('This is an error'); | ||
}, 240_000); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36838d6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
nx-dev – ./
nx-five.vercel.app
nx-dev-nrwl.vercel.app
nx-dev-git-master-nrwl.vercel.app
nx.dev