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
7 changes: 5 additions & 2 deletions src/renderer/setup-steps.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@ function computeSetupStepState(flags = {}) {
// node_modules existing is not evidence the install succeeded: a failed
// install leaves a partial one behind, and treating that as a completed
// step disabled the retry and unlocked a build that could not work (#42).
// The recorded outcome of the last install run overrides existence.
const installOk = hasNodeModules && !installFailed;
// The recorded outcome of the last install run overrides existence. So
// does an install still running: a status refresh mid-install (switching
// back to the window is enough) sees a half-written node_modules, and
// read it as done, with the build unlocked over it (#495).
const installOk = hasNodeModules && !installFailed && !installing;

return {
download: {
Expand Down
11 changes: 11 additions & 0 deletions tests/unit/setup-steps.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,17 @@ test('an install in flight disables its own button', () => {
assert.strictEqual(steps.install.done, false);
});

// A status refresh mid-install sees a half-written node_modules. That is not
// "installed", and the build must stay locked until npm exits (#495).
test('a half-written node_modules during an install does not complete the step', () => {
const steps = computeSetupStepState({ hasNodeModules: true, installing: true });

assert.strictEqual(steps.install.done, false);
assert.strictEqual(steps.install.disabled, true);
assert.strictEqual(steps.build.ready, false);
assert.strictEqual(steps.build.disabled, true);
});

test('installed dependencies complete the install step and unlock the build', () => {
const steps = computeSetupStepState({ hasNodeModules: true });

Expand Down
Loading