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.

Support mutation testing with angular cli

See original GitHub issue

We’re investigating the possibility of supporting angular in Stryker, a mutation testing framework. I was wondering if it was possible to run test with ng test --watch=false --single-run=false and keep open the karma server so we can fire karma run commands.

The idea would be that we make small code changes and rerun the tests with karma run. Ideally we would be able to distinguish between a failed test and a compile error.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:25 (23 by maintainers)

github_iconTop GitHub Comments

1reaction
filipesilvacommented, Oct 5, 2018

Heya @nicojs, I think that would be a nice addition, yes. We’ve recently added another binary as an API too in https://github.com/angular/angular-cli/pull/12022. I’d ask you to use roughly the same approach as https://github.com/angular/angular-cli/blob/master/packages/angular_devkit/benchmark/src/main.ts uses.

Also, you might be interested in https://github.com/karma-runner/karma/pull/3153. We’d like that functionality in so that we can test Karma rebuilds, and I think it might be relevant for you too since there’s a lot of tooling involved in Stryker.

1reaction
nicojscommented, Aug 28, 2018

Hi again 👋

I’ve got some good news. I’ve decided on another approach, implemented it and released it. It works 👍

However, it relies on a private api: '@angular/cli/lib/cli'. Before I close this issue, I would like to make a PR to make the cli public. It would allow programmatic execution of commands:

import { cli } from '@angular/cli';
cli({
    cliArgs: ['test', '--progress=false', /* ...etc */],
    inputStream: process.stdin,
    outputStream: process.stdout
});

@filipesilva would that be OK?

To use angular with mutation testing, you can use this guide: https://github.com/stryker-mutator/stryker-handbook/blob/master/stryker/configuration/angular.md

Basically it works like this:

  • It starts the ng test command and keeps the server open.
  • It mutates files one by one and reports the result

The implementation is based on the intellij karma plugin, which also executes ng test and keeps the server open. Nice find!

Thanks for making this possible by merging #11181

Read more comments on GitHub >

github_iconTop Results From Across the Web

How Angular Supports Mutation Testing With Example
Run the following command to configure the Angular project with the Stryker mutation testing framework. To do so, please move into your ...
Read more >
Angular - Stryker Mutator
Stryker 4.0 and higher supports Angular projects using the Angular CLI starting ... checker to increase mutation testing performance and kill mutants that ......
Read more >
Mutation Testing(>Coverage) — Typescript Angular — Mocha ...
Mutation testing the way to evaluate code strength, test alert against code changes, see the meaning to the unit test cases and omit...
Read more >
mutation-testing-elements - npm
The mutation test report supports the following features: Calculates and displays the mutation score and other metrics
Read more >
Testing – Angular - GraphQL Code Generator
The apollo-angular/testing module exports a ApolloTestingModule module and ApolloTestingController service which simplifies the testing of ...
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