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

Add testPath to suite in jest-jasmine2 reporter callbacks #5394

Merged
merged 3 commits into from
Feb 9, 2018
Merged

Add testPath to suite in jest-jasmine2 reporter callbacks #5394

merged 3 commits into from
Feb 9, 2018

Conversation

Vanuan
Copy link
Contributor

@Vanuan Vanuan commented Jan 25, 2018

Summary

Add testPath to jest-jasmine2 reporter callbacks.

Before:

{
      id: 'suite0',
      description: 'tests',
      fullName: '',
      failedExpectations: [],
}

After

      id: 'suite0',
      description: 'tests',
      fullName: '',
      failedExpectations: [],
      testPath: '/src/__tests__/foo.test.js' 

Test plan
See #4594

@Vanuan Vanuan changed the title Add testPath to suite Add testPath to suite in jest-jasmine2 reporter callbacks Jan 25, 2018
@codecov-io
Copy link

Codecov Report

Merging #5394 into master will decrease coverage by 0.01%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5394      +/-   ##
==========================================
- Coverage   61.32%   61.31%   -0.02%     
==========================================
  Files         205      205              
  Lines        6925     6927       +2     
  Branches        3        3              
==========================================
  Hits         4247     4247              
- Misses       2677     2679       +2     
  Partials        1        1
Impacted Files Coverage Δ
packages/jest-jasmine2/src/jasmine/Suite.js 0% <ø> (ø) ⬆️
packages/jest-jasmine2/src/jasmine/Env.js 0% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c243f67...58e1806. Read the comment docs.

@SimenB
Copy link
Member

SimenB commented Jan 25, 2018

Mind adding a test so we don't break it when removing jasmine?

@cpojer
Copy link
Member

cpojer commented Feb 7, 2018

Ping @Vanuan Mind adding a test?

@Vanuan
Copy link
Contributor Author

Vanuan commented Feb 7, 2018

Current tests already cover this code. Similar PR from @palmerj3 didn't have any additional tests so I don't know how to do it.

Are you saying jasmine would be removed? I'd like to use it like this:

const jasmineReporters = require('jasmine-reporters');

jasmine.getEnv().addReporter(
        new jasmineReporters.JUnitXmlReporter({
                // Jest runs many instances of Jasmine in parallel.
                // Force distinct file output
                // per test to avoid collisions.
                modifyReportFileName: function(name, suite) {
                  return `${suite.testPath.replace("/", "_")}-${name}`;
                }
...

Maybe there's a simpler way to safely write JUnit report files?

@SimenB
Copy link
Member

SimenB commented Feb 9, 2018

We have a future goal (on the backburner for now) of removing jasmine, replacing it with jest-circus.

For JUnit xml in particular, you can use https://www.npmjs.com/package/jest-junit. Might be that this PR in particular is related to their one open issue, though: https://github.com/palmerj3/jest-junit/issues/39 🙂

Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seeing as the other PR was merged without tests, we can probably merge this as well

@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants