-
Notifications
You must be signed in to change notification settings - Fork 288
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
Cannot read property 'watch' of undefined #195
Comments
hi,@binhxn Could you provide a demo for us to check? |
Hi @xiaoyuhen, Here's my original (related) dependencies:
jest configs:
I've been trying to upgrade my Jest dependencies to the latest version, but I keep going down this rabbit hole of upgrading every single babel package (starting with
If I can't get any further, I may try just setting up a custom setup/teardown config without |
Thank you very much for your information. I will try to use CRA v1 to investigate this issue, it may take one day or two. |
Also running into the Full error: TypeError: Cannot read property 'watch' of undefined
at setup (/Users/petepetrash/code/enrollment_portal/enrollment_portal/client_app/node_modules/jest-environment-puppeteer/lib/global.js:30:18)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7) Test example: it('can complete the form', async () => {
const browser = await puppeteer.launch({
headless: false
})
const page = await browser.newPage()
await page.goto(FORM_URL)
await page.waitForSelector('form')
await page.type('input[name=firstName]', applicant.firstName)
})
Related dependencies: "babel-jest": "^22.1.0",
"babel-loader": "^7.1.2",
"babel-preset-react-app": "^3.1.1",
"jest": "22.4.2",
"jest-puppeteer": "^3.9.0",
"puppeteer": "^1.11.0",
"react": "^16.4.2",
"react-dom": "^16.4.2",
"ts-jest": "22.0.1",
"webpack": "3.8.1",
"webpack-dev-server": "2.9.4" Jest config: "jest": {
"preset": "jest-puppeteer",
"collectCoverageFrom": [
"src/**/*.{js,jsx,ts,tsx}"
],
"setupFiles": [
"<rootDir>/config/polyfills.js"
],
"testMatch": [
"<rootDir>/src/**/__tests__/**/*.(j|t)s?(x)",
"<rootDir>/src/**/?(*.)(spec|test).(j|t)s?(x)"
],
"testEnvironment": "node",
"testURL": "http://localhost",
"transform": {
"^.+\\.(js|jsx|mjs)$": "<rootDir>/node_modules/babel-jest",
"^.+\\.tsx?$": "<rootDir>/config/jest/typescriptTransform.js",
"^.+\\.css$": "<rootDir>/config/jest/cssTransform.js",
"^(?!.*\\.(js|jsx|mjs|css|json)$)": "<rootDir>/config/jest/fileTransform.js"
},
"transformIgnorePatterns": [
"[/\\\\]node_modules[/\\\\].+\\.(js|jsx|mjs|ts|tsx)$"
],
"moduleNameMapper": {
"^react-native$": "react-native-web"
},
"moduleFileExtensions": [
"web.ts",
"ts",
"web.tsx",
"tsx",
"web.js",
"js",
"web.jsx",
"jsx",
"json",
"node",
"mjs"
],
"globals": {
"ts-jest": {
"tsConfigFile": "tsconfig.test.json"
}
}
} |
Using Jest 23.6 works, thank you. |
🐛 Bug Report
On an ejected Create-react-app project, I installed
puppeteer
andjest-puppeteer
and ran a simple script to run jest, but it's immediately returningMy jest config is inside my
package.json
file so I added it in there as mentioned in docs:I ran two jest commands below, but still get the same result above:
"test": "node ./scripts/test.js --env=jsdom"
"test": "jest"
Jest Configuration
"jest": "^22.4.2"
"jest-puppeteer": "^3.9.0"
"puppeteer": "^1.12.0"
Expected behavior
I was hoping the test would run successfully without any internal errors.
Run
npx envinfo --system --binaries --npmPackages expect-puppeteer,jest-dev-server,jest-environment-puppeteer,jest-puppeteer,spawnd --markdown --clipboard
Paste the results here:
The text was updated successfully, but these errors were encountered: