diff --git a/packages/bun-vscode/src/features/tests/__tests__/bun-test-controller.test.ts b/packages/bun-vscode/src/features/tests/__tests__/bun-test-controller.test.ts index 17aeaf6720..92654c67d2 100644 --- a/packages/bun-vscode/src/features/tests/__tests__/bun-test-controller.test.ts +++ b/packages/bun-vscode/src/features/tests/__tests__/bun-test-controller.test.ts @@ -30,7 +30,7 @@ describe("BunTestController", () => { const pattern = internal.buildTestNamePattern(mockTests); expect(pattern).toContain(".*?"); - expect(pattern).toBe("(^ test with .*?$)|(^ test with \\.*?$)"); + expect(pattern).toBe("(^ ?test with .*?$)|(^ ?test with \\.*?$)"); }); test("should escape % formatters", () => { @@ -41,7 +41,7 @@ describe("BunTestController", () => { const pattern = internal.buildTestNamePattern(mockTests); - expect(pattern).toBe("(^ test with .*?$)|(^ test with .*?$)"); + expect(pattern).toBe("(^ ?test with .*?$)|(^ ?test with .*?$)"); }); test("should join multiple patterns with |", () => { @@ -53,7 +53,7 @@ describe("BunTestController", () => { const pattern = internal.buildTestNamePattern(mockTests); - expect(pattern).toBe("(^ test 1$)|(^ test 2$)|(^ test 3$)"); + expect(pattern).toBe("(^ ?test 1$)|(^ ?test 2$)|(^ ?test 3$)"); }); test("should handle describe blocks differently", () => { @@ -61,7 +61,7 @@ describe("BunTestController", () => { const pattern = internal.buildTestNamePattern(mockTests); - expect(pattern).toBe("(^ describe block )"); + expect(pattern).toBe("(^ ?describe block )"); }); test("should handle complex nested test names", () => { diff --git a/packages/bun-vscode/src/features/tests/bun-test-controller.ts b/packages/bun-vscode/src/features/tests/bun-test-controller.ts index bbe9cd2cc4..d822d88141 100644 --- a/packages/bun-vscode/src/features/tests/bun-test-controller.ts +++ b/packages/bun-vscode/src/features/tests/bun-test-controller.ts @@ -1339,9 +1339,9 @@ export class BunTestController implements vscode.Disposable { t = t.replaceAll(/\$[\w\.\[\]]+/g, ".*?"); if (test?.tags?.some(tag => tag.id === "test" || tag.id === "it")) { - testNames.push(`^ ${t}$`); + testNames.push(`^ ?${t}$`); } else if (test?.tags?.some(tag => tag.id === "describe")) { - testNames.push(`^ ${t} `); + testNames.push(`^ ?${t} `); } else { testNames.push(t); }