Skip to content

Commit

Permalink
feat: filter out integ tests of the the same name
Browse files Browse the repository at this point in the history
  • Loading branch information
mrgrain committed Jan 4, 2023
1 parent 2b3bd0b commit 3a6057c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,11 @@ export class IntegrationTests {
fileName,
appCommand,
})),
);
)
// Remove tests with duplicate names, giving precedence in lexicographic order
// Which ensures precedence of compiled .js files over their .ts source
.sort((a, b) => a.testName.localeCompare(b.testName))
.filter((a, idx, allTests) => allTests.findIndex(b => (b.testName === a.testName)) === idx);

return this.filterTests(discoveredTests, options.tests, options.exclude);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,19 @@ describe('IntegrationTests Discovery', () => {
});
});
});

describe('Same test file in JS and TS is only running JS', () => {
const cliOptions = {
language: ['javascript', 'typescript'],
};

test('find only JS files', async () => {
const integTests = await tests.fromCliOptions(cliOptions);

expect(integTests.length).toEqual(3);
expect(integTests[0].fileName).toEqual(expect.stringMatching(new RegExp('^.*test1\\.js$')));
expect(integTests[1].fileName).toEqual(expect.stringMatching(new RegExp('^.*test2\\.js$')));
expect(integTests[2].fileName).toEqual(expect.stringMatching(new RegExp('^.*test3\\.js$')));
});
});
});

0 comments on commit 3a6057c

Please sign in to comment.