Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when use the context menu to run a single e2e file, got an error #21

Open
chaiyilin opened this issue Nov 16, 2017 · 8 comments
Open

when use the context menu to run a single e2e file, got an error #21

chaiyilin opened this issue Nov 16, 2017 · 8 comments

Comments

@chaiyilin
Copy link

got
Error: ENOENT: no such file or directory, open 'c:\alinta\testDemo\node_modules\testcafe\client\hammerhead.js'

this file does not exist

@romanresh
Copy link
Owner

Hi @chaiyilin . Which version of testcafe do you use? And do you have the testcafe package installed in the working directory (c:\alinta\testDemo)?

@chaiyilin
Copy link
Author

"testcafe": "^0.18.3", and yes, i install it locally

@romanresh
Copy link
Owner

romanresh commented Nov 17, 2017

Hm, I just checked it with the [email protected] 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.

@thomasleveil
Copy link

thomasleveil commented Jan 19, 2018

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

using the plugin

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...

reproducing without the plugin

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.

workaround

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)

thomasleveil added a commit to thomasleveil/vscode-testcafe that referenced this issue Jan 19, 2018
@romanresh
Copy link
Owner

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?

@romanresh
Copy link
Owner

@chaiyilin Have you resolved the error? Did you try to reinstall testcafe?

@thomasleveil
Copy link

reinstalling testcafe did not help in my case. I guess the issue is in testcafe

@AlexanderMoskovkin
Copy link

AlexanderMoskovkin commented Feb 16, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants