Skip to content
Snippets Groups Projects
Commit 96bc6173 authored by Jaden DIEFENBAUGH's avatar Jaden DIEFENBAUGH
Browse files

fixed testing! instrumentation only shows for files in src/ for some reason

parent ce5d6d6b
Branches
Tags
No related merge requests found
...@@ -20,11 +20,11 @@ module.exports = function (config) { ...@@ -20,11 +20,11 @@ module.exports = function (config) {
frameworks: ['mocha'], frameworks: ['mocha'],
// this is the entry file for all our tests. // this is the entry file for all our tests.
files: [ files: [
'./test/index.js' './test/index.js',
], ],
// we will pass the entry file to webpack for bundling. // we will pass the entry file to webpack for bundling.
preprocessors: { preprocessors: {
'./test/index.js': [ 'webpack', 'sourcemap' ], '**/*': [ 'webpack', 'sourcemap' ],
}, },
reporters: [ reporters: [
'mocha', 'mocha',
......
...@@ -6,8 +6,8 @@ import React from 'react'; ...@@ -6,8 +6,8 @@ import React from 'react';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import { Provider } from 'react-redux'; import { Provider } from 'react-redux';
import { AppContainer } from 'react-hot-loader'; import { AppContainer } from 'react-hot-loader';
import App from './components/App.jsx'; import App from './src/components/App.jsx';
import store from './store'; import store from '@store';
ReactDOM.render( ReactDOM.render(
<AppContainer> <AppContainer>
...@@ -20,8 +20,8 @@ ReactDOM.render( ...@@ -20,8 +20,8 @@ ReactDOM.render(
// Hot Module Replacement API // Hot Module Replacement API
if (module.hot) { if (module.hot) {
module.hot.accept('./components/App', () => { module.hot.accept('./src/components/App', () => {
const NextApp = require('./components/App').default; const NextApp = require('./src/components/App').default;
ReactDOM.render( ReactDOM.render(
<AppContainer> <AppContainer>
<Provider store={ store }> <Provider store={ store }>
......
...@@ -21,6 +21,10 @@ class Foo extends React.Component<FooProps, FooState> { ...@@ -21,6 +21,10 @@ class Foo extends React.Component<FooProps, FooState> {
); );
} }
isntCovered = () => {
console.log(`mauahahahahah`);
}
componentDidMount(){} componentDidMount(){}
} }
......
import { configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
configure({ adapter: new Adapter() });
// require all test files using special Webpack feature // require all test files using special Webpack feature
// https://webpack.js.org/guides/dependency-management/#require-context // https://webpack.js.org/guides/dependency-management/#require-context
const testsContext = require.context('.', true, /\.spec.js(x)?$/); const testsContext = require.context('.', true, /\.spec.js(x)?$/);
......
// @flow // @flow
import React from 'react'; import React from 'react';
import { expect } from 'chai'; import { expect } from 'chai';
import { configure, mount } from 'enzyme'; import { mount } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import sinon from 'sinon'; import sinon from 'sinon';
import Foo from './Foo.jsx'; import Foo from '../src/Foo.jsx';
configure({ adapter: new Adapter() });
describe('<Foo />', () => { describe('<Foo />', () => {
it('calls componentDidMount', () => { it('calls componentDidMount', () => {
......
...@@ -14,7 +14,7 @@ module.exports = { ...@@ -14,7 +14,7 @@ module.exports = {
main: [ main: [
'react-hot-loader/patch', 'react-hot-loader/patch',
// all our code starts here // all our code starts here
'./src/main.jsx', './main.jsx',
] ]
}, },
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment