Skip to content
This repository has been archived by the owner on Jul 8, 2024. It is now read-only.

Commit

Permalink
fix: env test added
Browse files Browse the repository at this point in the history
  • Loading branch information
JamilOmar committed Mar 17, 2020
1 parent 4e9babe commit 94ab0ca
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions test/configuration-folder/config/default.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
module.exports = {
test: 'test from folder',
var: process.env.TEST_VAR,
};
1 change: 1 addition & 0 deletions test/configuration-folder/config/test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
module.exports = {
test: 'test from folder with test config',
var: process.env.TEST_VAR,
};
12 changes: 11 additions & 1 deletion test/lib/unit/cli/init_spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {initConfig} from '../../../../lib/cli';
import * as path from 'path';

process.env.TEST_VAR = 'TEST_VAR';
describe('.start()', () => {
afterEach(() => {
delete global.LabShare;
Expand Down Expand Up @@ -36,4 +36,14 @@ describe('.start()', () => {
expect(config).toBeDefined();
expect(config.test).toEqual('test from folder with test config');
});
it('tests the init command with a configuration folder with test settings and correct env vars', async () => {
const cwd = path.join(process.cwd(), 'test', 'configuration-folder');
const config: any = initConfig({
cwd,
configuration: 'test',
});
expect(config).toBeDefined();
expect(config.test).toEqual('test from folder with test config');
expect(config.var).toEqual('TEST_VAR');
});
});

0 comments on commit 94ab0ca

Please sign in to comment.