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 / dist / jest / setupTestFrameworkScript.js
Size: Mime:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// or could do `no-react`
const shouldUseReact = process.argv.slice(2).includes('--react');
exports.DEFAULT_OPTIONS = Object.freeze({
    shouldUseJsdom: shouldUseReact,
    shouldUseEnzyme: shouldUseReact,
    shouldUseReactTestingLibrary: shouldUseReact,
    shouldUseRequestAnimationFrame: shouldUseReact,
    shouldExtendExpectWithDocumentObjectModel: shouldUseReact,
    shouldUseExotic: true,
    shouldUseSonarQube: false,
    shouldUseStoryBook: false,
});
function setupTestFrameworkScript(options) {
    const mergedOptions = Object.assign({}, exports.DEFAULT_OPTIONS, options);
    // console.log({ mergedOptions })
    if (mergedOptions.shouldUseRequestAnimationFrame === true) {
        // console.debug('[tests] requiring raf')
        // In tests, polyfill requestAnimationFrame since jsdom doesn't provide it yet.
        // We don't polyfill it in the browser--this is user's responsibility.
        require('raf').polyfill(global);
        // console.debug('[tests] required raf')
    }
    if (mergedOptions.shouldUseEnzyme === true) {
        // console.debug('[tests] requiring enzyme')
        require('./enzyme');
        // console.debug('[tests] required enzyme')
    }
    if (mergedOptions.shouldExtendExpectWithDocumentObjectModel === true) {
        // console.debug('[tests] requiring extendDocumentObjectModel')
        require('./extendDocumentObjectModel');
        // console.debug('[tests] required extendDocumentObjectModel')
    }
    if (mergedOptions.shouldUseReactTestingLibrary === true) {
        // console.debug('[tests] requiring reactTestingLibrary')
        require('./reactTestingLibrary');
        // console.debug('[tests] required reactTestingLibrary')
    }
    // has to be after test lib, since it is bad on window
    if (mergedOptions.shouldUseJsdom === true) {
        // console.debug('[tests] requiring jest')
        require('./jsdom');
        // console.debug('[tests] required jest')
    }
    if (mergedOptions.shouldUseExotic === true) {
        // console.debug('[tests] requiring extendExotic')
        require('./extendExotic');
        // console.debug('[tests] required 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');
    }
}
exports.setupTestFrameworkScript = setupTestFrameworkScript;
//# sourceMappingURL=setupTestFrameworkScript.js.map