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

Passed --grep option persists across test runs #2819

Open
segrey opened this issue Aug 23, 2017 · 1 comment
Open

Passed --grep option persists across test runs #2819

segrey opened this issue Aug 23, 2017 · 1 comment

Comments

@segrey
Copy link
Contributor

segrey commented Aug 23, 2017

Let's consider the following project

// package.json
{
  "devDependencies": {
    "karma": "^1.7.0",
    "karma-jasmine": "^1.1.0",
    "karma-phantomjs-launcher": "^1.0.4",
    "jasmine-core": "^2.7.0"
  }
}
// karma.conf.js
module.exports = function(config) {
  config.set({
    frameworks: ['jasmine'],
    files: ['test.js'],
    reporters: ['progress'],
    port: 9876,
    browsers: ['PhantomJS'],
    singleRun: false
  })
};
// test.js
describe("suite1", function () {
  it("test1", function () {
  });
});

describe("suite2", function () {
  it("test2", function () {
  });
});
  1. Start karma server
./node_modules/karma/bin/karma start
  1. Run all karma tests in another terminal tab:
./node_modules/karma/bin/karma run
PhantomJS 2.1.1 (Linux 0.0.0): Executed 2 of 2 SUCCESS (0.039 secs / 0.001 secs)

Expected result

  1. Run only suite1:
./node_modules/karma/bin/karma run -- '--grep=suite1'
PhantomJS 2.1.1 (Linux 0.0.0): Executed 1 of 2 (skipped 1) SUCCESS (0.038 secs / 0 secs)

Expected result

  1. Run all karma tests again:
./node_modules/karma/bin/karma run
PhantomJS 2.1.1 (Linux 0.0.0): Executed 1 of 2 (skipped 1) SUCCESS (0.038 secs / 0.001 secs)

Unexpected result: only suite1 is run again.

Originally reported in karma-jasmine karma-runner/karma-jasmine#186 and in karma-mocha karma-runner/karma-mocha#196.

As pointed out by @maksimr, it's actually caused by modifying shared config.client.args in https://github.com/karma-runner/karma/blob/master/lib/middleware/runner.js#L51-L60

@rochapablo
Copy link

any update?

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

No branches or pull requests

3 participants