Open chaiyilin opened 6 years ago
Hi @chaiyilin . Which version of testcafe do you use? And do you have the testcafe package installed in the working directory (c:\alinta\testDemo)?
"testcafe": "^0.18.3", and yes, i install it locally
Hm, I just checked it with the testcafe@0.18.3 and it works correctly on my local machine.
Try to remove the c:\alinta\testDemo\node_modules folder and install it again:
call npm install
in the c:\alinta\testDemo directory.
If it doesn't help set the Uncaught Exception checkbox (on the Debug tab) and rerun a test. Which file tries to find the hammerhead.js file in the wrong folder? If the VS Code's debugger doesn't stop on this exception, check also the All Exceptions checkbox on the Debug tab of VS Code and run your test again.
I can reproduce this issue and found a workaround.
Visual Studio Code 1.19.2
TestCafe Test Runner 1.4.1
$ node --version
v8.9.4
$ npm --version
5.6.0
$ npx testcafe --version
0.18.6
tleveil@DEV-PC1-MV MINGW64 ~/workspace/mv-workflow-ui (test)
$ cd "c:\Users\tleveil\workspace\mv-workflow-ui" ; node --no-deprecation --inspect-brk=38384 "node_modules\testcafe\lib\cli\index.js" chrome "c:\Users\tleveil\workspace\mv-workflow-ui\tests\profile-menu.test.js" --fixture pro
file-menu
Debugger listening on ws://127.0.0.1:38384/1637b468-9e21-4c15-afcf-5ce53dfd88a9
For help see https://nodejs.org/en/docs/inspector
Debugger attached.
ERROR Cannot prepare tests due to an error.
Error: ENOENT: no such file or directory, open 'c:\Users\tleveil\workspace\mv-workflow-ui\node_modules\testcafe\client\hammerhead.js'
at readSync (c:\Users\tleveil\workspace\mv-workflow-ui\node_modules\read-file-relative\index.js:24:22)
at Object.<anonymous> (c:\Users\tleveil\workspace\mv-workflow-ui\node_modules\testcafe\lib\testcafe.js:23:27)
at Object.<anonymous> (c:\Users\tleveil\workspace\mv-workflow-ui\node_modules\testcafe\lib\index.js:166:17)
at Object.<anonymous> (c:\Users\tleveil\workspace\mv-workflow-ui\node_modules\testcafe-vue-selectors\lib\index.js:13:17)
at Object.<anonymous> (c:\Users\tleveil\workspace\mv-workflow-ui\tests\profile-menu.test.js:2:1)
Type "testcafe -h" for help.
Waiting for the debugger to disconnect...
tleveil@DEV-PC1-MV MINGW64 ~/workspace/mv-workflow-ui (test)
$ cd "c:\Users\tleveil\workspace\mv-workflow-ui" ; node --no-deprecation "node_modules\testcafe\lib\cli\index.js" chrome "c:\Users\tleveil\workspace\mv-workflow-ui\tests\profile-menu.test.js" --fixture profile-menu
ERROR Cannot prepare tests due to an error.
Error: ENOENT: no such file or directory, open 'c:\Users\tleveil\workspace\mv-workflow-ui\node_modules\testcafe\client\hammerhead.js'
at readSync (c:\Users\tleveil\workspace\mv-workflow-ui\node_modules\read-file-relative\index.js:24:22)
at Object.<anonymous> (c:\Users\tleveil\workspace\mv-workflow-ui\node_modules\testcafe\lib\testcafe.js:23:27)
at Object.<anonymous> (c:\Users\tleveil\workspace\mv-workflow-ui\node_modules\testcafe\lib\index.js:166:17)
at Object.<anonymous> (c:\Users\tleveil\workspace\mv-workflow-ui\node_modules\testcafe-vue-selectors\lib\index.js:13:17)
at Object.<anonymous> (c:\Users\tleveil\workspace\mv-workflow-ui\tests\profile-menu.test.js:2:1)
Type "testcafe -h" for help.
If we pass a relative test file path instead of absolute, it runs fine with npx.
tleveil@DEV-PC1-MV MINGW64 ~/workspace/mv-workflow-ui (test)
$ cd "c:\Users\tleveil\workspace\mv-workflow-ui" ; node --no-deprecation "node_modules\testcafe\lib\cli\index.js" chrome ".\tests\profile-menu.test.js" --fixture profile-menu
testing app at http://localhost:8080
Running tests in:
- Chrome 63.0.3239 / Windows 10 0.0.0
profile-menu
√ personne n'est connecté
√ connexion et déconexion de Jean Tartempion
2 passed (6s)
Hi @thomasleveil . I met this error a few times and fixed it via full reinstalling of testcafe (via deleting node_modules, package-lock.json and executing npm i
). So, this problems looks like a problem in the installation of the testcafe package and its dependencies.
How did you find relation between a relative/absolute path to a test file and this problem?
@chaiyilin Have you resolved the error? Did you try to reinstall testcafe?
reinstalling testcafe did not help in my case. I guess the issue is in testcafe
Hi @thomasleveil,
I faced with the same problem a few times. It seems it relates to some npm
unexpected behavior. Usually it is fixed by reinstalling modules (via npm
or yarn
). Meanwhile we'll investigate why it happens and let you know if we have any results.
got Error: ENOENT: no such file or directory, open 'c:\alinta\testDemo\node_modules\testcafe\client\hammerhead.js'
this file does not exist