chore(extension): run tests outside of gulp (#675)

This commit is contained in:
Nathan Bierema 2020-11-16 19:57:35 -05:00 committed by GitHub
parent a28cd62bff
commit 0531c2432d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 15 additions and 85 deletions

View File

@ -2,8 +2,6 @@ import gulp from 'gulp';
import gutil from 'gulp-util';
import zip from 'gulp-zip';
import webpack from 'webpack';
import mocha from 'gulp-mocha';
import crdv from 'chromedriver';
import devConfig from './webpack/dev.config';
import prodConfig from './webpack/prod.config';
import wrapConfig from './webpack/wrap.config';
@ -63,22 +61,6 @@ gulp.task('compress:firefox', (done) => {
done();
});
gulp.task('test:chrome', () => {
crdv.start();
return gulp
.src('./test/chrome/*.spec.js')
.pipe(mocha({ require: ['@babel/polyfill', 'co-mocha'] }))
.on('end', () => crdv.stop());
});
gulp.task('test:electron', () => {
crdv.start();
return gulp
.src('./test/electron/*.spec.js')
.pipe(mocha({ require: ['@babel/polyfill', 'co-mocha'] }))
.on('end', () => crdv.stop());
});
gulp.task('default', gulp.parallel('webpack:dev'));
gulp.task('build:extension', gulp.parallel('webpack:build:extension'));
gulp.task(

View File

@ -18,9 +18,9 @@
"docs:publish": "npm run docs:clean && npm run docs:build && cd _book && git init && git commit --allow-empty -m 'update book' && git checkout -b gh-pages && touch .nojekyll && git add . && git commit -am 'update book' && git push git@github.com:zalmoxisus/redux-devtools-extension gh-pages --force",
"clean": "rimraf build/ && rimraf dev/",
"lint": "eslint .",
"test:app": "cross-env BABEL_ENV=test mocha --require test/app/setup.js --recursive test/app",
"test:chrome": "gulp test:chrome",
"test:electron": "gulp test:electron && rimraf test/electron/tmp",
"test:app": "cross-env BABEL_ENV=test mocha --require test/app/setup.js test/app",
"test:chrome": "mocha --require test/chrome/setup.js test/chrome",
"test:electron": "mocha --require test/electron/setup.js test/electron && rimraf test/electron/tmp",
"test": "npm run test:app && npm run build:extension && npm run test:chrome && npm run test:electron"
},
"repository": {
@ -54,7 +54,6 @@
"file-loader": "^6.2.0",
"gitbook-cli": "^2.3.0",
"gulp": "^4.0.2",
"gulp-mocha": "^3.0.1",
"gulp-util": "^3.0.7",
"gulp-zip": "^3.0.2",
"jsdom": "^9.8.3",

View File

@ -1,6 +1,7 @@
import { resolve } from 'path';
import webdriver from 'selenium-webdriver';
import expect from 'expect';
import chromedriver from 'chromedriver';
import { switchMonitorTests, delay } from '../utils/e2e';
const port = 9515;
@ -12,6 +13,7 @@ describe('Chrome extension', function () {
this.timeout(20000);
before(async () => {
chromedriver.start();
await delay(2000);
this.driver = new webdriver.Builder()
.usingServer(`http://localhost:${port}`)
@ -25,6 +27,7 @@ describe('Chrome extension', function () {
});
after(async () => {
await this.driver.quit();
chromedriver.stop();
});
it("should open extension's window", async () => {

View File

@ -0,0 +1,2 @@
require('@babel/register')();
require('@babel/polyfill');

View File

@ -2,6 +2,7 @@ import { join } from 'path';
import webdriver from 'selenium-webdriver';
import electronPath from 'electron';
import expect from 'expect';
import chromedriver from 'chromedriver';
import { switchMonitorTests, delay } from '../utils/e2e';
const port = 9515;
@ -11,6 +12,7 @@ describe('DevTools panel for Electron', function () {
this.timeout(10000);
before(async () => {
chromedriver.start();
await delay(1000);
this.driver = new webdriver.Builder()
.usingServer(`http://localhost:${port}`)
@ -27,6 +29,7 @@ describe('DevTools panel for Electron', function () {
after(async () => {
await this.driver.quit();
chromedriver.stop();
});
it('should open Redux DevTools tab', async () => {

View File

@ -0,0 +1,2 @@
require('@babel/register')();
require('@babel/polyfill');

View File

@ -1,4 +1,4 @@
import 'babel-polyfill';
import '@babel/polyfill';
import expect from 'expect';
import { bigArray, bigString, circularData } from './data';
import { listenMessage } from '../utils/inject';

View File

@ -4673,18 +4673,6 @@ gulp-cli@^2.2.0:
v8flags "^3.2.0"
yargs "^7.1.0"
gulp-mocha@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/gulp-mocha/-/gulp-mocha-3.0.1.tgz#ab0ca2c39403718174dddad750e63a61be17e041"
integrity sha1-qwyiw5QDcYF03drXUOY6Yb4X4EE=
dependencies:
gulp-util "^3.0.0"
mocha "^3.0.0"
plur "^2.1.0"
req-cwd "^1.0.1"
temp "^0.8.3"
through "^2.3.4"
gulp-util@^3.0.0, gulp-util@^3.0.7:
version "3.0.8"
resolved "https://registry.yarnpkg.com/gulp-util/-/gulp-util-3.0.8.tgz#0054e1e744502e27c04c187c3ecc505dd54bbb4f"
@ -5124,11 +5112,6 @@ invert-kv@^1.0.0:
resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6"
integrity sha1-EEqOSqym09jNFXqO+L+rLXo//bY=
irregular-plurals@^1.0.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/irregular-plurals/-/irregular-plurals-1.2.0.tgz#38f299834ba8c00c30be9c554e137269752ff3ac"
integrity sha1-OPKZg0uowAwwvpxVThNyaXUv86w=
is-absolute@^0.2.3:
version "0.2.6"
resolved "https://registry.yarnpkg.com/is-absolute/-/is-absolute-0.2.6.tgz#20de69f3db942ef2d87b9c2da36f172235b1b5eb"
@ -6836,7 +6819,7 @@ mkdirp@^1.0.3, mkdirp@^1.0.4:
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e"
integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==
mocha@^3.0.0, mocha@^3.1.2:
mocha@^3.1.2:
version "3.2.0"
resolved "https://registry.yarnpkg.com/mocha/-/mocha-3.2.0.tgz#7dc4f45e5088075171a68896814e6ae9eb7a85e3"
integrity sha1-fcT0XlCIB1FxpoiWgU5q6et6heM=
@ -7883,13 +7866,6 @@ pkg-dir@^4.1.0:
dependencies:
find-up "^4.0.0"
plur@^2.1.0:
version "2.1.2"
resolved "https://registry.yarnpkg.com/plur/-/plur-2.1.2.tgz#7482452c1a0f508e3e344eaec312c91c29dc655a"
integrity sha1-dIJFLBoPUI4+NE6uwxLJHCncZVo=
dependencies:
irregular-plurals "^1.0.0"
posix-character-classes@^0.1.0:
version "0.1.1"
resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab"
@ -8977,20 +8953,6 @@ replace-homedir@^1.0.0:
is-absolute "^1.0.0"
remove-trailing-separator "^1.1.0"
req-cwd@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/req-cwd/-/req-cwd-1.0.1.tgz#0d73aeae9266e697a78f7976019677e76acf0fff"
integrity sha1-DXOurpJm5penj3l2AZZ352rPD/8=
dependencies:
req-from "^1.0.1"
req-from@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/req-from/-/req-from-1.0.1.tgz#bf81da5147947d32d13b947dc12a58ad4587350e"
integrity sha1-v4HaUUeUfTLRO5R9wSpYrUWHNQ4=
dependencies:
resolve-from "^2.0.0"
request@2, request@^2.47.0, request@^2.55.0, request@^2.74.0:
version "2.79.0"
resolved "https://registry.yarnpkg.com/request/-/request-2.79.0.tgz#4dfe5bf6be8b8cdc37fcf93e04b65577722710de"
@ -9143,11 +9105,6 @@ resolve-dir@^1.0.0, resolve-dir@^1.0.1:
expand-tilde "^2.0.0"
global-modules "^1.0.0"
resolve-from@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-2.0.0.tgz#9480ab20e94ffa1d9e80a804c7ea147611966b57"
integrity sha1-lICrIOlP+h2egKgEx+oUdhGWa1c=
resolve-from@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6"
@ -9253,11 +9210,6 @@ rimraf@^3.0.2:
dependencies:
glob "^7.1.3"
rimraf@~2.2.6:
version "2.2.8"
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.2.8.tgz#e439be2aaee327321952730f99a8929e4fc50582"
integrity sha1-5Dm+Kq7jJzIZUnMPmaiSnk/FBYI=
ripemd160@^2.0.0, ripemd160@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.1.tgz#0f4584295c53a3628af7e6d79aca21ce57d1c6e7"
@ -10073,14 +10025,6 @@ tar@^6.0.2:
mkdirp "^1.0.3"
yallist "^4.0.0"
temp@^0.8.3:
version "0.8.3"
resolved "https://registry.yarnpkg.com/temp/-/temp-0.8.3.tgz#e0c6bc4d26b903124410e4fed81103014dfc1f59"
integrity sha1-4Ma8TSa5AxJEEOT+2BEDAU38H1k=
dependencies:
os-tmpdir "^1.0.0"
rimraf "~2.2.6"
terser-webpack-plugin@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-1.1.0.tgz#cf7c25a1eee25bf121f4a587bb9e004e3f80e528"
@ -10170,11 +10114,6 @@ through2@~0.2.3:
readable-stream "~1.1.9"
xtend "~2.1.1"
through@^2.3.4:
version "2.3.8"
resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5"
integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=
ticky@1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/ticky/-/ticky-1.0.1.tgz#b7cfa71e768f1c9000c497b9151b30947c50e46d"