If you create an NX workspace with preset angular
, you can run e2e tests successfully using yarn e2e
yarn create nx-workspace start-angular --preset=angular --appName=web --packageManager=yarn --nx-cloud=false --style=scss --routing --viewEncapsulation=Emulated --enableIvy --unitTestRunner=jest --e2eTestRunner=cypress --linter=eslint
cd start-angular
yarn e2e
However, if you create a workspace with preset empty
and add an Angular project later (eg to be able to pass additional options like --strict
),
yarn create nx-workspace start-empty --preset empty --packageManager=yarn --nx-cloud=false
cd start-empty
yarn add --dev @nrwl/angular
yarn nx generate @nrwl/angular:application --name=web --strict --style=scss --routing --viewEncapsulation=Emulated --enableIvy --unitTestRunner=jest --e2eTestRunner=cypress --linter=eslint
yarn e2e
you get the following error when you run e2e tests (output of yarn e2e
):
yarn run v1.22.10
$ nx e2e
No project name specified. Using default project : web
ERROR Cannot find target 'e2e' for project 'web'
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
How to change the configuration in the workspace start-empty
to be able to run e2e tests using yarn e2e
? You can run yarn e2e web-e2e
, but I don't understand, why yarn e2e
is not working in NX workspace start-empty
but in start-angular
.
Can you try nx e2e web-e2e
? This is the name of the default e2e project that is created for an app with the name web
when you run the nx generate @nrwl/angular:application
schematic. Indeed, in your workspace.json
there will be no e2e
target for the project web
, but there will be one for the web-e2e
project which is the e2e project you want to run!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.