Skip to content
This repository has been archived by the owner on Feb 19, 2021. It is now read-only.

Basic runner implementation #2

Closed
wants to merge 3 commits into from

Conversation

jankuca
Copy link

@jankuca jankuca commented Dec 28, 2016

I implemented a very naive runner which executes npm test -- file file file. Jest does not provide a simple programmatic API with which we can work and this works fine.

All the projects using this runner must do is to have a test script in package.json which runs jest.

The runner runs `npm test -- file file file ...` and collects the test count from the jest output.
The test count is defaulted to the number of test files.
@simondel
Copy link
Member

Thanks for this PR! We'll take a look at it.

As of right now, we have a couple of questions:

  • Why did you remove files such as the .bithoundrc and .travis.yml?
  • Is this a work in progress or is this done?
  • How well does this perform? Spawning a new process for every mutant can be quite slow when you have a couple thousand mutants.

@nicojs
Copy link
Member

nicojs commented Dec 29, 2016

I see what you did there @jankuca . Its a neat idea. Could you also do this by calling the jest CLI directly? Instead of relying on npm test? Seems pretty straight forward.

As @simondel mentioned, this way of working has as disadvantage that it is slow (spawning a new process per call). I would not like to support it myself, i would rather try to get the Jest maintainers to create a public API for us to use, or we use there private API (if it is somewhat stable).

However, until then, would you agree to create a fork and release it under a different name (for example: stryker-jest-cli-runner)? That way, people can already start using stryker with jest. We can than also add it to the official documentation and refer to your repo for the details.

@nicojs
Copy link
Member

nicojs commented Feb 10, 2017

@jankuca we just released a version of a basic jest test runner. Can you test to see if it works for you?

@jankuca
Copy link
Author

jankuca commented Feb 11, 2017

That's great! But it does not seem to work for me, no idea why.

Mutants are created but none fail. My npm test script is simply jest which runs tests and fails when I manually apply a mutant myself.

69 total mutants.
69 mutants survived.
  of which 69 were not covered by the tests.
0 mutants timed out.
0 mutants killed.
Ran 0.00 tests per mutant on average.
Mutation score based on covered code: n/a
Mutation score based on all code: 0.00%

My stryker.conf.js file:

module.exports = function (config) {
  config.set({
    files: [
      { pattern: 'src/**/!(*.spec).js', included: false, mutated: true },
      { pattern: 'src/**/*.spec.js', included: true, mutated: false },
    ],
    testRunner: 'jest-test-runner',
    coverageAnalysis: 'off',
    reporter: [ 'clear-text', 'progress' ],
  });
}

@mthmulders
Copy link
Collaborator

@jankuca Could you please open a separate issue for that? Seems worth investigating. Also, could you please include trace logging?

@nicojs
Copy link
Member

nicojs commented Feb 13, 2017

@mthmulders @jankuca i've created #11 for this purpose

@mthmulders mthmulders closed this Mar 2, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants