Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ jobs:
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@a37ce9120846195fa4ece8f58b268e6043cb2f26 # v3.7.0
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610 # v3.9.1
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
Expand Down
19 changes: 14 additions & 5 deletions test/test-integration.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ describe('integration tests', { timeout: 12 * 60 * 1000 }, () => {
await checkAudit(runResult.env.cwd);

//console.log('command-ts with test: Running extension compile');
const res2 = await doSpawn(npmCommand, ['run', 'test'], { cwd: runResult.env.cwd, shell: true });
const res2 = await doSpawnWithNetworkRetry(npmCommand, ['run', 'test'], { cwd: runResult.env.cwd, shell: true });
if (res2.exitCode !== 0) {
assert.fail(`npm run test failed: stdout ${res2.stdout} stderr ${res2.stderr}`);
}
Expand Down Expand Up @@ -94,7 +94,7 @@ describe('integration tests', { timeout: 12 * 60 * 1000 }, () => {
await checkAudit(runResult.env.cwd);

//console.log('command-ts-webpack with test: Running extension compile');
const res2 = await doSpawn(npmCommand, ['run', 'test'], { cwd: runResult.env.cwd, shell: true });
const res2 = await doSpawnWithNetworkRetry(npmCommand, ['run', 'test'], { cwd: runResult.env.cwd, shell: true });
if (res2.exitCode !== 0) {
assert.fail(`npm run compile failed: stdout ${res2.stdout} stderr ${res2.stderr}`);
}
Expand Down Expand Up @@ -124,7 +124,7 @@ describe('integration tests', { timeout: 12 * 60 * 1000 }, () => {
await checkAudit(runResult.env.cwd);

//console.log('command-ts-esbuild with test: Running extension compile');
const res2 = await doSpawn(npmCommand, ['run', 'test'], { cwd: runResult.env.cwd, shell: true });
const res2 = await doSpawnWithNetworkRetry(npmCommand, ['run', 'test'], { cwd: runResult.env.cwd, shell: true });
if (res2.exitCode !== 0) {
assert.fail(`npm run compile failed: stdout ${res2.stdout} stderr ${res2.stderr}`);
}
Expand Down Expand Up @@ -154,7 +154,7 @@ describe('integration tests', { timeout: 12 * 60 * 1000 }, () => {
await checkAudit(runResult.env.cwd);

//console.log('command-ts-web with test: Running extension compile-web');
const res2 = await doSpawn(npmCommand, ['run', 'test'], { cwd: runResult.env.cwd, shell: true });
const res2 = await doSpawnWithNetworkRetry(npmCommand, ['run', 'test'], { cwd: runResult.env.cwd, shell: true });
if (res2.exitCode !== 0) {
assert.fail(`npm run test failed: stdout ${res2.stdout} stderr ${res2.stderr}`);
}
Expand Down Expand Up @@ -184,7 +184,7 @@ describe('integration tests', { timeout: 12 * 60 * 1000 }, () => {
await checkAudit(runResult.env.cwd);

//console.log('command-ts-web with test: Running extension compile-web');
const res2 = await doSpawn(npmCommand, ['run', 'test'], { cwd: runResult.env.cwd, shell: true });
const res2 = await doSpawnWithNetworkRetry(npmCommand, ['run', 'test'], { cwd: runResult.env.cwd, shell: true });
if (res2.exitCode !== 0) {
assert.fail(`npm run test failed: stdout ${res2.stdout} stderr ${res2.stderr}`);
}
Expand Down Expand Up @@ -213,3 +213,12 @@ async function doSpawn(execName, allArguments, options) {
});
}

async function doSpawnWithNetworkRetry(execName, allArguments, options) {
for (let attempt = 1; attempt <= 3; attempt++) {
const result = await doSpawn(execName, allArguments, options);
if (result.exitCode === 0 || !/ETIMEDOUT/.test(`${result.stdout}\n${result.stderr}`) || attempt === 3) {
return result;
}
await new Promise(resolve => setTimeout(resolve, 1000));
}
}
Loading