Closed ghost closed 2 years ago
Became aware of it when running yarn tsc
and saw all the related errors
tried to add them manually
package.json
{
"name": "HelloWord",
"version": "1.0.0",
"scripts": {
"dev": "blitz dev",
"build": "blitz build",
"start": "blitz start",
"studio": "blitz prisma studio",
"lint": "eslint --ignore-path .gitignore --ext .js,.ts,.tsx .",
"test": "jest",
"test:watch": "jest --watch",
"prepare": "husky install"
},
"prisma": {
"schema": "db/schema.prisma"
},
"prettier": {
"semi": false,
"printWidth": 100
},
"lint-staged": {
"*.{js,ts,tsx}": [
"eslint --fix"
]
},
"dependencies": {
"@prisma/client": "3.4.1",
"blitz": "0.42.4",
"final-form": "4.20.4",
"react": "18.0.0-alpha-5ca4b0433-20211020",
"react-dom": "18.0.0-alpha-5ca4b0433-20211020",
"react-final-form": "6.5.7",
"zod": "3.11.6"
},
"devDependencies": {
"@testing-library/jest-dom": "5.15.0",
"@testing-library/react": "12.1.2",
"@testing-library/react-hooks": "7.0.2",
"@types/preview-email": "2.0.1",
"@types/react": "17.0.34",
"cypress": "8.7.0",
"eslint": "7.32.0",
"husky": "7.0.4",
"jest": "27.3.1",
"lint-staged": "11.2.6",
"prettier": "2.4.1",
"prettier-plugin-prisma": "3.4.1",
"pretty-quick": "3.1.1",
"preview-email": "3.0.5",
"prisma": "3.4.1",
"typescript": "~4.4"
},
"private": true
}
tsconfig.json
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"baseUrl": "./",
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"strictNullChecks": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"noUncheckedIndexedAccess": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"tsBuildInfoFile": ".tsbuildinfo",
"types": ["cypress", "jest", "@testing-library/jest-dom"]
},
"exclude": ["node_modules", "**/*.e2e.ts"],
"include": ["blitz-env.d.ts", "**/*.ts", "**/*.tsx"]
}
test/setup.ts
// This is the jest 'setupFilesAfterEnv' setup file
// It's a good place to set globals, add global before/after hooks, etc
import "@testing-library/jest-dom/extend-expect"
export {} // so TS doesn't complain
but typescript is still not detecting the extend-expect
? 🤷♂️
Extending the previous comment 👆
The jest packages are lacking but found that there was an issue with the way I installed cypress.
test/setup.js
// This is the jest 'setupFilesAfterEnv' setup file
// It's a good place to set globals, add global before/after hooks, etc
import "@testing-library/jest-dom/extend-expect"
export {} // so TS doesn't complain
(not sure if the blitz
preset in the jest.config.ts
should take care of it or this boilerplate file needs to be updated to this?)
tsconfig.json
{
"compilerOptions": {
...
"types": ["jest", "@testing-library/jest-dom"]
},
"exclude": ["node_modules", "**/*.e2e.ts", "**/*.spec.ts"],
"include": ["blitz-env.d.ts", "**/*.ts", "**/*.tsx"]
}
(notice the addition of `"/*.spec.ts"** and that
"cypress"` is not part of the types)
cypress/tsconfig.json
{
"compilerOptions": {
"types": ["cypress"]
},
"include": ["**/*.e2e.ts", "**/*.spec.ts"]
}
(would like to "extends": "../tsconfig.json"
but it's giving me some error about No inputs were found in config file
)
Regarding the test packages blitz
dependency already has jest
, and @testing-library/*
. Can you paste errors you saw?
I have tried see if I can reproduce it by starting a new and repeating the steps and reverting the jest installs on my existing. I just can't reproduce the issue. 🤔
I apologise for any inconvenience it might have caused you.
There's no inconvenience! I'm glad the issue is solved. Feel free to reopen this issue or open a new one if you face any more problems :)
What is the problem?
Blitz does not come with testing packages like described https://blitzjs.com/docs/testing
Paste all your error logs here:
Paste all relevant code snippets here:
What are detailed steps to reproduce this?
Run
blitz -v
and paste the output here:Please include below any other applicable logs and screenshots that show your problem:
No response