Closed mbenna closed 5 years ago
fwiw, I also added this to one of my spec files to help catch the problem during my test suite rather than manually noticing it has broken:
it('source maps should work in karma / jarmine', () => {
const err = new Error('spec')
let shouldFail = false
shouldFail = shouldFail || / firefox\//i.test(navigator.userAgent) // doesn't work in firefox
shouldFail = shouldFail || / edge\//i.test(navigator.userAgent) // doesn't work in edge
// console.log(`navigator.userAgent = ${navigator.userAgent}`)
// Edge: "Mozilla/5.0 (Windows NT 10.0; Win64; x64; ServiceUI 14) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.18362"
if (err.stack.match(/\/src\/app\/app.component.spec.ts:3[0-9]:[0-9]+/)) {
if (shouldFail) {
fail(`Sweet! Source maps are now working in this browser!`)
}
} else {
if (!shouldFail) {
fail(`source maps don't seem to be working! Probably a recent node_module upgrade broke them.`)
}
}
// console.log(`stack = ${err.stack}`)
// // It should look something like this:
// stack = Error: spec
// at UserContext.<anonymous> (http://localhost:9876/_karma_webpack_/webpack:/src/app/app.component.spec.ts:44:15)
// at ZoneDelegate../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (http://localhost:9876/_karma_webpack_/webpack:/node_modules/zone.js/dist/zone.js:391:1)
})
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.
π Bug report
Command (mark with an
x
)Is this a regression?
Yes. Sourcemaps in karma/jasmine worked fine up to and including@angular/cli 8.0.0.beta.9, but from beta.10 to current (rc.4 today) sourcemaps no longer work.
Description
Example working output from beta.9:
Example broken output from beta.10+:
π¬ Minimal Reproduction
ng test
and ensure test passes.ng test
again and note you get a line number such asat UserContext.<anonymous> (src/app/app.component.spec.ts:32:18)
ng update --next --all --force
to update to something more recent than 8.0.0.beta.10ng test
and note line numbers no longer help you find your spec in app.component.ts. Instead you see something like this:π₯ Exception or Error
n/a
π Your Environment
ng version:
Anything else relevant?
Not that I know of.