簡體   English   中英

帶有 Mono Repo 的 react-scripts 的無效 testPattern --config=jest.config.js

[英]Invalid testPattern --config=jest.config.js with react-scripts with Mono Repo

我正在嘗試通過以下方式將自定義 jest.config 設置為 react-scripts:

"test": "react-scripts test -- --config=jest.config.js",

我覺得值得一提的是我有一個 mono 存儲庫。

但是,這產生了以下錯誤:

Invalid testPattern --config=jest.config.js|--watch|--config|{"roots":["<rootDir>/src"],"collectCoverageFrom":["src/**/*.{js,jsx,ts,tsx}","!src/**/*.d.ts"],"setupFiles":["/var/www/tractable/property-estimating/node_modules/react-app-polyfill/jsdom.js"],"setupFilesAfterEnv":["<rootDir>/src/setupTests.ts"],"testMatch":["<rootDir>/src/**/__tests__/**/*.{js,jsx,ts,tsx}","<rootDir>/src/**/*.{spec,test}.{js,jsx,ts,tsx}"],"testEnvironment":"jsdom","testRunner":"/var/www/tractable/property-estimating/node_modules/jest-circus/runner.js","transform":{"^.+\\.(js|jsx|mjs|cjs|ts|tsx)$":"/var/www/tractable/property-estimating/node_modules/react-scripts/config/jest/babelTransform.js","^.+\\.css$":"/var/www/tractable/property-estimating/node_modules/react-scripts/config/jest/cssTransform.js","^(?!.*\\.(js|jsx|mjs|cjs|ts|tsx|css|json)$)":"/var/www/tractable/property-estimating/node_modules/react-scripts/config/jest/fileTransform.js"},"transformIgnorePatterns":["[/\\\\]node_modules[/\\\\].+\\.(js|jsx|mjs|cjs|ts|tsx)$","^.+\\.module\\.(css|sass|scss)$"],"modulePaths":["/var/www/tractable/property-estimating/frontend/claim-handler/src"],"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,"rootDir":"/var/www/tractable/property-estimating/frontend/claim-handler"}|--env|/var/www/tractable/property-estimating/node_modules/jest-config/node_modules/jest-environment-jsdom/build/index.js supplied. Running all tests instead.

版本

"react-scripts": "4.0.3",

您是否嘗試過: "test": "react-scripts test --config=jest.config.js"

這可能有效

我遇到了同樣的問題。 替換腳本如下

"test": "react-scripts test -- --config=jest.config.js",

"test": "jest",

因為 react-scripts 里面已經有笑話了。 無需顯式安裝。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM