-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathnassh_test.js
39 lines (31 loc) · 937 Bytes
/
nassh_test.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
// Copyright 2017 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
'use strict';
/**
* @fileoverview Test framework setup when run inside the browser.
*/
// Setup the mocha framework.
mocha.setup('bdd');
mocha.checkLeaks();
// Add a global shortcut to the assert API.
const assert = chai.assert;
// Catch any random errors before the test runner runs.
let earlyError = null;
/**
* Catch any errors.
*
* @param {*} args Whatever arguments are passed in.
*/
window.onerror = function(...args) {
earlyError = Array.from(args);
};
/** Run the test framework once everything is finished. */
window.onload = async function() {
hterm.defaultStorage = new lib.Storage.Memory();
await lib.init();
mocha.run();
if (earlyError !== null) {
assert.fail(`uncaught exception detected:\n${earlyError.join('\n')}\n`);
}
};