From d1d7997a9238b9348a1c52a686d6db65c28803c3 Mon Sep 17 00:00:00 2001 From: Colin Heathman Date: Mon, 11 Sep 2023 10:26:23 -0700 Subject: [PATCH] Fix test parsing regex Looking for 'it' statements should not be sensitive to whitespace --- gazelle/parse.go | 2 +- .../my_module/nested_module/a.test.ts | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/gazelle/parse.go b/gazelle/parse.go index f905976..6f0134f 100644 --- a/gazelle/parse.go +++ b/gazelle/parse.go @@ -73,7 +73,7 @@ func compileJsImportPattern() *regexp.Regexp { return regexp.MustCompile(`(?m)` + strings.Join([]string{importPattern, requirePattern, exportPattern, jestMockPattern, dynamicImportPattern}, "|")) } -var jestTestPattern = regexp.MustCompile(`(?m)^it\(`) +var jestTestPattern = regexp.MustCompile(`(?m)^\s*it\(`) func parseCodeBlock(data []byte) ([]string, int, error) { diff --git a/tests/collect_all_test_shards/my_module/nested_module/a.test.ts b/tests/collect_all_test_shards/my_module/nested_module/a.test.ts index fab72ab..d0ed82b 100644 --- a/tests/collect_all_test_shards/my_module/nested_module/a.test.ts +++ b/tests/collect_all_test_shards/my_module/nested_module/a.test.ts @@ -4,8 +4,10 @@ it("should run a test", () => {}); it("should run a test", () => {}); it("should run a test", () => {}); it("should run a test", () => {}); -it("should run a test", () => {}); -it("should run a test", () => {}); -it("should run a test", () => {}); -it("should run a test", () => {}); -it("should run a test", () => {}); +describe('NodeSearch', () => { + it("should run a test", () => {}); + it("should run a test", () => {}); + it("should run a test", () => {}); + it("should run a test", () => {}); + it("should run a test", () => {}); +}