diff --git a/.github/workflows/mutation-report.yml b/.github/workflows/mutation-report.yml index 9a3d639..ba19107 100644 --- a/.github/workflows/mutation-report.yml +++ b/.github/workflows/mutation-report.yml @@ -63,7 +63,9 @@ jobs: bin=$(go env GOBIN) # gremlins reads the module root as `.`; given `./...` it finds no mutants at all. Each # mutant reruns the tests, and the default timeout times out a race-enabled suite. - "${bin:-$(go env GOPATH)/bin}/gremlins" unleash --diff "$BASE" --timeout-coefficient 40 \ + # --integration runs every test per mutant: otherwise gremlins tests the directory named + # after the Go package, so a mutant in `package main` runs no tests and reads as survived. + "${bin:-$(go env GOPATH)/bin}/gremlins" unleash --integration --diff "$BASE" --timeout-coefficient 40 \ --output "$RUNNER_TEMP/gremlins.json" . - name: Mutate the changed TypeScript diff --git a/tests/test_mutation_report.py b/tests/test_mutation_report.py index 5f4a6e0..f703b5d 100644 --- a/tests/test_mutation_report.py +++ b/tests/test_mutation_report.py @@ -130,3 +130,12 @@ def test_a_report_that_is_not_json_is_named_but_does_not_fail(self) -> None: if __name__ == "__main__": unittest.main() + + +class TheWorkflow(unittest.TestCase): + def test_gremlins_runs_every_test_against_each_mutant(self) -> None: + # gremlins otherwise picks the package to test by finding a directory named after the Go + # package, so a mutant in `package main` under cmd/app runs no tests and reads as survived. + workflow = (Path(__file__).resolve().parents[1] / ".github/workflows/mutation-report.yml").read_text() + unleash = next(line for line in workflow.splitlines() if "gremlins\" unleash" in line) + self.assertIn("--integration", unleash)