-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest.js
37 lines (30 loc) · 801 Bytes
/
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
/*
* This Source Code is subject to the terms of the Mozilla Public License
* version 2.0 (the "License"). You can obtain a copy of the License at
* http://mozilla.org/MPL/2.0/.
*/
"use strict";
import fs from "fs";
import path from "path";
import {expect} from "chai";
import Mocha from "mocha";
const mocha = new Mocha();
async function run()
{
const __dirname = path.dirname(new URL(import.meta.url).pathname);
let dir = path.join(__dirname, "test");
let files = fs.readdirSync(dir);
for (let file of files)
if (file.endsWith(".js"))
mocha.addFile(path.join(dir, file));
await mocha.loadFilesAsync();
global.expect = expect;
mocha.run(function(failures)
{
process.on("exit", function()
{
process.exit(failures > 0 ? 1 : 0);
});
});
}
run();