-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeScript Line Numbers From Unit Tests Fail to Use sourceMaps #1531
Comments
Narrowed this down to an issue with setting |
This appears to be a known issue with Here's the small reproduction I created with a detailed readme: https://github.com/wesleygrimes/ts-jest-coverage-incorrect-line-numbers/blob/master/README.md |
Thanks - that unblocks us until the fix is found! |
You're welcome! We will get it resolved but I am glad you have a workaround. |
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context. |
Expected Behavior
When "ng test" is used and either an uncaught error or console.log occurs outside of a test file (exp: in a component file) - the line numbers do not use sourceMaps
Current Behavior
The line number of uncaught errors and console logs are a hundred or more lines off.
Failure Information (for bugs)
It looks like "ng test" isn't loading source map files.
Steps to Reproduce
run command:
npx --ignore-existing create-nx-workspace nx-dev-test
run command:
cd nx-dev-test
run command:
ng add @nrwl/angular --defaults
run command:
ng g @nrwl/angular:application quicky
In app.component.ts - add the following (to your class):
foo():void{
throw new Error('test');
}
In app.component.spec.ts add a new unit test to call your new function:
it('check line number for crash', () => {
const appComponent:AppComponent = new AppComponent();
appComponent.foo();
});
run command:
ng test
Note that the line number is off by over a hundred - example:
at AppComponent.foo (src/app/app.component.ts:196:11)
Context
Please provide any relevant information about your setup:
npx: 6.9.0
"@angular/cli": "8.0.0"
angular.json: default file generated using steps provided
"@angular-devkit/build-angular": "^0.800.0",
Failure Logs
● AppComponent › check line number for crash
Other
The text was updated successfully, but these errors were encountered: