Gus*_*rio 18 typescript reactjs jestjs ts-jest
几天前我能够运行我的测试并收集它的覆盖范围。(0 , _genMapping.maybeAddMapping) is not a function
但是当我今天尝试运行它时,每次测试都会出现错误。仅当我使用覆盖率标志运行时才会发生该错误。
如果我在没有覆盖的情况下跑步,它会按预期工作。
\nPS C:\\projetos> yarn jest\nyarn run v1.22.17\n$ C:\\projetos\\node_modules\\.bin\\jest\n PASS src/shared/utils/__tests__/geralUtils.test.ts (14.834 s)\n PASS src/shared/utils/__tests__/dateUtils.test.ts (15.253 s)\n PASS src/features/motorCalculo/__tests__/motorCalculoUtils.test.ts (5.905 s)\n PASS src/features/motorCalculo/__tests__/motorCalculoParametrosUtils.test.ts (5.19 s)\n PASS src/features/motorCalculo/__tests__/motorCalculoTabelaUtils.test.ts (28.38 s)\n\nTest Suites: 6 passed, 6 total\nTests: 25 passed, 25 total\nSnapshots: 0 total\nTime: 32.256 s\nRan all test suites.\nDone in 40.73s.\n
Run Code Online (Sandbox Code Playgroud)\n如果我尝试使用“yarn jest --coverage”或“yarn jest --collectCoverage”收集覆盖率,则会收到以下错误:
\nPS C:\\projetos> yarn jest --collectCoverage\nyarn run v1.22.17\n$ C:\\projetos\\node_modules\\.bin\\jest --collectCoverage\n FAIL src/shared/utils/__tests__/dateUtils.test.ts\n \xe2\x97\x8f Test suite failed to run\n\n TypeError: C:\\projetos\\src\\shared\\utils\\dataUtils.ts: (0 , _genMapping.maybeAddMapping) is not a function\n\n at SourceMap.mark (node_modules/jest-cli/node_modules/@babel/generator/lib/source-map.js:49:37)\n\n FAIL src/shared/utils/__tests__/geralUtils.test.ts\n \xe2\x97\x8f Test suite failed to run\n\n TypeError: C:\\projetos\\src\\shared\\utils\\geralUtils.ts: (0 , _genMapping.maybeAddMapping) is not a function\n\n at SourceMap.mark (node_modules/jest-cli/node_modules/@babel/generator/lib/source-map.js:49:37)\n\n FAIL src/features/motorCalculo/__tests__/motorCalculoUtils.test.ts\n \xe2\x97\x8f Test suite failed to run\n\n TypeError: C:\\projetos\\src\\features\\motorCalculo\\motorCalculoUtils.ts: (0 , _genMapping.maybeAddMapping) is not a function\n\n at SourceMap.mark (node_modules/jest-cli/node_modules/@babel/generator/lib/source-map.js:49:37)\n\n FAIL src/shared/utils/__tests__/arrayUtils.test.ts\n \xe2\x97\x8f Test suite failed to run\n\n TypeError: C:\\projetos\\src\\shared\\utils\\arrayUtils.ts: (0 , _genMapping.maybeAddMapping) is not a function\n\n at SourceMap.mark (node_modules/jest-cli/node_modules/@babel/generator/lib/source-map.js:49:37)\n\n FAIL src/features/motorCalculo/__tests__/motorCalculoParametrosUtils.test.ts\n \xe2\x97\x8f Test suite failed to run\n\n TypeError: C:\\projetos\\src\\features\\motorCalculo\\parametros\\motorCalculoParametrosUtils.ts: (0 , _genMapping.maybeAddMapping) is not a function\n\n at SourceMap.mark (node_modules/jest-cli/node_modules/@babel/generator/lib/source-map.js:49:37)\n\n FAIL src/features/motorCalculo/__tests__/motorCalculoTabelaUtils.test.ts\n \xe2\x97\x8f Test suite failed to run\n\n TypeError: C:\\projetos\\src\\features\\motorCalculo\\tabela\\motorCalculoTabelaUtils.tsx: (0 , _genMapping.maybeAddMapping) is not a function\n\n at SourceMap.mark (node_modules/jest-cli/node_modules/@babel/generator/lib/source-map.js:49:37)\n\n----------|---------|----------|---------|---------|-------------------\nFile | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s\n----------|---------|----------|---------|---------|-------------------\nAll files | 0 | 0 | 0 | 0 |\n----------|---------|----------|---------|---------|-------------------\nTest Suites: 6 failed, 6 total\nTests: 0 total\nSnapshots: 0 total\nTime: 27.526 s, estimated 29 s\nRan all test suites.\nerror Command failed with exit code 1.\ninfo Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.\n
Run Code Online (Sandbox Code Playgroud)\n这是我的 jest.config.ts:
\nPS C:\\projetos> yarn jest\nyarn run v1.22.17\n$ C:\\projetos\\node_modules\\.bin\\jest\n PASS src/shared/utils/__tests__/geralUtils.test.ts (14.834 s)\n PASS src/shared/utils/__tests__/dateUtils.test.ts (15.253 s)\n PASS src/features/motorCalculo/__tests__/motorCalculoUtils.test.ts (5.905 s)\n PASS src/features/motorCalculo/__tests__/motorCalculoParametrosUtils.test.ts (5.19 s)\n PASS src/features/motorCalculo/__tests__/motorCalculoTabelaUtils.test.ts (28.38 s)\n\nTest Suites: 6 passed, 6 total\nTests: 25 passed, 25 total\nSnapshots: 0 total\nTime: 32.256 s\nRan all test suites.\nDone in 40.73s.\n
Run Code Online (Sandbox Code Playgroud)\n我在任何地方都找不到有关此错误的任何信息,有人知道会发生什么吗?
\n 归档时间: |
|
查看次数: |
7158 次 |
最近记录: |