-
Notifications
You must be signed in to change notification settings - Fork 45
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
regeneratorRuntime is not defined #1289
Comments
Hmm, nothing was changed that could have affected your scenario. As you have mentioned in the comment, What could be happening is that for some reason Jest and Wallaby may be applying different babel options during compilation (perhaps you are using babel environments), so that Jest outputs JS code without Could you please share the following files:
and I'll try to reproduce the issue. |
I've tried to reproduce the issue without success.
{
"private": true,
"version": "1.0.0",
"main": "build/index.js",
"license": "MIT",
"bin": {
"sane": "./build/cli/cli.js"
},
"scripts": {
"clean": "del ./build/*",
"lint": "eslint --ext .js .",
"lint:fix": "eslint --fix --ext .js .",
"build": "npm run clean && NODE_ENV=production babel src -d build --ignore test.js --source-maps && flow-copy-source src build",
"dev": "npm run clean && NODE_ENV=production babel -w src/ -d build/ --ignore test.js --source-maps",
"format": "find . -name \"*.js\" | grep -v -f .prettierignore | xargs prettier --tab-width 4 --single-quote --trailing-comma all --write",
"precommit": "lint-staged"
},
"lint-staged": {
"gitDir": "../../",
"linters": {
"./*.js": [
"prettier --tab-width 4 --single-quote --trailing-comma es5 --write",
"git add"
],
"src/**/*.js": [
"prettier --tab-width 4 --single-quote --trailing-comma all --write",
"git add"
]
}
},
"devDependencies": {
"babel-cli": "6.26.0",
"babel-core": "6.26.0",
"babel-eslint": "7.2.3",
"babel-plugin-dynamic-import-node": "1.0.2",
"babel-plugin-transform-object-rest-spread": "6.26.0",
"babel-polyfill": "6.26.0",
"babel-preset-env": "1.6.0",
"babel-preset-flow": "6.23.0",
"del-cli": "1.1.0",
"eslint": "4.6.1",
"eslint-config-prettier": "2.4.0",
"eslint-plugin-jest": "20.0.3",
"flow-bin": "0.54.0",
"flow-copy-source": "1.2.1",
"husky": "0.14.3",
"jest": "20.0.4",
"lint-staged": "4.1.0",
"prettier": "1.6.1"
},
"dependencies": {
"babel-polyfill": "6.26.0",
"chalk": "2.1.0",
"del": "3.0.0",
"dotenv": "4.0.0",
"fs-extra": "4.0.1",
"joi": "10.6.0",
"lodash": "4.17.4",
"sort-keys": "2.0.0",
"source-map-support": "0.4.16"
}
}
{
"presets": ["./.babelrc.js"]
}
'use strict';
const babel = {
presets: [
[
'env',
{
targets: {
node: '4.0.0',
},
useBuiltIns: true,
},
],
'flow',
],
plugins: ['dynamic-import-node', 'transform-object-rest-spread'],
};
module.exports = babel;
/* eslint strict:off, global-require:off */
'use strict';
/**
* https://facebook.github.io/jest/docs/configuration.html#options
*/
module.exports = {
rootDir: 'src',
moduleDirectories: ['node_modules', 'src'],
testEnvironment: 'node',
collectCoverage: false,
coveragePathIgnorePatterns: ['/__sandbox__/'],
/**
* Automatically reset mock state between every test.
* Equivalent to calling jest.resetAllMocks() between each test.
*
* Sane default with resetModules: true because mocks need to be inside beforeEach
* for them to work correctly
*/
resetMocks: true,
/**
* The module registry for every test file will be reset before running each individual test.
* This is useful to isolate modules for every test so that local module state doesn't conflict between tests.
*/
resetModules: true,
};
it('example', async () => {}); |
Example Repo: https://github.com/chrisblossom/wallaby-issue-1289 I included the |
Thanks for the repo! Wallaby doesn't use module.exports = wallaby => {
return {
...
setup: w => {
...
+ jestConfig.setupFiles = [require.resolve('regenerator-runtime/runtime')]
w.testFramework.configure(jestConfig);
},
};
}; Please note that because your current babel config emits |
Any thoughts on why this just worked before? I think if |
Could be a few different reasons:
Whether or not Will investigate the option of automagically determining whether it is required or not, however |
I just found out why I had such a difficult time tracking this issue down and reproducing it. First thing I did was try to update Might be a good idea to clear Wallaby's cache when That is true about FYI, list of current polyfills for node 6.11:
Thank you for the help! |
Good idea, just added the feature in the latest core version.
Fair enough. For now we have added jestConfig.setupFiles = [require.resolve('regenerator-runtime/runtime')] will not be required anymore. |
Issue description or question
Did something change with Wallaby? I am now getting
regeneratorRuntime is not defined
without additional config required. Running jest from command line works as expected.Wallaby.js configuration file
Code editor or IDE name and version
OS name and version
Mac OS X 10.12.6
The text was updated successfully, but these errors were encountered: