question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add a guide showing how to set up an Angular project with Karma and Protractor

See original GitHub issue

We default to Jest and Cypress when create an Angular project. And we don’t give an option to use Karma when folk using presets.

To create a project with karma, you need to do something like this:

npx create-nx-workspace myorg --preset=empty --cli=angular
ng add @nrwl/angular
ng g app myapp --unit-test-runner=karma

We should document it

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:6
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
Blackbaud-SteveBrushcommented, Jan 28, 2022

The above comments weren’t working for me, but this got me to my desired state (Angular CLI, Karma, NPM):

npx create-nx-workspace --cli=angular --defaultBase=main --name=my-monorepo --nxCloud --packageManager=npm --preset=empty

cd my-monorepo

npx ng add @nrwl/angular --skip-confirmation --style=scss --unitTestRunner=karma

npx nx generate @nrwl/angular:application --name=my-app --prefix=app --routing --strict --style=scss --unitTestRunner=karma
1reaction
maartentibaucommented, Jan 2, 2020

I actually have a small “guide” for it.

npx create-nx-workspace@latest {workspace-name}

npx ng config cli.packageManager npm

npx ng add @nrwl/angular@latest --registry=npm --interactive=true

npx ng g @nrwl/angular:application {application-name} --routing=true --style=scss --e2e-test-runner=protractor

npx ng config schematics.@schematics/angular:component.styleext scss

I personally was not aware you could also do this with --unit-test-runner=karma

Read more comments on GitHub >

github_iconTop Results From Across the Web

Testing - Angular
The Angular CLI takes care of Jasmine and Karma configuration for you. It constructs the full configuration in memory, based on options specified...
Read more >
Angular — A Comprehensive guide to unit-testing with ...
A step by step guide to a unit testing angular project with some examples ... Angular recommends Karma and CLI create it out...
Read more >
Testing AngularJS with Protractor and Karma - part 1
v4 - adds E2E tests. Contents. Project Setup; Configuration Files; Unit Tests; Conclusion. Project Setup. Start by cloning the repo, checkout ...
Read more >
Tutorial - Protractor - end-to-end testing for AngularJS
To run, you will need to have Node.js installed. You will download Protractor package using npm, which comes with Node.js. Check the version...
Read more >
Testing Angular with Jasmine and Karma (Part 1) - DigitalOcean
Karma is a direct product of the AngularJS team from struggling to test their ... Unless you add some additional configuration your typical ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found