Comments (5)
Can you please try another browser. The error message depends on the browser. I just want to make sure if it is a browser issue or an issue of the reporter.
Thanks
from karma-mocha-reporter.
hi @4kochi
I saw log in chrome developer console, it still has no file path.
Note: my webpack is already configured to generate sourcemap for all code.
Thanks
from karma-mocha-reporter.
hi @4kochi
Do you know how to work around for this issue?
Thanks
from karma-mocha-reporter.
I had this same problem but I'm using webpack as a preprocessor. I'm not sure about a non-webpack focused solution, but I found a solution that'll work if you are using a build tool like webpack.
You'll need the karma-sourcemap-loader
plugin/preprocessor.
Then, you include 'sourcemap'
preprocessor after 'webpack'
in the preprocessors object and then do devtool: 'inline-source-map'
in your weback config of your karma.conf.js
you can get what you're looking for.
here's my example karma.conf.js
:
var webpackConfig = require('./webpack.config.js')
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['mocha', 'chai', 'sinon'],
files: [
{ pattern: 'test/**/*.spec.jsx', watched: false, serverd: true, included: true },
{ pattern: 'test/**/*.spec.js', watched: false, serverd: true, included: true },
],
exclude: [],
preprocessors: {
'test/**/*.spec.jsx': ['webpack', 'sourcemap'],
'test/**/*.spec.js': ['webpack', 'sourcemap'],
},
webpack: {
devtool: 'inline-source-map',
module: webpackConfig.module,
plugins: webpackConfig.plugins,
externals: webpackConfig.externals,
resolve: webpackConfig.resolve,
performance: false,
},
webpackServer: {
stats: 'errors-only',
},
reporters: ['progress', 'mocha'],
mochaReporter: {
colors: {
warning: 'black',
error: 'red',
},
showDiff: true,
},
client: {
captureConsole: false,
},
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
autoWatchBatchDelay: 1000,
browsers: ['Chrome'],
singleRun: false,
concurrency: Infinity,
})
}
Here's my example test file:
import chai from 'chai'
var expect = chai.expect
chai.should()
describe('Example Class', () => {
describe('some stuff', () => {
it('should do something', () => {
true.should.not.be.ok
})
})
})
As you can see above there's now a sourcemap indicating the file of containing the failing test and the line of the failing assertion at the end of the failing test:
at Context.<anonymous> (webpack:///test/ExampleTests.spec.js:12:25 <- test/ExampleTests.spec.js:13229:25)
from karma-mocha-reporter.
Hi @esayler
Thanks for your response. However, my karma config already has 'sourcemap' in preprocessor and devtool is 'inline-source-map'. So I cannot still solve this problem.
from karma-mocha-reporter.
Related Issues (20)
- Enhance symbols fallback for windows HOT 2
- Broken on Windows 10 HOT 3
- Console.log written to console twice HOT 3
- Order of output sections HOT 1
- Install procedure HOT 3
- display test duration HOT 1
- Diff isn't showing for object in array
- colors.info symbol can be used for skipped unit tests
- npm audit ansi-regex HOT 11
- I only see describes, no its. HOT 2
- Skipped tests listed in failed tests. HOT 5
- concurrent runs screw up log report HOT 6
- Browser specific tests won't be reported HOT 8
- Multiple describes with same name not grouped correctly
- Incorrect formatting inside Travis CI?? HOT 5
- Support for different failure messages for the same test case HOT 2
- Support tests with reserved prototype names HOT 1
- It doesn't working with angular-cli HOT 4
- Error sources occasionally being dropped from karma-mocha-reporter summary HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from karma-mocha-reporter.