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

Regenerator Runtime not sourced from RootDir #7391

Closed
OllieJennings opened this issue Nov 20, 2018 · 6 comments
Closed

Regenerator Runtime not sourced from RootDir #7391

OllieJennings opened this issue Nov 20, 2018 · 6 comments

Comments

@OllieJennings
Copy link

OllieJennings commented Nov 20, 2018

🐛 Bug Report

The regenerator-runtime setupFile does not source from the same location as <rootDir>

For example my config looks like:

setupFiles: [
    '<rootDir>/node_modules/core-js/fn/object/values',
    '<rootDir>/node_modules/core-js/modules/es7.string.pad-start',
    '<rootDir>/jestSetup'
  ],

But when l run Jest with the debug option, l get the following setupFiles output:

"setupFiles": [
        "C:\\Developer\\ion\\ion-ux-components\\node_modules\\regenerator-runtime\\runtime.js",
        "H:\\ion\\ion-ux-components\\node_modules\\core-js\\fn\\object\\values.js",
        "H:\\ion\\ion-ux-components\\node_modules\\core-js\\modules\\es7.string.pad-start.js",
        "H:\\ion\\ion-ux-components\\jestSetup.js"
      ],

C:\\Developer is a symlink to our network H drive

Now this issue doesn't cause tests to fail, but does cause code coverage to include everything twice, since it sources from C:\Developer and then from H:\, so every file appears twice, and those sourced from H:\ all have a 0 test coverage score.

To Reproduce

This is very difficult unless you have a network drive with a symlink for C:\Developer to point to the root of your network drive.

jest.config.js file is provided below:

module.exports = {
  verbose: true,
  bail: true,
  setupFiles: [
    '<rootDir>/node_modules/core-js/fn/object/values',
    '<rootDir>/node_modules/core-js/modules/es7.string.pad-start',
    '<rootDir>/jestSetup'
  ],
  // collectCoverage: true,
  coverageDirectory: '.jest',
  coveragePathIgnorePatterns: [
    '/node_modules/',
    '/dist/',
    'jestSetup.js',
    'src/const.js',
    'src/index.js'
  ],
  collectCoverageFrom: ['<rootDir>/src/**/*.js'],
  moduleNameMapper: {
    '\\.(css|less|sass|scss)$': '<rootDir>/__mocks__/styleMock.js'
    // "\\.(gif|ttf|eot|svg)$": "<rootDir>/__mocks__/fileMock.js"
  }
};

And when running in --debug mode the value of my rootDir is: "rootDir": "H:\\ion\\ion-ux-components"

Expected behavior

I expect all setupFiles to be sourced from the exact same location.

Link to repl or repo (highly encouraged)

Not really possible since network drive issue

Run npx envinfo --preset jest

Paste the results here:

  System:
    OS: Windows 7
    CPU: (4) x64 Intel(R) Xeon(R) CPU E5-2697 v4 @ 2.30GHz
  Binaries:
    Node: 8.11.2 - H:\nodejs\8\node.EXE
    npm: 5.6.0 - H:\nodejs\8\npm.CMD
@rickhanlonii
Copy link
Member

Hey @OllieJennings, thanks for the detailed report!

Yeah I think we should fix this - but as you said, it's hard to reproduce. Any chance I could talk you into putting in a PR to fix?

@OllieJennings
Copy link
Author

@rickhanlonii Just checked with work, and they have given me the all clear to make a PR for this, so will get on it.

@rickhanlonii
Copy link
Member

Great to hear, let me know if you have any trouble setting up the env 👍

@rickhanlonii
Copy link
Member

Just bumping this @OllieJennings in case you have some spare time 👌

@SimenB
Copy link
Member

SimenB commented Feb 9, 2020

We removed the auto-injection of regenerator runtime in jest 24 (#7595), so I don't think this is an issue anymore

@SimenB SimenB closed this as completed Feb 9, 2020
@github-actions
Copy link

This issue 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 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants