Sha256: b5d247a4a9c1b8cca067b598f49d0449eec4c29bdf299a90972d6a3da98a4670

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

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()}`);

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
make_it_so-0.5.0 templates/rails/spec/javascript/testHelper.js