forked from electrode-io/electrode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentry.js
75 lines (62 loc) · 2.27 KB
/
entry.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
"use strict";
/* eslint-disable no-var */
/**
* All requires in this file will be processed by webpack, which is unforgiving
* about missing dependencies and will generate hard module not found errors,
* and try/catch doesn't work. Further, these module not found issues could
* cause very weird and unexpected errors from webpack.
*/
require("core-js");
require("regenerator-runtime/runtime");
/**
* Test setup for client-side tests.
*
* Intended for:
* - Karma tests: `npm run test-client`
* - Browser tests: `http://localhost:3000/test/client/test.html`
*/
/*globals window:false*/
/**
* Install enzyme along with an Adapter corresponding to React 16
* Configure enzyme to use the adapter using the top level configure(...) API
*/
var enzyme = require("enzyme");
var Adapter = require("enzyme-adapter-react-16");
enzyme.configure({ adapter: new Adapter() });
/*
* We need a global sinon to maintain compatibility
* with existing test suites. However, this will be
* removed in the future.
*/
var sinon = require("sinon");
window.sinon = sinon;
// --------------------------------------------------------------------------
// Chai / Sinon / Mocha configuration.
// --------------------------------------------------------------------------
// Exports
var chai = require("chai");
window.expect = chai.expect;
var sinonChai = require("sinon-chai");
chai.use(sinonChai);
var chaiShallowly = require("chai-shallowly");
chai.use(chaiShallowly);
// Mocha (part of static include).
window.mocha.setup({
ui: "bdd",
bail: false
});
// --------------------------------------------------------------------------
// Bootstrap
// --------------------------------------------------------------------------
// Use webpack to include all app code _except_ the entry point so we can get
// code coverage in the bundle, whether tested or not.
// NOTE: No need to specify src even in src mode since webpack should handle that already
var srcReq = require.context("client", true, /^((?!app).)(!(spec|test))*\.(jsx|js)?$/);
srcReq.keys().map(srcReq);
// Use webpack to infer and `require` tests automatically only for test/client
var testsReq = require.context("test/client", true, /\.spec.jsx?$/);
testsReq.keys().map(testsReq);
// Only start mocha in browser.
if (!window.__karma__) {
window.mocha.run();
}