Ignore Electron download skip flag during startup
Template tests / tests (push) Failing after 15s

This commit is contained in:
Iisyourdad
2026-06-10 19:34:00 -05:00
parent a94f262565
commit e20af548a0
3 changed files with 39 additions and 21 deletions
+14 -1
View File
@@ -49,14 +49,22 @@ test('repairs a broken Electron install before resolving the binary', (t) => {
[
"const fs = require('node:fs');",
"const path = require('node:path');",
"if (process.env.ELECTRON_SKIP_BINARY_DOWNLOAD) process.exit(2);",
"fs.mkdirSync(path.join(__dirname, 'dist'), { recursive: true });",
"fs.writeFileSync(path.join(__dirname, 'dist', 'electron.exe'), 'binary');",
"fs.writeFileSync(path.join(__dirname, 'path.txt'), 'electron.exe');",
].join('\n')
);
const originalSkip = process.env.ELECTRON_SKIP_BINARY_DOWNLOAD;
process.env.ELECTRON_SKIP_BINARY_DOWNLOAD = '1';
t.after(() => {
if (originalSkip === undefined) delete process.env.ELECTRON_SKIP_BINARY_DOWNLOAD;
else process.env.ELECTRON_SKIP_BINARY_DOWNLOAD = originalSkip;
});
assert.equal(
repairElectronInstall({ packageRoot: root, platform: 'win32' }),
repairElectronInstall({ packageRoot: root }),
true
);
assert.equal(
@@ -76,6 +84,7 @@ test('rebuilds Electron through npm when the binary is missing', (t) => {
[
"const fs = require('node:fs');",
"const path = require('node:path');",
"if (process.env.ELECTRON_SKIP_BINARY_DOWNLOAD) process.exit(2);",
"fs.mkdirSync(path.join(__dirname, 'dist'), { recursive: true });",
"fs.writeFileSync(path.join(__dirname, 'dist', 'electron.exe'), 'binary');",
"fs.writeFileSync(path.join(__dirname, 'path.txt'), 'electron.exe');",
@@ -84,13 +93,17 @@ test('rebuilds Electron through npm when the binary is missing', (t) => {
const originalNpmExecPath = process.env.npm_execpath;
const originalNpmNodeExecPath = process.env.npm_node_execpath;
const originalSkip = process.env.ELECTRON_SKIP_BINARY_DOWNLOAD;
process.env.npm_execpath = fakeNpmCli;
process.env.npm_node_execpath = process.execPath;
process.env.ELECTRON_SKIP_BINARY_DOWNLOAD = '1';
t.after(() => {
if (originalNpmExecPath === undefined) delete process.env.npm_execpath;
else process.env.npm_execpath = originalNpmExecPath;
if (originalNpmNodeExecPath === undefined) delete process.env.npm_node_execpath;
else process.env.npm_node_execpath = originalNpmNodeExecPath;
if (originalSkip === undefined) delete process.env.ELECTRON_SKIP_BINARY_DOWNLOAD;
else process.env.ELECTRON_SKIP_BINARY_DOWNLOAD = originalSkip;
});
assert.equal(