forked from ember-learn/ember-api-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-tests.js
More file actions
41 lines (33 loc) · 1003 Bytes
/
Copy pathrun-tests.js
File metadata and controls
41 lines (33 loc) · 1003 Bytes
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
const spawn = require('spawndamnit');
const ember = `./node_modules/.bin/ember`;
const userName = process.env['BROWSERSTACK_USERNAME']
const accessKey = process.env['BROWSERSTACK_ACCESS_KEY']
const canConnectToBrowserStack = (
userName && userName.trim().length !== 0 &&
accessKey && accessKey.trim().length !== 0
);
const hookupLoggers = (proc) => {
proc.on('stdout', data => console.log(data.toString()));
proc.on('stderr', data => console.error(data.toString()));
};
const execEmberProcess = async (cmd) => {
let proc = spawn(ember, [cmd]);
hookupLoggers(proc);
try {
await proc;
} catch (e) {
return process.exit(1);
}
};
(async () => {
if (canConnectToBrowserStack) {
await execEmberProcess('browserstack:connect');
}
await execEmberProcess('exam');
if (canConnectToBrowserStack) {
if (process.env['TRAVIS_JOB_NUMBER']) {
await execEmberProcess('browserstack:results');
}
await execEmberProcess('browserstack:disconnect');
}
})();