-
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
- Loading branch information
Showing
3 changed files
with
57 additions
and
7 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,48 @@ | ||
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`); | ||
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