Skip to content

Commit a441a44

Browse files
committed
jest: Support skip in Jest fuzzing mode
1 parent f9e4152 commit a441a44

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

packages/jest-runner/testStateInterceptor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export function interceptTestState(
5959
} else if (event.name === "test_start") {
6060
// In fuzzing mode, only execute the first encountered (not skipped) fuzz test
6161
// and mark all others as skipped.
62-
if (jazzerConfig.mode === "fuzzing") {
62+
if (jazzerConfig.mode === "fuzzing" && event.test.mode !== "skip") {
6363
if (
6464
!firstFuzzTestEncountered &&
6565
(!state.testNamePattern ||

tests/jest_integration/integration.test.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ describe("Jest integration", () => {
198198
});
199199
});
200200

201-
describe("Run modes", () => {
201+
describe("run modes", () => {
202202
it.concurrent("only", () => {
203203
const fuzzTest = new FuzzTestBuilder()
204204
.dir(projectDir)
@@ -210,6 +210,16 @@ describe("Jest integration", () => {
210210
.execute();
211211
expect(fuzzTest.stdout).toContain("only test called");
212212
});
213+
214+
it("skipped", () => {
215+
const fuzzTest = fuzzTestBuilder
216+
.jestTestName("Run mode skip and standard")
217+
.runs(1)
218+
.logTestOutput()
219+
.build()
220+
.execute();
221+
expect(fuzzTest.stdout).toContain("standard test called");
222+
});
213223
});
214224
});
215225

tests/jest_integration/jest_project/integration.fuzz.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,12 @@ describe("Jest Integration", () => {
9595

9696
describe("Run mode", () => {
9797
describe("skip and standard", () => {
98-
it.fuzz("standard test", (data) => {
99-
console.log("standard test called");
100-
});
101-
10298
it.skip.fuzz("skipped test", (data) => {
10399
throw new Error("Skipped test not skipped!");
104100
});
101+
102+
it.fuzz("standard test", (data) => {
103+
console.log("standard test called");
104+
});
105105
});
106106
});

0 commit comments

Comments
 (0)