Debian Codegraph @

protocol/src/browser/test/index.html

raw
1 <html>
2
3 <head>
4 <meta charset="utf-8">
5 <title>JSON RPC Browser Tests</title>
6 <meta name="viewport" content="width=device-width, initial-scale=1.0">
7 <link href="/node_modules/mocha/mocha.css" rel="stylesheet" />
8 <script src="/node_modules/mocha/mocha.js"></script>
9 </head>
10
11 <body>
12 <div id="mocha"></div>
13 <script class="mocha-init">
14 mocha.setup({ ui: 'tdd', timeout: 5000 });
15 </script>
16 <script src="/protocol/dist/tests.js"></script>
17 <script>
18 function serializeSuite(suite) {
19 return {
20 root: suite.root,
21 suites: suite.suites.map(serializeSuite),
22 tests: suite.tests.map(serializeRunnable),
23 title: suite.title,
24 titlePath: suite.titlePath(),
25 fullTitle: suite.fullTitle(),
26 timeout: suite.timeout(),
27 retries: suite.retries(),
28 slow: suite.slow(),
29 bail: suite.bail()
30 };
31 }
32 function serializeRunnable(runnable) {
33 return {
34 title: runnable.title,
35 titlePath: runnable.titlePath(),
36 fullTitle: runnable.fullTitle(),
37 async: runnable.async,
38 slow: runnable.slow(),
39 speed: runnable.speed,
40 duration: runnable.duration,
41 currentRetry: runnable.currentRetry(),
42 };
43 }
44 function serializeError(err) {
45 return {
46 message: err.message,
47 stack: err.stack,
48 actual: err.actual,
49 expected: err.expected,
50 uncaught: err.uncaught,
51 showDiff: err.showDiff,
52 inspect: typeof err.inspect === 'function' ? err.inspect() : ''
53 };
54 }
55 function PlaywrightReporter(runner) {
56 runner.on('start', () => window.mocha_report('start'));
57 runner.on('end', () => window.mocha_report('end'));
58 runner.on('suite', suite => window.mocha_report('suite', serializeSuite(suite)));
59 runner.on('suite end', suite => window.mocha_report('suite end', serializeSuite(suite)));
60 runner.on('test', test => window.mocha_report('test', serializeRunnable(test)));
61 runner.on('test end', test => window.mocha_report('test end', serializeRunnable(test)));
62 runner.on('hook', hook => window.mocha_report('hook', serializeRunnable(hook)));
63 runner.on('hook end', hook => window.mocha_report('hook end', serializeRunnable(hook)));
64 runner.on('pass', test => window.mocha_report('pass', serializeRunnable(test)));
65 runner.on('fail', (test, err) => window.mocha_report('fail', serializeRunnable(test), serializeError(err)));
66 runner.on('pending', test => window.mocha_report('pending', serializeRunnable(test)));
67 };
68 mocha.reporter(PlaywrightReporter);
69 mocha.run();
70 </script>
71 </body>
72
73 </html>