-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reading configs from .env with dotenv #16
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
JEST_TEST_GEN_FILESUFFIX=".spec" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,7 @@ lib/ | |
jasmine-unit-test-generator-*.tgz | ||
.npmrc | ||
.DS_Store | ||
.env | ||
.yarn | ||
**/yarn-error.log | ||
**/yarn.lock |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
export const MOCK_MODULES_BLACKLIST = ['react', 'prop-types', 'styled-components']; | ||
export const IMPORT_MODULES_BLACKLIST = ['prop-types', 'styled-components']; | ||
export const FILE_SUFFIX = process.env.JEST_TEST_GEN_FILESUFFIX; | ||
export const MOCK_MODULES_BLACKLIST = [ | ||
'react', | ||
'prop-types', | ||
'styled-components', | ||
]; | ||
export const IMPORT_MODULES_BLACKLIST = ['prop-types', 'styled-components']; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ import * as ts from 'typescript'; | |
import { parseSourceFile } from './parse-source-file'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think here the should be an import of
|
||
import { generateUnitTest } from './generate-unit-test'; | ||
import * as minimist from 'minimist'; | ||
import { FILE_SUFFIX } from './constants'; | ||
|
||
type TRunOptions = { | ||
returnOutput?: boolean | ||
|
@@ -32,7 +33,7 @@ export function run(args: minimist.ParsedArgs, opts?: TRunOptions) { | |
finalOutputDir = path.resolve(finalOutputDir, args.outputDir); | ||
} | ||
} | ||
let fileSuffix = '.generated.test'; | ||
let fileSuffix = FILE_SUFFIX; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please keep the default and if specified, override with the let fileSuffix = '.generated.test';
if (process.env.JEST_TEST_GEN_FILESUFFIX) {
fileSuffix = process.env.JEST_TEST_GEN_FILESUFFIX;
}
if (args.fileSuffix) {
fileSuffix = args.fileSuffix;
} |
||
if (args.fileSuffix) { | ||
fileSuffix = args.fileSuffix; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,4 +27,4 @@ | |
"dom" | ||
] | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not a constant, it is a configuration, no need to read the config inside this file, it can be done in main.ts