const Enzyme = require('enzyme'); const EnzymeAdapter = require('enzyme-adapter-react-16'); Enzyme.configure({ adapter: new EnzymeAdapter() }); import { shallow, mount } from 'enzyme'; import jasmineEnzyme from 'jasmine-enzyme'; import React from 'react'; import fetchPonyfill from 'fetch-ponyfill'; const {fetch, Request, Response, Headers} = fetchPonyfill({}); Object.assign(global, { jasmineEnzyme, mount, React, shallow, fetch, Request, Response, Headers }); beforeEach(() => { jasmineEnzyme(); }); // function to require all modules for a given context let requireAll = requireContext => { requireContext.keys().forEach(requireContext); }; // require all js files except testHelper.js in the test folder requireAll(require.context('./', true, /^((?!testHelper).)*\.jsx?$/)); // require all js files except main.js in the src folder requireAll(require.context('../../app/javascript', true, /^((?!application).)*\.jsx?$/)); // output to the browser's console when the tests run console.info(`TESTS RAN AT ${new Date().toLocaleTimeString()}`);