Open JSMike opened 5 years ago
Did some research on this. It's because the angular-cli uses process.fork
on a helper module and then runs the protractor launcher inside of a forked process, so it won't work with process.spawn
.
ok.
We never used the angular-cli for our needs, hence never face that issue. I should at the minimum add that in the caveat list of the README.
I think we got a similar request/issue here : https://github.com/yahoo/protractor-retry/pull/52 I did not have a chance to try myself yet :(
Ok, I'll keep hacking away at it, if I can get it to work then that pattern should work for everyone using the Angular-CLI, so maybe just adding a flag to the afterLaunch function can toggle default behavior and Angular-CLI.
@JSMike I've run into the same issue, have you managed to find a workaround?
@Oikio Sorry, I haven't looked at this in a while, and it looks like I've blown away local changes that I made.
The important things are: https://github.com/angular/angular-cli/blob/master/packages/angular_devkit/build_angular/src/protractor/index.ts#L31 https://github.com/angular/angular-cli/blob/master/packages/angular_devkit/build_angular/src/utils/run-module-worker.js https://github.com/angular/angular-cli/blob/master/packages/angular_devkit/build_angular/src/utils/run-module-as-observable-fork.ts https://github.com/yahoo/protractor-retry/blob/master/lib/retry.js#L94
What's needed is some sort of conditional to check if the retry.js#L94 argv.$0
is executable, then use existing logic to spawn, otherwise spawn node script.
@JSMike thanks for the update, looks like it can be fixed. So if I won't solve my issue otherwise, I will take a close look at this.
@dreuxl @JSMike After a few attempts, I could make it work this way:
Line 94: return Q.fcall(spawn('./node_modules/.bin/protractor', ['path/to/protractor/conf', '--specs', fixedSpecList, '--retry', retryCount, '--disableChecks']));
What I did was change the executable the retry uses to spawn and also I re use the configuration file because without sending the protractor conf file the webdriver-manage update was failing.
Do you guys think that maybe this executable file should be a parameter so we can just choose ours ?
This other issue #63 is also caused by the problem mentioned here. So I think you guys can consider it as replicate.
I am experiencing similar failure - I tried executing my protractor test in centos node by command ng e2e and when it tries to execute the failed spec it throws below error Re-running tests , attempt : 1 Re-running the following test files : /home/vinod/zdp/core/zdp-ui/e2e/src/prepare/workflow/Workflow-Category/listcategory.e2e-spec.ts
[17:08:50] E/launcher - spawn node_modules/@angular-devkit/build-angular/src/utils/run-module-worker.js EACCES [17:08:50] E/launcher - Error: spawn node_modules/@angular-devkit/build-angular/src/utils/run-module-worker.js EACCES at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19) at onErrorNT (internal/child_process.js:469:16) at processTicksAndRejections (internal/process/task_queues.js:84:21)
Any suggestion . Thanks in Advance
I am getting the same issue as @vinodboruah.
For context, this error is happening when using protractor-retry with the Angular-CLI, which starts up a webpack dev server and then launches protractor.
The retry script assumes that
argv.$0
will be an executable and in this case tries to spawn a non-executable node script.This is the result when debugging is turned on and a test fails:
You can see
ProtractorRetry Command node_modules/@angular-devkit/build-angular/src/utils/run-module-worker.js
run-module-worker.js isn't executable, causing the error. I'm assuming that this script in the Angular CLI is waiting for a message that the webpack dev server has started before launching protractor.
This could probably be fixed by adding config to the retry.afterLaunch() function to override the protractor binary path.