Skip to content

Commit 4492c5c

Browse files
Tests: Test discovery should ignore unsupported file extensions (#2886)
1 parent 5315140 commit 4492c5c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tests/helper/test-discovery.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
const fs = require('fs');
44
const path = require('path');
55

6+
const SUPPORTED_TEST_FILE_EXT = new Set('.js', '.test');
67

78
module.exports = {
89

@@ -94,7 +95,8 @@ module.exports = {
9495
getAllFiles(src) {
9596
return fs.readdirSync(src)
9697
.filter(fileName => {
97-
return fs.statSync(path.join(src, fileName)).isFile();
98+
return SUPPORTED_TEST_FILE_EXT.has(path.extname(fileName))
99+
&& fs.statSync(path.join(src, fileName)).isFile();
98100
})
99101
.map(fileName => {
100102
return path.join(src, fileName);

0 commit comments

Comments
 (0)