Skip to content

Commit

Permalink
fix isTestFile (#2147)
Browse files Browse the repository at this point in the history
  • Loading branch information
NullVoxPopuli authored May 21, 2024
1 parent 7975dd8 commit 6b07232
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/utils/ember.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,10 @@ function isModuleByFilePath(filePath, module) {
);
}

const validFileExtensions = ['js', 'ts', 'gjs', 'gts'];

function isTestFile(fileName) {
return fileName.endsWith('-test.js') || fileName.endsWith('-test.ts');
return validFileExtensions.some((ext) => fileName.endsWith(`-test.${ext}`));
}

function isMirageDirectory(fileName) {
Expand Down
2 changes: 2 additions & 0 deletions tests/lib/utils/ember-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ describe('isTestFile', () => {
it('detects test files', () => {
expect(emberUtils.isTestFile('some-test.js')).toBeTruthy();
expect(emberUtils.isTestFile('some-test.ts')).toBeTruthy();
expect(emberUtils.isTestFile('some-test.gjs')).toBeTruthy();
expect(emberUtils.isTestFile('some-test.gts')).toBeTruthy();
});

it('does not detect other files', () => {
Expand Down

0 comments on commit 6b07232

Please sign in to comment.