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.

ng test should accept customized config parameter of karma.config.js

See original GitHub issue

Bug Report or Feature Request (mark with an x)


- [x] feature request

Command (mark with an x)


- [x] test

Versions

node v8.10.0 npm 5.6.0 @angular/cli 6.1.3

Repro steps

After upgrade to angular 6, the parameter set for the config of karma.config.js does not work anymore it’s NOT the parameter to specify which file, our script is like this

npm run test – --customizedParam=paramValue

In the karma.config.js, the parameter is used. module.exports = function (config) { var customizedParam= config.customizedParam; … }

the npm run test is ng test in package.json this parameter value is decided in build agent, and everytime is different.

The log given by the failure

Unknown option: ‘–customizedParam’ and it stopped the test run

Desired functionality

the command line parameters for karma config can be accepted as before or a workaround. angular 5 cli will also prompt warning message but it didn’t stop test and the parameter take effect.

Mention any other details that might be useful

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:17
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
danday74commented, Apr 11, 2019

I need this too - should allow a --customFlag

2reactions
EugeneSnihovskycommented, Feb 12, 2019

Hello @hansl

I search in documentation, issues and stack overflow but can’t find any solution to launch tests from single spec file (fdescribe is not an option) in angular 6+ applications.

In previous versions we use this solution, but for now all unknown –flags are disabled.

You removed this feature, but not offered alternative way. I understand why you block all unknown flags, this is right solution. But also you can add just one more allowed flag (let’s say –spec) and this will help to other developers.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuration File - Karma
The easiest way to generate an initial configuration file is by using the karma init command. This page lists all of the available...
Read more >
angular-cli - Use multiple karma.conf.js - Stack Overflow
For Dev : For which I am using Chrome. Is there any way that I could switch betwwen two karma.conf.js based on an...
Read more >
ng test - Angular
Option Description Value Type Defau... ‑‑browsers Override which browsers tests are run against. string ‑‑code‑coverage Output a code coverage report. boolean false ‑‑code‑coverage‑exclude Globs to exclude...
Read more >
Angular Unit Testing Using Jasmine and Karma - eSketchers
Port, browsers and singleRun configure the environment our unit tests will run under. The browsers property specifies which browser we want ...
Read more >
Angular: Unit Testing Jasmine, Karma (step by step) - Medium
The angular-cli configuration of karma uses the file “test.ts” as the entry point of the tests for the application. Let's take a look...
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