Skip to content

Commit

Permalink
Mutation test testing.js module (#1204)
Browse files Browse the repository at this point in the history
Configure Stryker to mutation test the `testing.js` module. This is done
at the integration level because, like `index.js` it's an exposed
module.

In order to support this, the unit tests for injection strings were
lifted to integration tests in order to provide adequate integration
test coverage to guarantee 100% mutation coverage.
  • Loading branch information
ericcornelissen authored Oct 10, 2023
1 parent 4f95991 commit eb3f4eb
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 18 deletions.
2 changes: 1 addition & 1 deletion stryker.integration.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
export default {
coverageAnalysis: "perTest",
inPlace: false,
mutate: ["index.js"],
mutate: ["index.js", "testing.js"],
testRunner: "tap",
tap: {
testFiles: ["test/integration/**/*.test.js"],
Expand Down
2 changes: 1 addition & 1 deletion test/integration/testing/commonjs.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @overview Contains integration tests for the CommonJS version of the testing
* implementation of Shescape.
* utilities provided with Shescape.
* @license MIT
*/

Expand Down
15 changes: 13 additions & 2 deletions test/integration/testing/functional.test.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
/**
* @overview Contains integration tests for the testing implementation of
* @overview Contains integration tests for the testing utilities provided with
* Shescape.
* @license MIT
*/

import { testProp } from "@fast-check/ava";
import test from "ava";
import * as fc from "fast-check";

import { arbitrary } from "../_.js";

import { Shescape } from "shescape";
import { Shescape as Stubscape } from "shescape/testing";
import { injectionStrings, Shescape as Stubscape } from "shescape/testing";

test("injection strings", (t) => {
t.true(Array.isArray(injectionStrings));
t.true(injectionStrings.length > 0);

for (const injectionString of injectionStrings) {
t.is(typeof injectionString, "string");
t.true(injectionString.length > 0);
}
});

testProp(
"escape (stubscape ~ shescape)",
Expand Down
14 changes: 0 additions & 14 deletions test/unit/testing/injection-strings.test.js

This file was deleted.

0 comments on commit eb3f4eb

Please sign in to comment.