karma-browserify: SourceMap position not found for trace: TypeError: ...
Hello,
I’ve got the following karma configuration:
module.exports = (config) ->
config.set
frameworks: ["browserify", "jasmine"]
files: [
"node_modules/angular/angular.js"
"node_modules/angular-mocks/angular-mocks.js"
"app/**/*.spec.js"
]
preprocessors:
"app/**/*.js": ["browserify"]
browserify:
debug: true
configure: (bundle) ->
bundle.once "prebundle", ->
bundle.transform "babelify"
reporters: ["dots"]
port: 8877
colors: true
logLevel: config.LOG_INFO
autoWatch: false
browsers: ["PhantomJS"]
singleRun: true
When I get an error, the stack trace cannot be linked with the source maps:
SourceMap position not found for trace: TypeError: undefined is not an object (evaluating '[...]') in http://localhost:8877/absolute/tmp/c6ec59ad61f294fd51d07305eeaf5c17.browserify?ed7e1e8ce42e802c4d614ba337bf1dc8ac6e27b9 (line 182)
Any Idea what’s going wrong here?
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 12
- Comments: 19 (3 by maintainers)
Any update on this?
I believe I have the same error testing React. my karma.conf.js looks like this:
My one and only test file has:
Footer component has only one div with class name ‘.app_footer’. The error I get is this:
This may not be specific to karma-browserify - I am using karma-webpack and am experiencing the same behavior.
If you are using
karma-sourcemap-loader, try switching tokarma-source-map-support.My case: Babel, no TypeScript, Webpack and not Browserify, I was using
karma-sourcemap-loader.console.error()to print stack traces without halting execution, there would be the same “SourceMap position not found for trace” noise, but console output for errors would not be mapped, line numbers referencing compiled bundles, not original sources.After switching, both use cases work perfectly fine, outputting mapped stack traces, no extra warnings.
This is likely not to be relevant to the OP’s problem, but this issue comes up as the Google’s top hit for “SourceMap position not found for trace”, so I hope that’ll help someone.
I just had the same issue with Typescript
2.2.x. I reverted to version2.0.8and the issue was fixed.Can also happen if one of your typescript files has a compile error - in my case it was one of my test files as referenced by the error:
02 06 2017 15:16:54.630:WARN [reporter]: SourceMap position not found for trace: undefined PhantomJS 2.1.1 (Windows 7 0.0.0) ERROR { “line”: 104034, “sourceURL”: “src/test.ts”, …
As indicated in the comments, this seems to be a TypeScript source map generation.
Please use reactions to say “me too” instead of notifying everyone on a thread
Sample.zip This is my sample project. Btw, I only get that error when the test fails.