小编Gus*_*rio的帖子

当我尝试收集笑话测试的覆盖范围时,出现错误“_genMapping.maybeAddMapping 不是函数”

几天前我能够运行我的测试并收集它的覆盖范围。(0 , _genMapping.maybeAddMapping) is not a function但是当我今天尝试运行它时,每次测试都会出现错误。仅当我使用覆盖率标志运行时才会发生该错误。

\n

如果我在没有覆盖的情况下跑步,它会按预期工作。

\n
PS 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”收集覆盖率,则会收到以下错误:

\n
PS 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 Code Online (Sandbox Code Playgroud)

typescript reactjs jestjs ts-jest

18
推荐指数
1
解决办法
7158
查看次数

如何修复python socket-io服务器中的“Access-Control-Allow-Origin”错误

我正在创建一个使用 Vue.js(作为客户端)和 Python(作为服务器)的项目。Python用于一些计算,Vue.js用于接口。我正在使用 python-socketio ( https://python-socketio.readthedocs.io/en/latest/ ) 和 Vue-socket.io ( https://github.com/MetinSeylan/Vue-Socket.io )连接它们. 几周前它工作得很好。连接和通信正在成功进行。但是几天前,我再次尝试运行相同的代码并出现此错误:

? Access to XMLHttpRequest at shttp://localhost:2003/socket.io/?EI0.38transport.polling&t=Mom6k2V' from origin 'http://1 :1 ocalhost:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. 
? GET http://localhost:2003/socket.io/?EI0=3&transport=polling&t=Mom6k2V net::ERR FAILED vue-socketio.js?5132:8
Run Code Online (Sandbox Code Playgroud)

我尝试使用我确信可以正常工作的旧存储库,但我遇到了同样的问题。

我尝试在另一台计算机和 Raspberry Pi 中运行相同的代码,但遇到了同样的问题。

我尝试使用 --disable-web-security 运行 chrome 以禁用 cors,但出现以下错误:

? WebSocket connection to 'ws://localhost:2003/socket.io/? vue-socketio.js?5132:10 EI0.3&transport=websocket&sid=7111830544fa4dfd98c3424afd25c10e failed: Error during WebSocket handshake: Unexpected response code: 400 
Run Code Online (Sandbox Code Playgroud)

服务器

? Access to XMLHttpRequest at shttp://localhost:2003/socket.io/?EI0.38transport.polling&t=Mom6k2V' from …
Run Code Online (Sandbox Code Playgroud)

python sockets cors vue.js

3
推荐指数
2
解决办法
6233
查看次数

标签 统计

cors ×1

jestjs ×1

python ×1

reactjs ×1

sockets ×1

ts-jest ×1

typescript ×1

vue.js ×1