Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@skava/tests / src / jest / setupTestFrameworkScript.ts
Size: Mime:
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')
  }
}