簡體   English   中英

當在 react 中運行 npm test 時,Jest 給了我下面的消息,我要做的就是運行它默認在 App.test.js 中的測試

[英]When running npm test in react Jest is giving me the message below and All I am trying to do is run the test it comes by default inside App.test.js

● 測試套件運行失敗

Cannot find module 'C:\Users.....\node_modules\grpc\src\node\extension_binary\node-v72-win32-x64-unknown\grpc_node.node' from 'grpc_extension.js'

However, Jest was able to find:
    './grpc_extension.js'

You might want to include a file extension in your import, or update your 'moduleFileExtensions', which is currently ['web.js', 'js', 'web.ts', 'ts', 'web.tsx', 'tsx', 

“json”、“web.jsx”、“jsx”、“節點”]。

See https://jestjs.io/docs/en/configuration#modulefileextensions-array-string     

However, Jest was able to find:
    './client_interceptors.js'

You might want to include a file extension in your import, or update your 'moduleFileExtensions', which is currently ['web.js', 'js', 'web.ts', 'ts', 'web.tsx', 'tsx', 

“json”、“web.jsx”、“jsx”、“節點”]。

See https://jestjs.io/docs/en/configuration#modulefileextensions-array-string     

However, Jest was able to find:
    '../api/api-firebase.js'

You might want to include a file extension in your import, or update your 'moduleFileExtensions', which is currently ['web.js', 'js', 'web.ts', 'ts', 'web.tsx', 'tsx', 

PASS src/App.test.js FAIL src/pages/InventoryItems.test.js ● 測試套件運行失敗

Cannot find module 'C:\Users\el_mo\Boom\BoomAdmin\boom-platform-admin-portal\node_modules\grpc\src\node\extension_binary\node-v72-win32-x64-unknown\grpc_node.node' from 'grpc_extension.js'

However, Jest was able to find:
    './grpc_extension.js'

You might want to include a file extension in your import, or update your 'moduleFileExtensions', which is currently ['web.js', 'js', 'web.ts', 'ts', 'web.tsx', 'tsx', 

“json”、“web.jsx”、“jsx”、“節點”]。

See https://jestjs.io/docs/en/configuration#modulefileextensions-array-string     

However, Jest was able to find:
    './client_interceptors.js'

You might want to include a file extension in your import, or update your 'moduleFileExtensions', which is currently ['web.js', 'js', 'web.ts', 'ts', 'web.tsx', 'tsx', 

“json”、“web.jsx”、“jsx”、“節點”]。

See https://jestjs.io/docs/en/configuration#modulefileextensions-array-string     

However, Jest was able to find:
    '../api/api-firebase.js'

You might want to include a file extension in your import, or update your 'moduleFileExtensions', which is currently ['web.js', 'js', 'web.ts', 'ts', 'web.tsx', 'tsx', 

“json”、“web.jsx”、“jsx”、“節點”]。

“json”、“web.jsx”、“jsx”、“節點”]。

See https://jestjs.io/docs/en/configuration#modulefileextensions-array-string

However, Jest was able to find:
    './InventoryItems.test.js'
    './InventoryItems.tsx'

You might want to include a file extension in your import, or update your 'moduleFileExtensions', which is currently ['web.js'js', 'js', 'web.ts', 'ts', 'web.tsx', 'tsx', 'json', 'web.jsx', 'jsx', 'node'].

See https://jestjs.io/docs/en/configuration#modulefileextensions-array-string

  at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:259:17)
  at Object.<anonymous> (node_modules/grpc/src/grpc_extension.js:32:13)

測試套件:1 次失敗,1 次通過,總共 2 次測試:1 次通過,總共 1 個快照:總共 0 次時間:5.856 秒運行與更改文件相關的所有測試套件。

所以我終於解決了!! 我不得不降級 node 的版本,然后我不得不重新安裝 react-scripts。 我使用的節點版本是 6.14.8

暫無
暫無

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

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