-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: #93 テストが実行できるようにするためJestの設定をMergeする
- Loading branch information
Showing
3 changed files
with
60 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,51 @@ | ||
module.exports = { | ||
roots: ["<rootDir>/src"], | ||
testMatch: [ | ||
"**/__tests__/**/*.+(ts|tsx|js)", | ||
"**/?(*.)+(spec|test).+(ts|tsx|js)", | ||
"roots": [ | ||
"<rootDir>/src" | ||
], | ||
transform: { | ||
"^.+\\.(ts|tsx)$": "ts-jest", | ||
"testMatch": [ | ||
"<rootDir>/src/**/__tests__/**/*.{js,jsx,ts,tsx}", | ||
"<rootDir>/src/**/*.{spec,test}.{js,jsx,ts,tsx}" | ||
], | ||
"transform": { | ||
"^.+\\.(js|jsx|mjs|cjs|ts|tsx)$": "<rootDir>/config/jest/babelTransform.js", | ||
"^.+\\.css$": "<rootDir>/config/jest/cssTransform.js", | ||
"^(?!.*\\.(js|jsx|mjs|cjs|ts|tsx|css|json)$)": "<rootDir>/config/jest/fileTransform.js" | ||
}, | ||
"collectCoverageFrom": [ | ||
"src/**/*.{js,jsx,ts,tsx}", | ||
"!src/**/*.d.ts" | ||
], | ||
"setupFiles": [ | ||
"react-app-polyfill/jsdom" | ||
], | ||
"setupFilesAfterEnv": [ | ||
"<rootDir>/src/setupTests.ts" | ||
], | ||
"testEnvironment": "jsdom", | ||
"transformIgnorePatterns": [ | ||
"[/\\\\]node_modules[/\\\\].+\\.(js|jsx|mjs|cjs|ts|tsx)$", | ||
"^.+\\.module\\.(css|sass|scss)$" | ||
], | ||
"modulePaths": [], | ||
"moduleNameMapper": { | ||
"^react-native$": "react-native-web", | ||
"^.+\\.module\\.(css|sass|scss)$": "identity-obj-proxy" | ||
}, | ||
}; | ||
"moduleFileExtensions": [ | ||
"web.js", | ||
"js", | ||
"web.ts", | ||
"ts", | ||
"web.tsx", | ||
"tsx", | ||
"json", | ||
"web.jsx", | ||
"jsx", | ||
"node" | ||
], | ||
"watchPlugins": [ | ||
"jest-watch-typeahead/filename", | ||
"jest-watch-typeahead/testname" | ||
], | ||
"resetMocks": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const fs = require('fs'); | ||
const packageJson = require('./package.json'); | ||
const jestConfig = require('./jest.config.js'); | ||
|
||
// package.jsonからJest設定を取得 | ||
const packageJestConfig = packageJson.jest; | ||
|
||
// 両方の設定をマージ | ||
const mergedConfig = { ...jestConfig, ...packageJestConfig }; | ||
|
||
// マージした設定をjest.config.jsに書き込む | ||
fs.writeFileSync('./jest.config.js', `module.exports = ${JSON.stringify(mergedConfig, null, 2)}`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters