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

Create a separate tsconfig file to specify jsx mode for ts-jest vs next.js #9

Merged
merged 1 commit into from
Jun 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion app/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,10 @@ module.exports = {
testPathIgnorePatterns: [
"<rootDir>/node_modules/",
],
testRegex: "(/test/.*(test|spec))\\.[jt]sx?$"
testRegex: "(/test/.*(test|spec))\\.[jt]sx?$",
globals: {
'ts-jest': {
tsconfig: 'tsconfig.ts-jest.json'
}
}
};
23 changes: 18 additions & 5 deletions app/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@pages/*": ["pages/*"]
"@pages/*": [
"pages/*"
]
},
"target": "es6",
"lib": ["dom", "dom.iterable", "esnext"],
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"checkJs": true,
"skipLibCheck": true,
Expand All @@ -17,9 +23,16 @@
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "react-jsx",
"jsx": "preserve",
"incremental": true
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "__mocks__/styleMock.js"],
"exclude": ["node_modules"]
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
"__mocks__/styleMock.js"
],
"exclude": [
"node_modules"
]
}
6 changes: 6 additions & 0 deletions app/tsconfig.ts-jest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"jsx": "react-jsx"
}
}