Skip to content

Commit

Permalink
Added .env support for running tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
thekevinbrown committed May 22, 2019
1 parent b618d6c commit 7f56e80
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 6 additions & 0 deletions src/cli/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 7f56e80

Please sign in to comment.