-
Notifications
You must be signed in to change notification settings - Fork 1.1k
actImplementation is not a function #1064
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
Comments
It doesn't look like this bug report has enough info for one of us to reproduce it. Please provide a CodeSandbox (https://react.new), or a link to a repository on GitHub. Here are some tips for providing a minimal example: https://stackoverflow.com/help/mcve |
I can not get codesandbox to run my testsuite - https://codesandbox.io/s/frosty-diffie-5fb0z3?file=/src/App.spec.jsx |
Here is the repo https://github.com/michalstrzelecki/rtl13. |
@michalstrzelecki How do I use the repro? $ npm ci
$ npm test
> [email protected] test /home/eps1lon/Development/throwaway/rtl13
> jest --config=jest.config.ts
Error: Jest: Failed to parse the TypeScript config file /home/eps1lon/Development/throwaway/rtl13/jest.config.ts
Error: > Couldn't find a `pages` directory. Please create one under the project root
at readConfigFileAndSetRootDir (/home/eps1lon/Development/throwaway/rtl13/node_modules/jest-config/build/readConfigFileAndSetRootDir.js:136:13)
at async readConfig (/home/eps1lon/Development/throwaway/rtl13/node_modules/jest-config/build/index.js:208:18)
at async readConfigs (/home/eps1lon/Development/throwaway/rtl13/node_modules/jest-config/build/index.js:404:26)
at async runCLI (/home/eps1lon/Development/throwaway/rtl13/node_modules/@jest/core/build/cli/index.js:140:59)
at async Object.run (/home/eps1lon/Development/throwaway/rtl13/node_modules/jest-cli/build/cli/index.js:155:37)
npm ERR! Test failed. See above for more details. |
@eps1lon I was able to reproduce it by just adding a folder named It looks quite similar to another issue we had with swc. From a first look, it seems like when we run the import from |
@eps1lon I have just add |
I am facing the same issue, using react-18 and following the provided example in the documentation.
|
The issue was caused by diff --git a/jest.config.ts b/jest.config.ts
index 0c0e703..cd1004b 100644
--- a/jest.config.ts
+++ b/jest.config.ts
@@ -6,7 +6,7 @@ const createJestConfig = nextJest({ dir: "./" })
const config: Config.InitialOptions = {
moduleDirectories: ["node_modules"],
moduleNameMapper: {
- "test-utils": "<rootDir>/src/testUtils/test-utils.tsx",
+ "^test-utils$": "<rootDir>/src/testUtils/test-utils.tsx",
},
setupFilesAfterEnv: ["./jest.setup.ts"],
testEnvironment: "jsdom", |
Good catch @eps1lon, I totally forgot to check the jest config :) |
@eps1lon thanks a lot! :) |
Hi @michalstrzelecki, I am getting the same issue in my test file. I tried to see how you setup your jest config file. Can you share the configuration. This issue is kind of blocker for me to proceed. |
const config: Config.InitialOptions = {
// bail: true, // stop run test after one error
// collectCoverage: true, // show test statistics
errorOnDeprecated: true,
coverageDirectory: "coverage",
moduleDirectories: ["node_modules"],
moduleNameMapper: {
"^@/(.*)$": "<rootDir>/src/$1",
"^test-utils$": "<rootDir>/src/testUtils/test-utils.tsx",
},
setupFiles: ["./jest.setup.tsx"],
setupFilesAfterEnv: ["./jest.setupAfterEnv.ts"],
testEnvironment: "jest-environment-jsdom",
verbose: true,
roots: ["./src"],
} |
Thanks @michalstrzelecki. |
@testing-library/react
version: 13.2.0Relevant code or config:
What you did:
I have upgraded project to react 18, jest to 28, and rtl to 13.2.
What happened:
Reproduction:
Problem description:
Every test fails.
Suggested solution:
Please, provide the way to add actImplementation function.
The text was updated successfully, but these errors were encountered: