|
1 | 1 | import createTestCafe, { ClientFunction } from 'testcafe'; |
2 | 2 | import * as fs from 'fs'; |
3 | | -import * as path from 'path'; |
4 | 3 | import * as process from 'process'; |
5 | 4 | import parseArgs from 'minimist'; |
6 | 5 | import { globSync } from 'glob'; |
@@ -150,6 +149,7 @@ createTestCafe(TESTCAFE_CONFIG) |
150 | 149 | const reporter = typeof args.reporter === 'string' ? args.reporter.trim() : args.reporter; |
151 | 150 | const indices = args.indices.trim(); |
152 | 151 | let componentFolder = args.componentFolder.trim(); |
| 152 | + const pathRE = new RegExp(`./tests/${componentFolder ? `${componentFolder}/` : ''}(.*).ts`); |
153 | 153 | const file = args.file.trim(); |
154 | 154 |
|
155 | 155 | setTestingPlatform(args); |
@@ -198,14 +198,14 @@ createTestCafe(TESTCAFE_CONFIG) |
198 | 198 | /* eslint-enable no-console */ |
199 | 199 |
|
200 | 200 | const targetBaseNames = new Set( |
201 | | - targetFixtureChunk.map((filePath) => path.basename(filePath)), |
| 201 | + targetFixtureChunk.map((filePath) => pathRE.exec(filePath)?.[1]), |
202 | 202 | ); |
203 | 203 |
|
204 | 204 | filters.push(( |
205 | 205 | _testName: string, |
206 | 206 | _fixtureName: string, |
207 | 207 | fixturePath: string, |
208 | | - ) => targetBaseNames.has(path.basename(fixturePath))); |
| 208 | + ) => targetBaseNames.has(pathRE.exec(fixturePath)?.[1])); |
209 | 209 | } |
210 | 210 |
|
211 | 211 | if (testName) { |
@@ -274,6 +274,7 @@ createTestCafe(TESTCAFE_CONFIG) |
274 | 274 | process.exit(failedCount); |
275 | 275 | }) |
276 | 276 | .catch((error: Error) => { |
| 277 | + // eslint-disable-next-line no-console |
277 | 278 | console.error('TestCafe execution failed:', error); |
278 | 279 | if (testCafe) { |
279 | 280 | testCafe.close(); |
|
0 commit comments