diff --git a/.vscode/settings.json b/.vscode/settings.json index a326c24..b811ff0 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -23,5 +23,5 @@ "editor.formatOnPaste": false, "editor.formatOnType": false, "editor.formatOnSave": true, - "workbench.colorTheme": "FireFly Pro Bright" + "workbench.colorTheme": "Sublime Material Theme - Light" } diff --git a/dist/index.js b/dist/index.js index a3ceb63..53b5397 100644 --- a/dist/index.js +++ b/dist/index.js @@ -338,6 +338,8 @@ const npmInstallAction = async () => { // From: https://github.com/actions/cache/blob/a2ed59d39b352305bdd2f628719a53b2cc4f9613/src/saveImpl.ts#L96 if (process.env.NODE_ENV !== 'test') { process.exit(0) + } else { + core.debug('skip process.exit(0) in test mode') } } catch (err) { console.error(err) diff --git a/index.js b/index.js index 259155c..e0f1f0f 100644 --- a/index.js +++ b/index.js @@ -331,6 +331,8 @@ const npmInstallAction = async () => { // From: https://github.com/actions/cache/blob/a2ed59d39b352305bdd2f628719a53b2cc4f9613/src/saveImpl.ts#L96 if (process.env.NODE_ENV !== 'test') { process.exit(0) + } else { + core.debug('skip process.exit(0) in test mode') } } catch (err) { console.error(err) diff --git a/package.json b/package.json index 96d1b95..477c447 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "scripts": { "format": "prettier --write './**/*'", "format:check": "prettier --check './**/*'", - "test": "NODE_ENV=test npm run unit", + "test": "npm run unit", "unit": "mocha test/helper 'test/*spec.js'", "pretest": "npm run build", "build": "ncc build -o dist index.js", diff --git a/test/helper.js b/test/helper.js index 5976797..d68bd9b 100644 --- a/test/helper.js +++ b/test/helper.js @@ -1,3 +1,6 @@ +// https://github.com/bahmutov/npm-install/pull/228 +process.env.NODE_ENV = 'test' + // following guide // https://glebbahmutov.com/blog/mocha-and-sinon/ const chai = require('chai')