-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathdevelopment.js
63 lines (56 loc) · 1.38 KB
/
development.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
import { render } from './native/bridge';
import create from './components/ekke';
import Subway from './native/subway';
import Screen from './native/screen';
import Mocha from './runners/mocha';
import Tape from './runners/tape';
//
// The different Runners that we support.
//
const RUNNERS = {
mocha: Mocha,
tape: Tape
};
/**
* Create our Ekke component that allows us to intercept the rootTag
* from the application.
*
* @type {Component}
* @public
*/
const Ekke = create(async function mounted(rootTag, props = {}) {
//
// When we want to test Ekke, in Ekke, but we don't want to execute tests
// again while our tests are running.
//
if (typeof props.NiPengNeeWom === 'function') {
return props.NiPengNeeWom(...arguments);
}
const screen = new Screen(rootTag);
const subway = new Subway(props.hostname, props.port);
subway.on('run', function run({ using = 'mocha', opts = {} }) {
const Runner = props.Runner || RUNNERS[using];
const runner = new Runner({
config: { ...props, ...opts },
subway,
screen
});
});
//
// Everything is setup correctly, we can now wait for the service to
// become alive.
//
subway.alive(function alive() {
if (props.alive) props.alive();
}, props.interval);
});
//
// Indication of which build is loaded.
//
Ekke.prod = false;
Ekke.dev = true;
export {
Ekke as default,
Ekke,
render
};