Skip to content

Commit

Permalink
Fix and a little refactoring for testing (#774)
Browse files Browse the repository at this point in the history
This commit fixes some cross-platform issues with tests execution
(related to different escaping strategies between windows and
linux platforms).
Also it moves end-to-end test to separate folder and allows to
have multiple end-to-end tests which must be placed in
./test/e2e/... to be rocognized as end-to-end tests.
  • Loading branch information
akozhemiakin authored and amilajack committed Mar 12, 2017
1 parent 7d49ef4 commit 1c69eb5
Show file tree
Hide file tree
Showing 6 changed files with 127 additions and 13 deletions.
80 changes: 80 additions & 0 deletions flow-typed/npm/cross-spawn_vx.x.x.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
// flow-typed signature: 7c3e1347b297a26c04d3636782602010
// flow-typed version: <<STUB>>/cross-spawn_v^5.0.1/flow_v0.38.0

/**
* This is an autogenerated libdef stub for:
*
* 'cross-spawn'
*
* 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 'cross-spawn' {
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 'cross-spawn/lib/enoent' {
declare module.exports: any;
}

declare module 'cross-spawn/lib/parse' {
declare module.exports: any;
}

declare module 'cross-spawn/lib/util/escapeArgument' {
declare module.exports: any;
}

declare module 'cross-spawn/lib/util/escapeCommand' {
declare module.exports: any;
}

declare module 'cross-spawn/lib/util/hasEmptyArgumentBug' {
declare module.exports: any;
}

declare module 'cross-spawn/lib/util/readShebang' {
declare module.exports: any;
}

declare module 'cross-spawn/lib/util/resolveCommand' {
declare module.exports: any;
}

// Filename aliases
declare module 'cross-spawn/index' {
declare module.exports: $Exports<'cross-spawn'>;
}
declare module 'cross-spawn/index.js' {
declare module.exports: $Exports<'cross-spawn'>;
}
declare module 'cross-spawn/lib/enoent.js' {
declare module.exports: $Exports<'cross-spawn/lib/enoent'>;
}
declare module 'cross-spawn/lib/parse.js' {
declare module.exports: $Exports<'cross-spawn/lib/parse'>;
}
declare module 'cross-spawn/lib/util/escapeArgument.js' {
declare module.exports: $Exports<'cross-spawn/lib/util/escapeArgument'>;
}
declare module 'cross-spawn/lib/util/escapeCommand.js' {
declare module.exports: $Exports<'cross-spawn/lib/util/escapeCommand'>;
}
declare module 'cross-spawn/lib/util/hasEmptyArgumentBug.js' {
declare module.exports: $Exports<'cross-spawn/lib/util/hasEmptyArgumentBug'>;
}
declare module 'cross-spawn/lib/util/readShebang.js' {
declare module.exports: $Exports<'cross-spawn/lib/util/readShebang'>;
}
declare module 'cross-spawn/lib/util/resolveCommand.js' {
declare module.exports: $Exports<'cross-spawn/lib/util/resolveCommand'>;
}
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
"description": "Electron application boilerplate based on React, React Router, Webpack, React Hot Loader for rapid application development",
"main": "main.js",
"scripts": {
"test": "cross-env NODE_ENV=test BABEL_DISABLE_CACHE=1 jest \"(\\\\|/)test(\\\\|/)(?!.*e2e\\.spec\\.js).+\\.spec\\.js\"",
"test": "cross-env NODE_ENV=test BABEL_DISABLE_CACHE=1 node ./test/runTests.js",
"test-all": "npm run lint && npm run flow && npm run test && npm run build",
"test-watch": "npm test -- --watch",
"test-e2e": "cross-env NODE_ENV=test BABEL_DISABLE_CACHE=1 jest ./test/e2e.spec.js",
"test-e2e": "cross-env NODE_ENV=test BABEL_DISABLE_CACHE=1 node ./test/runTests.js e2e",
"lint": "eslint --cache --format=node_modules/eslint-formatter-pretty .",
"lint-fix": "npm run lint -- --fix",
"hot-server": "cross-env NODE_ENV=development node -r babel-register ./node_modules/webpack-dev-server/bin/webpack-dev-server --config ./webpack.config.development.js",
Expand Down Expand Up @@ -133,6 +133,7 @@
"boiler-room-custodian": "^0.6.1",
"concurrently": "^3.1.0",
"cross-env": "^3.1.4",
"cross-spawn": "^5.0.1",
"css-loader": "^0.26.1",
"devtron": "^1.4.0",
"electron": "^1.4.15",
Expand Down
8 changes: 3 additions & 5 deletions setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ module.exports = {
{ file: 'test/actions/counter.spec.js' },
{ file: 'test/components/Counter.spec.js' },
{ file: 'test/containers/CounterPage.spec.js' },
{ file: 'test/e2e/e2e.spec.js' },
{ file: 'test/reducers/counter.spec.js' },
{ file: 'CHANGELOG.md' },
{ file: 'erb-logo.png' }
Expand Down Expand Up @@ -56,10 +57,6 @@ module.exports = {
file: 'app/routes.js',
pattern: /CounterPage/
},
{
file: 'test/e2e.js',
clear: true
},
{
file: 'README.md',
clear: true
Expand All @@ -76,6 +73,7 @@ module.exports = {
{ file: 'test/actions/.gitkeep' },
{ file: 'test/components/.gitkeep' },
{ file: 'test/containers/.gitkeep' },
{ file: 'test/reducers/.gitkeep' }
{ file: 'test/reducers/.gitkeep' },
{ file: 'test/e2e/.gitkeep' }
]
};
2 changes: 1 addition & 1 deletion test/e2e.spec.js → test/e2e/e2e.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('main window', function spec() {
beforeAll(async () => {
this.app = new Application({
path: electronPath,
args: [path.join(__dirname, '..', 'app')],
args: [path.join(__dirname, '..', '..', 'app')],
});
return this.app.start();
});
Expand Down
9 changes: 9 additions & 0 deletions test/runTests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const spawn = require('cross-spawn');
const path = require('path');

const s = `\\${path.sep}`;
const pattern = process.argv[2] === 'e2e'
? `test${s}e2e${s}.+\\.spec\\.js`
: `test${s}(?!e2e${s})[^${s}]+${s}.+\\.spec\\.js$`;

spawn.sync(path.normalize('./node_modules/.bin/jest'), [pattern], { stdio: 'inherit' });
36 changes: 31 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1412,7 +1412,7 @@ babili-webpack-plugin@^0.0.11:

babylon@^6.11.0, babylon@^6.13.0:
version "6.15.0"
resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.15.0.tgz#ba65cfa1a80e1759b0e89fb562e27dccae70348e"
resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.15.0.tgz#ba65cfa1a80e1759b0e89fb562e27dccae70348e

babylon@^6.15.0, babylon@^6.16.1:
version "6.16.1"
Expand Down Expand Up @@ -2152,6 +2152,14 @@ cross-spawn@^3.0.1:
lru-cache "^4.0.1"
which "^1.2.9"

cross-spawn@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.0.1.tgz#a3bbb302db2297cbea3c04edf36941f4613aa399"
dependencies:
lru-cache "^4.0.1"
shebang-command "^1.2.0"
which "^1.2.9"

[email protected]:
version "0.0.2"
resolved "https://registry.yarnpkg.com/cross-unzip/-/cross-unzip-0.0.2.tgz#5183bc47a09559befcf98cc4657964999359372f"
Expand Down Expand Up @@ -6026,8 +6034,8 @@ postcss-reduce-transforms@^1.0.3:
postcss-value-parser "^3.0.1"

postcss-selector-parser@^2.0.0, postcss-selector-parser@^2.2.2:
version "2.2.2"
resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-2.2.2.tgz#3d70f5adda130da51c7c0c2fc023f56b1374fe08"
version "2.2.3"
resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-2.2.3.tgz#f9437788606c3c9acee16ffe8d8b16297f27bb90"
dependencies:
flatten "^1.0.2"
indexes-of "^1.0.1"
Expand Down Expand Up @@ -6280,8 +6288,8 @@ react-proxy@^3.0.0-alpha.0:
lodash "^4.6.1"

react-redux@^5.0.2:
version "5.0.2"
resolved "https://registry.yarnpkg.com/react-redux/-/react-redux-5.0.2.tgz#3d9878f5f71c6fafcd45de1fbb162ea31f389814"
version "5.0.3"
resolved "https://registry.yarnpkg.com/react-redux/-/react-redux-5.0.3.tgz#86c3b68d56e74294a42e2a740ab66117ef6c019f"
dependencies:
hoist-non-react-statics "^1.0.3"
invariant "^2.0.0"
Expand Down Expand Up @@ -6818,6 +6826,24 @@ sha.js@^2.3.6:
dependencies:
inherits "^2.0.1"

shebang-command@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea"
dependencies:
shebang-regex "^1.0.0"

shebang-regex@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3"

[email protected]:
version "0.7.0"
resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.0.tgz#3f6f2e4965cec565f65ff3861d644f879281a576"
dependencies:
glob "^7.0.0"
interpret "^1.0.0"
rechoir "^0.6.2"

shelljs@^0.7.5, shelljs@^0.7.6:
version "0.7.6"
resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.6.tgz#379cccfb56b91c8601e4793356eb5382924de9ad"
Expand Down

0 comments on commit 1c69eb5

Please sign in to comment.