integration tests
の場合は
、もう1つの場合はunit tests
の2つの異なるテスト環境を実行します。私はこれらの正規表現が出ているnestスクリプトのjest regex
__tests__/ut/p/a/t/h/file.test.ts
__tests__/it/p/a/t/h/file.test.ts
:
(__tests__/it/.*\.test)\.(tsx?|ts?)$
マイスクリプト
(__tests__/ut/.*\.test)\.(tsx?|ts?)$
は次のようになります。
"test:ut": "jest \"(__tests__/ut/.*\\.test)\\.(tsx?|ts?)$\"",
"test:it": "jest \"(__tests__/it/.*\\.test)\\.(tsx?|ts?)$\"",
フォルダ構造は次のようなものです
しかし、私はyarn test:ut
を実行したときに私が手:
yarn run v1.3.2
$ jest "(__tests__/ut/.*\.test)\.(tsx?|ts?)$"
No tests found
In /home/dev/sample
20 files checked.
testMatch: **/__tests__/**/*.js?(x),**/?(*.)(spec|test).js?(x) - 0 matches
testPathIgnorePatterns: /node_modules/ - 20 matches
Pattern: (__tests__/ut/.*\.test)\.(tsx?|ts?)$ - 0 matches
Done in 0.49s.
もののを、私はそれが動作JSON構成ファイルで同じパターンを使用している場合。
私はjest
を実行する方法で何かを推測します。
どうすれば修正できますか?これを実行
EDIT
:no tests found
と
"test:ut": "jest -c jest.json \"(__tests__\\/ut\\/.*\\.test)\\.(tsx?|ts?)$\"",
結果。
しかし、私は、構成ファイル内の正規表現を置けば、それは作業を行います。
{
"testRegex": "(__tests__\\/ut\\/.*\\.test)\\.(tsx?|ts?)$",
"transform": {
"^.+\\.tsx?$": "<rootDir>/node_modules/ts-jest/preprocessor.js"
},
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"json",
"jsx"
]
}
がnpm script
として私は、configファイルからtestRegex
をコメントアウトし、それを実行します。
「testMatch」が「.js」または「.jsx」ファイルにマッチするのはなぜですか?正規表現はTypeScriptと一致していますか?正規表現が最初のtestMatchが収集しているものと一致している場合は、コレクション内の一致するtsファイルはありません。ちょうど推測。 – rgthree
"/ home/dev/sample/__ tests __/..."での2番目のコメントです。testPathIgnorePatternsの "20 files"と "20 matches"を出力すると、何か他のものが間違っている可能性があります(ただし、再度推測すると、無視される20のディレクトリの一致は、チェックされた20のファイルとは別です)。 – rgthree
なぜ私は 'js'ファイルを探しているのか分かりません...私は質問に何かを加えました – itaied