Skip to content

Commit 729433a

Browse files
authored
Merge pull request #26 from bocoup/graceful-exit-on-install-test
Graceful exit if install script detects installation
2 parents 8f79e08 + e75f644 commit 729433a

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
"scripts": {
77
"prettier": "prettier --write shared test",
88
"test": "npm run test-style && npm run test-types && npm run test-unit",
9-
"test-macos-key-press": "mocha --ui tdd test/test-macos-key-press.js",
9+
"test-macos-key-press": "mocha --ui tdd --timeout 5000 test/test-macos-key-press.js",
1010
"test-style": "prettier --check shared test",
1111
"test-types": "tsc -p tsconfig.json",
12-
"test-unit": "mocha --ui tdd test/test.js test/helpers/**/*.js"
12+
"test-unit": "mocha --ui tdd --timeout 5000 test/test.js test/helpers/**/*.js"
1313
},
1414
"author": "",
1515
"license": "MIT",

shared/commands/install.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,5 @@ module.exports = /** @type {import('yargs').CommandModule} */ ({
1717
win32: () => require('../install/win32'),
1818
});
1919
await installDelegate.install({ unattended });
20-
21-
console.log('Installation completed successfully.');
2220
},
2321
});

shared/install/macos.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,14 @@ exports.install = async function ({ unattended }) {
103103
}
104104

105105
if (await isInstalled()) {
106-
throw new Error('Already installed');
106+
return console.log('Already installed.');
107107
}
108108

109109
await removeQuarantine(options);
110110
await registerExtensions(options);
111111
await enableExtension();
112112
await setSystemVoice(VOICE_IDENTIFIER);
113+
console.log('Installation completed successfully.');
113114
};
114115

115116
/**

shared/install/win32.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const MAKE_VOICE_EXE = 'MakeVoice.exe';
1010

1111
exports.install = async function () {
1212
await exec(`${MAKE_VOICE_EXE}`, await getExecOptions());
13+
console.log('Installation completed successfully.');
1314
};
1415

1516
exports.uninstall = async function () {

0 commit comments

Comments
 (0)