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

feat(jest): report test files and test positions #2808

Merged
merged 30 commits into from
Mar 26, 2021

Conversation

nicojs
Copy link
Member

@nicojs nicojs commented Mar 16, 2021

Report the test file names and test positions from the jest-runner plugin back to the main process. They will end up in your JSON report in line with the latest mutation-testing-report-schema changes: stryker-mutator/mutation-testing-elements#786

For example:

  "testFiles": {
    "src/sum.test.js": {
      "tests": [
        {
          "id": "0",
          "name": "adds 1 + 2 to equal 3",
          "location": {
            "start": {
              "column": 2,
              "line": 3
            }
          }
        },
        {
          "id": "1",
          "name": "sub 1 - 0 to equal 1",
          "location": {
            "start": {
              "column": 2,
              "line": 6
            }
          }
        }
      ],
      "source": "const {sum, sub} = require('./sum');\n\ntest('adds 1 + 2 to equal 3', () => {\n  expect(sum(1, 2)).toBe(3);\n});\ntest('sub 1 - 0 to equal 1', () => {\n  expect(sub(1, 0)).toBe(1);\n});\n"
    }
  },

@simondel
Copy link
Member

@nicojs Could you explain why you want this change?

@nicojs
Copy link
Member Author

nicojs commented Mar 26, 2021

Sure.

Each test runner can now optionally also report the file names and test locations. If they are provided, then Stryker will also report them to the mutation testing report JSON. We're adding support to display that information with stryker-mutator/mutation-testing-elements#865

@nicojs nicojs changed the title Feat/jest report files and position feat(jest): report test files and test positions Mar 26, 2021
@nicojs nicojs enabled auto-merge (squash) March 26, 2021 22:00
@nicojs nicojs merged commit c19095e into epic/v5 Mar 26, 2021
@nicojs nicojs deleted the feat/jest-report-files-and-position branch March 26, 2021 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants