我的测试用例昨天工作正常,但今天当我尝试使用新更改运行我的测试用例时,它正在使用旧更改而不是新更新运行我的测试用例。
我尝试运行“cypress run”进行调试,它抛出一个错误
Error: Build failed with 1 error:
node_modules/cypress/index.mjs:1:19: ERROR: Could not resolve "module"
我将 cy.wait(10000) 更新为 cy.wait(20000)
错误: ` 正在运行:ERPNextCompany.feature(第 1 个,共 2 个) X [错误] 无法解析“模块”
node_modules/cypress/index.mjs:1:19:
1 │ import module from 'module'
╵ ~~~~~~~~
在文件系统上找不到包“module”,但它内置于节点中。您是否正在尝试捆绑节点?您可以使用“platform: 'node'”来执行此操作,这将消除此错误。`
日志:
The error was:
Error: Build failed with 1 error:
node_modules/cypress/index.mjs:1:19: ERROR: Could not resolve "module"
at failureErrorWithLog (C:\Users\Administrator\Desktop\New folder\cypress_udemy\node_modules\esbuild\lib\main.js:1636:15)
at C:\Users\Administrator\Desktop\New folder\cypress_udemy\node_modules\esbuild\lib\main.js:1048:25
at runOnEndCallbacks (C:\Users\Administrator\Desktop\New folder\cypress_udemy\node_modules\esbuild\lib\main.js:1471:45)
at buildResponseToResult (C:\Users\Administrator\Desktop\New folder\cypress_udemy\node_modules\esbuild\lib\main.js:1046:7)
at C:\Users\Administrator\Desktop\New folder\cypress_udemy\node_modules\esbuild\lib\main.js:1075:16
at responseCallbacks.<computed> (C:\Users\Administrator\Desktop\New folder\cypress_udemy\node_modules\esbuild\lib\main.js:697:9)
at handleIncomingPacket (C:\Users\Administrator\Desktop\New folder\cypress_udemy\node_modules\esbuild\lib\main.js:752:9)
at Socket.readFromStdout (C:\Users\Administrator\Desktop\New folder\cypress_udemy\node_modules\esbuild\lib\main.js:673:7)
at Socket.emit (node:events:513:28)
at Socket.emit (node:domain:489:12)
at addChunk (node:internal/streams/readable:324:12)
at readableAddChunk (node:internal/streams/readable:297:9)
at Socket.Readable.push (node:internal/streams/readable:234:10)
at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)
This occurred while Cypress was compiling and bundling your test code. This is usually caused by:
- A missing file or dependency
- A syntax error in the file or one of its dependencies
Fix the error in your code and re-run your tests.
就我而言,我有一个全局 Cypress 导入,但在我的 JS 文件测试之一中并未使用。
从“cypress”导入 Cypress
所以我就把它删除了。