Skip to content

Commit

Permalink
Switch mocha to jest (#768)
Browse files Browse the repository at this point in the history
This commit replaces mocha with jest. Also this commit removes
dependency on babel-plugin-webpack-loaders plugin because of
the following reasons:
1. It seems that the author deprecated and abandoned this plugin
and he suggests not to use it and to use mocks and native test utilities
tools instead.
2. This plugin conflicts with webpack 2 and because of the reason one
it is unlikely that it will ever support it.

In order to remove dependency on the aforementioned plugin and
keep using css modules in the same time the following trick is used:
All components that need to be selected in the end-to-end test receive
data-tid (TestID) and data-tclass (TestCLASS) properties. It is necessary
because without running webpack we cannot use class names to select
components because we do not know what class names css loader
actually generates for us.
  • Loading branch information
akozhemiakin authored and amilajack committed Feb 23, 2017
1 parent 6a0c7f3 commit a76aef2
Show file tree
Hide file tree
Showing 29 changed files with 2,825 additions and 1,070 deletions.
5 changes: 0 additions & 5 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@
"tcomb"
],
"presets": ["react-hmre"]
},
"test": {
"plugins": [
["webpack-loaders", { "config": "webpack.config.test.js", "verbose": false }]
]
}
}
}
1 change: 0 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"extends": "airbnb",
"env": {
"browser": true,
"mocha": true,
"node": true
},
"rules": {
Expand Down
12 changes: 6 additions & 6 deletions app/components/Counter.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,23 @@ class Counter extends Component {
const { increment, incrementIfOdd, incrementAsync, decrement, counter } = this.props;
return (
<div>
<div className={styles.backButton}>
<div className={styles.backButton} data-tid="backButton">
<Link to="/">
<i className="fa fa-arrow-left fa-3x" />
</Link>
</div>
<div className={`counter ${styles.counter}`}>
<div className={`counter ${styles.counter}`} data-tid="counter">
{counter}
</div>
<div className={styles.btnGroup}>
<button className={styles.btn} onClick={increment}>
<button className={styles.btn} onClick={increment} data-tclass="btn">
<i className="fa fa-plus" />
</button>
<button className={styles.btn} onClick={decrement}>
<button className={styles.btn} onClick={decrement} data-tclass="btn">
<i className="fa fa-minus" />
</button>
<button className={styles.btn} onClick={incrementIfOdd}>odd</button>
<button className={styles.btn} onClick={() => incrementAsync()}>async</button>
<button className={styles.btn} onClick={incrementIfOdd} data-tclass="btn">odd</button>
<button className={styles.btn} onClick={() => incrementAsync()} data-tclass="btn">async</button>
</div>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion app/components/Home.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default class Home extends Component {
render() {
return (
<div>
<div className={styles.container}>
<div className={styles.container} data-tid="container">
<h2>Home</h2>
<Link to="/counter">to Counter</Link>
</div>
Expand Down
32 changes: 32 additions & 0 deletions flow-typed/npm/babel-jest_vx.x.x.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// flow-typed signature: 01c85564efc84f822c42f28a77800358
// flow-typed version: <<STUB>>/babel-jest_v^19.0.0/flow_v0.38.0

/**
* This is an autogenerated libdef stub for:
*
* 'babel-jest'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/

declare module 'babel-jest' {
declare module.exports: any;
}

/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'babel-jest/build/index' {
declare module.exports: any;
}

// Filename aliases
declare module 'babel-jest/build/index.js' {
declare module.exports: $Exports<'babel-jest/build/index'>;
}
4 changes: 2 additions & 2 deletions flow-typed/npm/babili-webpack-plugin_vx.x.x.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// flow-typed signature: dd11e7daf8501c3bf043b281ccdd37c8
// flow-typed version: <<STUB>>/babili-webpack-plugin_v^0.0.7/flow_v0.38.0
// flow-typed signature: e6e9cdb1c754cb97a878b539ba92c293
// flow-typed version: <<STUB>>/babili-webpack-plugin_v^0.0.9/flow_v0.38.0

/**
* This is an autogenerated libdef stub for:
Expand Down
4 changes: 2 additions & 2 deletions flow-typed/npm/boiler-room-custodian_vx.x.x.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// flow-typed signature: 183d34cdcae86fbeb0027012bc97e208
// flow-typed version: <<STUB>>/boiler-room-custodian_v^0.5.0/flow_v0.38.0
// flow-typed signature: a248d9570870757b58348e94abaffb93
// flow-typed version: <<STUB>>/boiler-room-custodian_v^0.6.1/flow_v0.38.0

/**
* This is an autogenerated libdef stub for:
Expand Down
9 changes: 1 addition & 8 deletions flow-typed/npm/concurrently_vx.x.x.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// flow-typed signature: f8838b348d7dfeed23f3057c5f2956b9
// flow-typed signature: ddfd558457edd9123b15e7195206a9e2
// flow-typed version: <<STUB>>/concurrently_v^3.1.0/flow_v0.38.0

/**
Expand Down Expand Up @@ -26,10 +26,6 @@ declare module 'concurrently/src/main' {
declare module.exports: any;
}

declare module 'concurrently/test' {
declare module.exports: any;
}

declare module 'concurrently/test/support/signal' {
declare module.exports: any;
}
Expand All @@ -46,9 +42,6 @@ declare module 'concurrently/test/utils' {
declare module 'concurrently/src/main.js' {
declare module.exports: $Exports<'concurrently/src/main'>;
}
declare module 'concurrently/test.js' {
declare module.exports: $Exports<'concurrently/test'>;
}
declare module 'concurrently/test/support/signal.js' {
declare module.exports: $Exports<'concurrently/test/support/signal'>;
}
Expand Down
32 changes: 2 additions & 30 deletions flow-typed/npm/electron-builder_vx.x.x.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// flow-typed signature: 8e48cf5994f0196faf010ea12f3e3c6a
// flow-typed version: <<STUB>>/electron-builder_v^11.4.4/flow_v0.38.0
// flow-typed signature: 69ca90250588e58edf55074c1a6f2c23
// flow-typed version: <<STUB>>/electron-builder_v^13.3.2/flow_v0.38.0

/**
* This is an autogenerated libdef stub for:
Expand Down Expand Up @@ -114,14 +114,6 @@ declare module 'electron-builder/out/platformPackager' {
declare module.exports: any;
}

declare module 'electron-builder/out/publish/BintrayPublisher' {
declare module.exports: any;
}

declare module 'electron-builder/out/publish/gitHubPublisher' {
declare module.exports: any;
}

declare module 'electron-builder/out/publish/publisher' {
declare module.exports: any;
}
Expand All @@ -130,10 +122,6 @@ declare module 'electron-builder/out/publish/PublishManager' {
declare module.exports: any;
}

declare module 'electron-builder/out/publish/uploader' {
declare module.exports: any;
}

declare module 'electron-builder/out/readInstalled' {
declare module.exports: any;
}
Expand Down Expand Up @@ -190,10 +178,6 @@ declare module 'electron-builder/out/util/filter' {
declare module.exports: any;
}

declare module 'electron-builder/out/util/nodeHttpExecutor' {
declare module.exports: any;
}

declare module 'electron-builder/out/util/readPackageJson' {
declare module.exports: any;
}
Expand Down Expand Up @@ -280,21 +264,12 @@ declare module 'electron-builder/out/packagerApi.js' {
declare module 'electron-builder/out/platformPackager.js' {
declare module.exports: $Exports<'electron-builder/out/platformPackager'>;
}
declare module 'electron-builder/out/publish/BintrayPublisher.js' {
declare module.exports: $Exports<'electron-builder/out/publish/BintrayPublisher'>;
}
declare module 'electron-builder/out/publish/gitHubPublisher.js' {
declare module.exports: $Exports<'electron-builder/out/publish/gitHubPublisher'>;
}
declare module 'electron-builder/out/publish/publisher.js' {
declare module.exports: $Exports<'electron-builder/out/publish/publisher'>;
}
declare module 'electron-builder/out/publish/PublishManager.js' {
declare module.exports: $Exports<'electron-builder/out/publish/PublishManager'>;
}
declare module 'electron-builder/out/publish/uploader.js' {
declare module.exports: $Exports<'electron-builder/out/publish/uploader'>;
}
declare module 'electron-builder/out/readInstalled.js' {
declare module.exports: $Exports<'electron-builder/out/readInstalled'>;
}
Expand Down Expand Up @@ -337,9 +312,6 @@ declare module 'electron-builder/out/targets/targetFactory.js' {
declare module 'electron-builder/out/util/filter.js' {
declare module.exports: $Exports<'electron-builder/out/util/filter'>;
}
declare module 'electron-builder/out/util/nodeHttpExecutor.js' {
declare module.exports: $Exports<'electron-builder/out/util/nodeHttpExecutor'>;
}
declare module 'electron-builder/out/util/readPackageJson.js' {
declare module.exports: $Exports<'electron-builder/out/util/readPackageJson'>;
}
Expand Down
4 changes: 2 additions & 2 deletions flow-typed/npm/eslint-plugin-flowtype-errors_vx.x.x.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// flow-typed signature: 172b240de0c71e154b7605fffe9c2727
// flow-typed version: <<STUB>>/eslint-plugin-flowtype-errors_v^2.0.3/flow_v0.38.0
// flow-typed signature: 38e6f5beb2db777884647cc67e922b5f
// flow-typed version: <<STUB>>/eslint-plugin-flowtype-errors_v^3.0.0/flow_v0.38.0

/**
* This is an autogenerated libdef stub for:
Expand Down
60 changes: 60 additions & 0 deletions flow-typed/npm/eslint-plugin-jest_vx.x.x.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// flow-typed signature: 77e20fe3383a16a3bda0269a500f4086
// flow-typed version: <<STUB>>/eslint-plugin-jest_v^19.0.0/flow_v0.38.0

/**
* This is an autogenerated libdef stub for:
*
* 'eslint-plugin-jest'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/

declare module 'eslint-plugin-jest' {
declare module.exports: any;
}

/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'eslint-plugin-jest/build/index' {
declare module.exports: any;
}

declare module 'eslint-plugin-jest/build/rules/no-disabled-tests' {
declare module.exports: any;
}

declare module 'eslint-plugin-jest/build/rules/no-focused-tests' {
declare module.exports: any;
}

declare module 'eslint-plugin-jest/build/rules/no-identical-title' {
declare module.exports: any;
}

declare module 'eslint-plugin-jest/build/rules/types' {
declare module.exports: any;
}

// Filename aliases
declare module 'eslint-plugin-jest/build/index.js' {
declare module.exports: $Exports<'eslint-plugin-jest/build/index'>;
}
declare module 'eslint-plugin-jest/build/rules/no-disabled-tests.js' {
declare module.exports: $Exports<'eslint-plugin-jest/build/rules/no-disabled-tests'>;
}
declare module 'eslint-plugin-jest/build/rules/no-focused-tests.js' {
declare module.exports: $Exports<'eslint-plugin-jest/build/rules/no-focused-tests'>;
}
declare module 'eslint-plugin-jest/build/rules/no-identical-title.js' {
declare module.exports: $Exports<'eslint-plugin-jest/build/rules/no-identical-title'>;
}
declare module 'eslint-plugin-jest/build/rules/types.js' {
declare module.exports: $Exports<'eslint-plugin-jest/build/rules/types'>;
}
23 changes: 22 additions & 1 deletion flow-typed/npm/eslint-plugin-react_vx.x.x.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// flow-typed signature: 39d1796ef278e389cee6176d862601a2
// flow-typed signature: 7b0c7c18743b035573d7cc8d0788d5c0
// flow-typed version: <<STUB>>/eslint-plugin-react_v^6.9.0/flow_v0.38.0

/**
Expand Down Expand Up @@ -30,6 +30,14 @@ declare module 'eslint-plugin-react/lib/rules/forbid-component-props' {
declare module.exports: any;
}

declare module 'eslint-plugin-react/lib/rules/forbid-elements' {
declare module.exports: any;
}

declare module 'eslint-plugin-react/lib/rules/forbid-foreign-prop-types' {
declare module.exports: any;
}

declare module 'eslint-plugin-react/lib/rules/forbid-prop-types' {
declare module.exports: any;
}
Expand Down Expand Up @@ -250,6 +258,10 @@ declare module 'eslint-plugin-react/lib/rules/style-prop-object' {
declare module.exports: any;
}

declare module 'eslint-plugin-react/lib/rules/void-dom-elements-no-children' {
declare module.exports: any;
}

declare module 'eslint-plugin-react/lib/rules/wrap-multilines' {
declare module.exports: any;
}
Expand Down Expand Up @@ -291,6 +303,12 @@ declare module 'eslint-plugin-react/lib/rules/display-name.js' {
declare module 'eslint-plugin-react/lib/rules/forbid-component-props.js' {
declare module.exports: $Exports<'eslint-plugin-react/lib/rules/forbid-component-props'>;
}
declare module 'eslint-plugin-react/lib/rules/forbid-elements.js' {
declare module.exports: $Exports<'eslint-plugin-react/lib/rules/forbid-elements'>;
}
declare module 'eslint-plugin-react/lib/rules/forbid-foreign-prop-types.js' {
declare module.exports: $Exports<'eslint-plugin-react/lib/rules/forbid-foreign-prop-types'>;
}
declare module 'eslint-plugin-react/lib/rules/forbid-prop-types.js' {
declare module.exports: $Exports<'eslint-plugin-react/lib/rules/forbid-prop-types'>;
}
Expand Down Expand Up @@ -456,6 +474,9 @@ declare module 'eslint-plugin-react/lib/rules/sort-prop-types.js' {
declare module 'eslint-plugin-react/lib/rules/style-prop-object.js' {
declare module.exports: $Exports<'eslint-plugin-react/lib/rules/style-prop-object'>;
}
declare module 'eslint-plugin-react/lib/rules/void-dom-elements-no-children.js' {
declare module.exports: $Exports<'eslint-plugin-react/lib/rules/void-dom-elements-no-children'>;
}
declare module 'eslint-plugin-react/lib/rules/wrap-multilines.js' {
declare module.exports: $Exports<'eslint-plugin-react/lib/rules/wrap-multilines'>;
}
Expand Down
Loading

0 comments on commit a76aef2

Please sign in to comment.