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

Bad URL in stacktrace if urlRoot specified #2897

Closed
segrey opened this issue Nov 29, 2017 · 3 comments · Fixed by karronoli/redpen#10 · May be fixed by Omrisnyk/npm-lockfiles#122 or Omrisnyk/npm-lockfiles#132
Closed

Bad URL in stacktrace if urlRoot specified #2897

segrey opened this issue Nov 29, 2017 · 3 comments · Fixed by karronoli/redpen#10 · May be fixed by Omrisnyk/npm-lockfiles#122 or Omrisnyk/npm-lockfiles#132

Comments

@segrey
Copy link
Contributor

segrey commented Nov 29, 2017

Expected behaviour

Correct URL is printed in stacktrace

Actual behaviour

Bad URL is printed in stacktrace

Environment Details

// package.json
{
  "devDependencies": {
    "karma": "^1.7.1",
    "karma-chrome-launcher": "^2.2.0",
    "karma-jasmine": "^1.1.0",
    "jasmine-core": "^2.8.0"
  }
}
//karma.conf.js
module.exports = function (config) {
  config.set({
    urlRoot: '/__karma__',
    frameworks: ['jasmine'],
    files: ['tests/**/*.js'],
    reporters: ['progress'],
    colors: true,
    logLevel: config.LOG_INFO,
    autoWatch: true,
    browsers: ['Chrome'],
    singleRun: false
  });
};
// tests/sub/foo.js
describe('foo', function () {
    it('test', function () {
        fail();
    });
});

Steps to reproduce the behaviour

  1. Run tests with ./node_modules/karma/bin/karma start
  2. Output:
9 11 2017 19:49:40.487:WARN [config]: urlRoot normalized to "/__karma__/"
29 11 2017 19:49:40.540:WARN [karma]: No captured browser, open http://localhost:9876/__karma__/
29 11 2017 19:49:40.546:INFO [karma]: Karma v1.7.1 server started at http://0.0.0.0:9876/__karma__/
29 11 2017 19:49:40.546:INFO [launcher]: Launching browser Chrome with unlimited concurrency
29 11 2017 19:49:40.560:INFO [launcher]: Starting browser Chrome
29 11 2017 19:49:40.980:INFO [Chrome 62.0.3202 (Linux 0.0.0)]: Connected on socket 3ny3gbgd6AeYqWRDAAAA with id 79121705
Chrome 62.0.3202 (Linux 0.0.0) foo test FAILED
        Failed
            at UserContext.<anonymous> (http://localhost:9876/__karma__tests/sub/foo.js:3:9)
Chrome 62.0.3202 (Linux 0.0.0): Executed 1 of 1 (1 FAILED) ERROR (0.003 secs / 0.003 secs)

Unexpected output part:

  at UserContext.<anonymous> (http://localhost:9876/__karma__tests/sub/foo.js:3:9)

Expected:

  at UserContext.<anonymous> (tests/sub/foo.js:3:9)
@segrey
Copy link
Contributor Author

segrey commented Nov 29, 2017

The issue came from https://youtrack.jetbrains.com/issue/WEB-29940

@segrey
Copy link
Contributor Author

segrey commented Nov 29, 2017

Looks like urlRoot should be taken into account when composing URL_REGEXP: https://github.com/karma-runner/karma/blob/v1.7.1/lib/reporter.js#L28

outsideris added a commit to outsideris/karma that referenced this issue Dec 3, 2017
Handle urlRoot in paths if rulRoot specified

Closes karma-runner#2897
@outsideris
Copy link
Contributor

I tried to fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants