forked from igvteam/igv.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunTests.js
48 lines (40 loc) · 1.29 KB
/
runTests.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
#! /usr/bin/env node
const { runQunitPuppeteer, printResultSummary, printFailedTests, printOutput } = require('node-qunit-puppeteer');
const finalhandler = require('finalhandler')
const http = require('http')
const serveStatic = require('serve-static')
// Start a server for the the static test files
const serve = serveStatic('.',
{
})
const server = http.createServer(function onRequest (req, res) {
serve(req, res, finalhandler(req, res))
})
server.listen(8000);
const qunitArgs = {
headless: true,
// traceSettings: {
// outputConsole: false,
// outputAllAssertions: false
// },
// Path to qunit tests suite
targetUrl: 'http://127.0.0.1:8000/test/runTests.html',
// (optional, 30000 by default) global timeout for the tests suite
timeout: 100000,
// (optional, false by default) should the browser console be redirected or not
redirectConsole: true
};
runQunitPuppeteer(qunitArgs)
.then((result) => {
printOutput(result, console);
printResultSummary(result, console);
if (result.stats.failed > 0) {
printFailedTests(result, console);
// other action(s) on failed tests
}
server.close();
})
.catch((ex) => {
console.error(ex);
server.close();
});