Repository URL to install this package:
|
Version:
4.0.0-alpha.8 ▾
|
export interface SetupOptions {
shouldUseJsdom?: boolean
shouldUseExotic?: boolean
shouldUseEnzyme?: boolean
shouldUseReactTestingLibrary?: boolean
/* only ever true :P */
shouldUseTypeScript?: true
shouldUseSonarQube?: boolean
shouldUseStoryBook?: boolean
}
// or could do `no-react`
const shouldUseReact = process.argv.slice(2).includes('--react')
export const DEFAULT_OPTIONS: SetupOptions = Object.freeze({
shouldUseJsdom: shouldUseReact,
shouldUseEnzyme: shouldUseReact,
shouldUseReactTestingLibrary: shouldUseReact,
shouldUseExotic: true,
shouldUseSonarQube: false,
shouldUseStoryBook: false,
})
export function setupTestFrameworkScript(options: SetupOptions) {
const mergedOptions = { ...DEFAULT_OPTIONS, ...options }
if (mergedOptions.shouldUseJsdom === true) {
require('./jsdom')
}
if (mergedOptions.shouldUseEnzyme === true) {
require('./enzyme')
}
if (mergedOptions.shouldUseReactTestingLibrary === true) {
require('./reactTestingLibrary')
}
if (mergedOptions.shouldUseReactTestingLibrary === true) {
require('./reactTestingLibrary')
}
if (mergedOptions.shouldUseExotic === true) {
require('./extendExotic')
}
if (mergedOptions.shouldUseStoryBook === true) {
console.warn('@todo shouldUseStoryBook was used, not implemented yet')
}
if (mergedOptions.shouldUseSonarQube === true) {
console.warn('shouldUseSonarQube was used, not implemented yet')
}
}