-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Jasmine html web page reports wrong line numbers #1598
Comments
I've just tried launching the same test suite with karma and I got the wrong line numbers as well. |
Jasmine doesn't currently have a good story around using sourcemaps for your tests (see #491), so it's possible that this is causing some of the confusion in the stack traces that Jasmine prints/reports. I would still like to get a better solution for this, but I'm not sure of the right approach at this point in time. Hope this helps. Thanks for using Jasmine! |
When Jasmine was displaying the stacktrace in terms of minified files, I was happily using sourcemapped-stacktrace. Then we updated Jasmine and got rid of sourcemapped-stacktrace because Jasmine did the job of looking into the source maps. Unfortunately, the lines numbers became slightly wrong. What about letting sourcemapped-stacktrace do the work for Jasmine? |
Jasmine just asks the thrown error for its Hope this helps. |
- Merges #1598 from @elliot-nelson
I've just created the smallest project reproducing this issue. How to reproduce:
Note: if you remove the useless package.jsonAll the dependencies are the latest as of today: {
"name": "jasmine-line-number-bug",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"devDependencies": {
"jasmine-core": "^3.4.0",
"webpack": "^4.39.2",
"webpack-cli": "^3.3.7"
}
} tests.html<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<title>Client Tests</title>
<link rel="stylesheet" type="text/css" href="./node_modules/jasmine-core/lib/jasmine-core/jasmine.css">
<script type="text/javascript" src="./node_modules/jasmine-core/lib/jasmine-core/jasmine.js"></script>
<script type="text/javascript" src="./node_modules/jasmine-core/lib/jasmine-core/jasmine-html.js"></script>
<script type="text/javascript" src="./node_modules/jasmine-core/lib/jasmine-core/boot.js"></script>
<script src="./build/jasmine.latest.js"></script>
</head>
<body>
</body>
</html> tests.jsimport {add} from './util';
describe('line numbers', () => {
it('should be the same', () => {
let expected = 3;
let actual = 1+1;
expect(actual).toEqual(expected);
});
}); util.jsexport function add(a,b) {
return a+b;
} webpack.jasmine.config.jsconst path = require('path');
let config = {
entry: './tests.js',
mode: 'development',
output: {
filename: 'jasmine.latest.js',
path: path.resolve(__dirname, 'build')
}
};
module.exports = config; |
I'm going to close this in favor of #491, which I believe it's a duplicate of. Thanks again for the repro. |
Our project has a tests.html webpage which loads jasmine.js, jasmine-html.js, boot.js and our test suite. When a test fails, I get a stack trace with columns, line numbers and filenames. This is fine except that the line numbers are shifted: there is a difference between the line number as reported by Jasmine and the correct line number in the file.
My project uses webpack and cheap-eval-source-map.
Expected Behavior
Jasmine should report:
Current Behavior
Jasmine instead reports:
Note that line number (112) is not the same as expected one (106).
Your Environment
The text was updated successfully, but these errors were encountered: