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

Race condition in karma can result in a mutant being tested as a 'runtimeError' #2049

Closed
nicojs opened this issue Feb 16, 2020 · 0 comments · Fixed by #2048
Closed

Race condition in karma can result in a mutant being tested as a 'runtimeError' #2049

nicojs opened this issue Feb 16, 2020 · 0 comments · Fixed by #2048
Labels
🐛 Bug Something isn't working

Comments

@nicojs
Copy link
Member

nicojs commented Feb 16, 2020

Summary

There is a race condition in karma that can result in a mutant being reported as a runtime error. The race condition is explained in karma-runner/karma#3424

I've found the issue in a gh workflow (on linux). I haven't been able to reproduce it on windows. As you can see in the stack trace: clearly the onbeforeunload is triggered from karma code (see karma-runner/karma#3424 for more info)

ERROR: 'Window reload!!', 'Error
2020-02-15T23:56:13.4716280Z     at window.onbeforeunload (http://localhost:9877/base/test/AddSpec.js?cc8af791b57fdffcc1474a86f80f049403495bde:21:40)
2020-02-15T23:56:13.4716758Z     at navigateContextTo (http://localhost:9877/karma.js:135:18)
2020-02-15T23:56:13.4717186Z     at clearContext (http://localhost:9877/karma.js:161:5)
2020-02-15T23:56:13.4717823Z     at http://localhost:9877/karma.js:250:9'

Stryker config

This happens in our e2e test suite sometimes with this karma config:

{
    mutate: ['src/*.js'],
    mutator: 'javascript',
    testFramework: 'mocha',
    testRunner: 'karma',
    reporters: ['clear-text', 'html', 'event-recorder'],
    karma: {
      config: {
        frameworks: ['mocha', 'chai'],
        files: ['src/*.js', 'test/*.js']
      }
    },
    logLevel: 'trace',
    timeoutMS: 60000,
    maxConcurrentTestRunners: 2,
    coverageAnalysis: 'perTest'
  }

Stryker environment

See our e2e tests. Both karma-mocha and karma-jasmine

A possible solution

We can implement the workaround proposed in karma-runner/karma#3424 by forcing client.clearContext to false

@nicojs nicojs added the 🐛 Bug Something isn't working label Feb 16, 2020
nicojs added a commit that referenced this issue Feb 18, 2020
Disable `client.clearContext` for karma e2e tests

Temporary fix for #2049
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant