Skip to content

Commit

Permalink
Fix test parsing regex
Browse files Browse the repository at this point in the history
Looking for 'it' statements should not be sensitive to whitespace
  • Loading branch information
ColinHeathman committed Sep 11, 2023
1 parent 2a939fd commit d1d7997
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion gazelle/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Expand Down
12 changes: 7 additions & 5 deletions tests/collect_all_test_shards/my_module/nested_module/a.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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", () => {});
}

0 comments on commit d1d7997

Please sign in to comment.