Skip to content
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

Incorrect column in stack trace with original file #3324

Closed
segrey opened this issue Jun 5, 2019 · 1 comment · Fixed by #3325 or karronoli/redpen#10 · May be fixed by Omrisnyk/npm-lockfiles#201
Closed

Incorrect column in stack trace with original file #3324

segrey opened this issue Jun 5, 2019 · 1 comment · Fixed by #3325 or karronoli/redpen#10 · May be fixed by Omrisnyk/npm-lockfiles#201

Comments

@segrey
Copy link
Contributor

segrey commented Jun 5, 2019

Expected behaviour

Stack trace contains locations with 1-based line and 1-based column.

Actual behaviour

Stack trace contains locations with 1-based line and 0-based column.

Environment Details

  • Karma version (output of karma --version): 4.1.0
  • Relevant part of your karma.config.js file: see the project

Steps to reproduce the behaviour

  1. Clone https://github.com/segrey/karma-webpack-example
  2. Run tests with npm test
  3. Observe line
 at UserContext.<anonymous> (webpack:///test/specs/utils.spec.js:3:4 <- index.js:72:5)

The location in the original file (utils.spec.js:3:4) points to the correct 1-based line, but has wrong 1-based column (in fact it's 0-based column). Since lines and columns in stack traces are expected to be both 1-based, it should be utils.spec.js:3:5.

Please note that the location in the transpiled file (index.js:72:5) has correct 1-based column.

@segrey
Copy link
Contributor Author

segrey commented Jun 5, 2019

johnjbarton pushed a commit that referenced this issue Jun 17, 2019
Columns in original stack are 1-based, but
SourceMapConsumer.prototype.originalPositionFor(generatedPosition)
accepts 0-based column and returns 0-based column too.
This change converts columns from 1-based to 0-based forth and back.

Closes #3324
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant