Skip to content

Commit

Permalink
tests: fix git pull not knowing repo when setting up tests
Browse files Browse the repository at this point in the history
  • Loading branch information
demarketed committed Aug 8, 2024
1 parent c088e33 commit 89fd367
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions test/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,22 @@ import { execSync } from 'node:child_process';
import { exit } from 'node:process';

const wptRepo = 'https://github.com/web-platform-tests/wpt.git';
const branch = 'master';
const testDir = dirname(fileURLToPath(import.meta.url));
const packageDir = resolve(testDir, '..');

console.log(`Cloning repo: ${wptRepo}`);

if (existsSync(resolve(packageDir, 'test/wpt'))) {
console.log(`Directory test/wpt already exists, pulling changes`);
execSync(`git pull --ff-only`, { cwd: resolve(packageDir, 'test/wpt') });
execSync(`git pull --ff-only ${wptRepo} ${branch}`, {
cwd: resolve(packageDir, 'test/wpt'),
});
console.log('Successfully pulled changes');
exit(0);
}

execSync(`git clone --depth 1 --branch master --single-branch ${wptRepo}`, {
execSync(`git clone --depth 1 --branch ${branch} --single-branch ${wptRepo}`, {
cwd: testDir,
});
console.log('Successfully cloned repo');
Expand Down

0 comments on commit 89fd367

Please sign in to comment.