-
Notifications
You must be signed in to change notification settings - Fork 752
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
setup working karma jasmine enzyme test toolchain for our react app
- Loading branch information
Showing
12 changed files
with
968 additions
and
938 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[ignore] | ||
|
||
[include] | ||
|
||
[libs] | ||
|
||
[lints] | ||
|
||
[options] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
52 changes: 0 additions & 52 deletions
52
client/app/bundles/HelloWorld/components/__test__/Chart.test.jsx
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
client/app/bundles/HelloWorld/components/__test__/HelloWorld.test.jsx
This file was deleted.
Oops, something went wrong.
25 changes: 0 additions & 25 deletions
25
client/app/bundles/HelloWorld/components/__test__/__snapshots__/HelloWorld.test.jsx.snap
This file was deleted.
Oops, something went wrong.
11 changes: 11 additions & 0 deletions
11
client/app/bundles/HelloWorld/components/__tests__/Chart.spec.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import React from 'react'; | ||
import Chart from '../Chart'; | ||
import { render } from 'enzyme'; | ||
|
||
describe('Chart', () => { | ||
it("renders a Chart", () => { | ||
expect(() => { | ||
render(<Chart />); | ||
}).not.toThrow(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
import ReactOnRails from 'react-on-rails'; | ||
|
||
import HelloWorld from '../components/HelloWorld'; | ||
import Chart from '../components/Chart'; | ||
|
||
// This is how react_on_rails can see the HelloWorld in the browser. | ||
ReactOnRails.register({ | ||
HelloWorld, | ||
Chart | ||
Chart, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// karma.conf.js | ||
var webpackConfig = require('./webpack.config'); | ||
const webpack = require('webpack'); | ||
|
||
webpackConfig.plugins = [ | ||
new webpack.EnvironmentPlugin({ | ||
NODE_ENV: 'development', // use 'development' unless process.env.NODE_ENV is defined | ||
DEBUG: false, | ||
}), | ||
]; | ||
webpackConfig.devtool = 'eval-source-map'; | ||
|
||
// https://github.com/airbnb/enzyme/blob/master/docs/guides/webpack.md#react-15-compatibility | ||
webpackConfig.externals = { | ||
'react/addons': true, | ||
'react/lib/ExecutionEnvironment': true, | ||
'react/lib/ReactContext': true, | ||
'react-addons-test-utils': 'react-dom', | ||
}; | ||
|
||
module.exports = function (config) { | ||
config.set({ | ||
browsers: ['PhantomJS'], | ||
singleRun: true, | ||
frameworks: ['jasmine'], | ||
files: [ | ||
{ pattern: 'app/**/*.spec.jsx', watched: true }, | ||
], | ||
preprocessors: { | ||
'app/**/*.jsx': ['webpack', 'sourcemap'] | ||
}, | ||
reporters: ['dots'], | ||
webpack: webpackConfig, | ||
webpackServer: { | ||
noInfo: true | ||
} | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.