diff --git a/package-lock.json b/package-lock.json index 4a6aebd..c8012dd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -547,6 +547,11 @@ "nodeify-ts": "1.0.6" } }, + "dotenv": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.0.0.tgz", + "integrity": "sha512-30xVGqjLjiUOArT4+M5q9sYdvuR4riM6yK9wMcas9Vbp6zZa+ocC9dp6QoftuhTPhFAiLK/0C5Ni2nou/Bk8lg==" + }, "ecurve": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/ecurve/-/ecurve-1.0.6.tgz", diff --git a/package.json b/package.json index 48e7f95..c0404d8 100644 --- a/package.json +++ b/package.json @@ -68,6 +68,7 @@ "commander": "2.20.0", "deep-equal-in-any-order": "1.0.13", "docker-cli-js": "2.5.2", + "dotenv": "8.0.0", "glob": "7.1.4", "mkdirp": "0.5.1", "mocha": "6.1.4", diff --git a/src/cli/utils.ts b/src/cli/utils.ts index 2570a08..425c57b 100644 --- a/src/cli/utils.ts +++ b/src/cli/utils.ts @@ -248,6 +248,12 @@ export const runTests = async () => { if (await exists(path.join(WORKING_DIRECTORY, 'tsconfig.json'))) { require('ts-mocha'); } + + // Register their .env file variables if they have one. + if (await exists(path.join(WORKING_DIRECTORY, '.env'))) { + require('dotenv').config({ path: path.join(WORKING_DIRECTORY, '.env') }); + } + // Find all existing test file paths const files = [ // All ts and js files under the test folder get added.