I've been working on an Angular 5 application for a while now and typically start my tests using the following command:
ng test --reporters dots
This works as expected. I started a new Angular 6 project recently and thought I could use the same command to run my karma tests, but whenever I try and specify --reporters
I get the following error:
Data path ".reporters" should be array.
This error doesn't make a whole lot of sense to me, and where exactly it wants this array. I do have a reporters:
array in karma.conf.js, but it's the same as what I've got in my Angular 5 project.
For the record, ng test
works just fine, but I prefer the dots output for local testing. I should also specify that any reporter I try to run from the command line also shows this exact behavior. I can't run the coverage reporters I'd like either.
Here is my karma.conf.js. Relevant reporters section:
reporters: ['spec', 'kjhtml'],
I've tried adding 'dots'
to that as well, with no effect.
My package.json has the following two lines in scripts:
"test": "ng test --code-coverage",
"watch": "ng test --reporters dots",
npm run test
works fine, but npm run watch
does not. It gives the error reported above.
Relevant devDependencies:
"@angular-devkit/build-angular": "~0.10.7",
"@angular/cli": "6.2.7",
"karma": "^1.7.1",
"karma-chrome-launcher": "^2.2.0",
"karma-cli": "^1.0.1",
"karma-coverage-istanbul-reporter": "^2.0.4",
"karma-jasmine": "^1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-mocha-reporter": "^2.2.1",
"karma-remap-istanbul": "^0.2.1",
"karma-spec-reporter": "0.0.32",
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With