Skip to content

Commit

Permalink
fix: manually resolve absolute file paths with __dirname
Browse files Browse the repository at this point in the history
This avoids different drive letters on Windows (e.g. `C:\` vs `c:\`).
  • Loading branch information
byCedric committed Sep 3, 2023
1 parent a610842 commit 7f4951e
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions test/mocha/vscode-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,22 @@ export async function run() {

// Find all test files
const files = await glob('**/__tests__/**/*.{e2e,test}.{js,ts}', {
absolute: true,
// absolute: true, // Avoid using glob's absolute paths, Windows drive letters may be different cased
cwd: path.resolve(__dirname, '../../src'),
ignore: 'node_modules/**',
});

// Check for test pattern
const testPattern = process.env.VSCODE_EXPO_TEST_PATTERN;

// Add all tests
for (const file of files) {
if (!testPattern || file.includes(testPattern)) {
tests.addFile(file);
}
}
// Add all tests, or only the ones matching the pattern
files
.map((file) => path.resolve(__dirname, '../../src', file))
.forEach((file) => {
if (!testPattern || file.includes(testPattern)) {
tests.addFile(file);
}
});

// Execute the tests
return new Promise<void>((resolve, reject) => {
Expand Down

0 comments on commit 7f4951e

Please sign in to comment.