ngx-cypress-builder icon indicating copy to clipboard operation
ngx-cypress-builder copied to clipboard

Builder is broken when using angular-cli ^8.0.0

Open alantreadway opened this issue 6 years ago • 4 comments

Step to reproduce:

  • Setup a project as described in the README.md.
  • Run ng e2e.

Expected behaviour:

  • Project builds and Cypress tests are executed.

Actual behaviour:

  • Command fails immediately with:
Could not find the implementation for builder ngx-cypress-builder:cypress
Error: Could not find the implementation for builder ngx-cypress-builder:cypress
    at WorkspaceNodeModulesArchitectHost.resolveBuilder (/Users/alan/git/ralloo/ralloo-api-ui/node_modules/@angular-devkit/architect/node/node-modules-architect-host.js:49:19)
    at E2eCommand.initialize (/Users/alan/git/ralloo/ralloo-api-ui/node_modules/@angular/cli/models/architect-command.js:135:55)
    at process._tickCallback (internal/process/next_tick.js:68:7)
    at Function.Module.runMain (internal/modules/cjs/loader.js:744:11)
    at startup (internal/bootstrap/node.js:285:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)

After a little hacking around (to determine if this would be a quick fix or something bigger), I found that Angular CLI is now looking for an implementation field rather than a class field for the command defined in builders.json; after hacking my local npx-cypress-builder package to switch this, I was then seeing this error:

Builder is not a builder
Error: Builder is not a builder
    at WorkspaceNodeModulesArchitectHost.loadBuilder (/Users/alan/git/ralloo/ralloo-api-ui/node_modules/@angular-devkit/architect/node/node-modules-architect-host.js:84:11)
    at process._tickCallback (internal/process/next_tick.js:68:7)
    at Function.Module.runMain (internal/modules/cjs/loader.js:744:11)
    at startup (internal/bootstrap/node.js:285:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)

...which led me to conclude this is likely to require a non-trivial fix. I couldn't quickly find any documentation on the Angular site about what the new expected interface contracts are.

Workaround:

  • I added some package.json scripts to mimic the behaviour of this package, using wait-on and npm-run-all dev dependencies in the interim until a fix can be made:
    "e2e": "run-p -r e2e:serve e2e:run",
    "e2e:edit": "run-p -r e2e:serve e2e:cypress-open",
    "e2e:run": "wait-on http://localhost:4200 && cypress run",
    "e2e:cypress-open": "wait-on http://localhost:4200 && cypress open",
    "e2e:serve": "ng serve -c e2e"

alantreadway avatar May 30 '19 11:05 alantreadway

I recommend using nrwl's cypress builder. The most recent version should work with angular 8. And is being actively maintained.

npm i @nrwl/builders

And use the builder: @nrwl/cypress:cypress in your angular.json.

Docs for builder options are here: https://nx.dev/api/cypress/builders/cypress

isaacplmann avatar May 30 '19 12:05 isaacplmann

I recommend using nrwl's cypress builder. The most recent version should work with angular 8. And is being actively maintained.

npm i @nrwl/builders

And use the builder: @nrwl/cypress:cypress in your angular.json.

Docs for builder options are here: https://nx.dev/api/cypress/builders/cypress

Cool, though out of interest, will you be updating this to support Angular 8 at anytime?

niallconaghan avatar Jun 05 '19 11:06 niallconaghan

No. The Nrwl builder does everything I tried to do with this builder and is better maintained.

On Wed, Jun 5, 2019, 7:00 AM Niall [email protected] wrote:

I recommend using nrwl's cypress builder. The most recent version should work with angular 8. And is being actively maintained.

npm i @nrwl/builders

And use the builder: @nrwl/cypress:cypress in your angular.json.

Docs for builder options are here: https://nx.dev/api/cypress/builders/cypress

Cool, though out of interest, will you be updating this to support Angular 8 at anytime?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/isaacplmann/ngx-cypress-builder/issues/10?email_source=notifications&email_token=AAGSKQBCXRDYHNRKGGWQ6ETPY6MDTA5CNFSM4HREEQTKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODW7LMVA#issuecomment-499037780, or mute the thread https://github.com/notifications/unsubscribe-auth/AAGSKQE5OQW2QBR2CNYYXRLPY6MDTANCNFSM4HREEQTA .

isaacplmann avatar Jun 05 '19 11:06 isaacplmann

Please could you update the readme too?

mikesimmonds avatar Feb 26 '20 19:02 mikesimmonds