-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Expand file tree
/
Copy pathmocha.mjs
More file actions
67 lines (61 loc) · 1.71 KB
/
mocha.mjs
File metadata and controls
67 lines (61 loc) · 1.71 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// the .js built file is not committed to the repo
/* eslint-disable-next-line n/no-missing-import */
import "./mocha.js";
const { mocha, Mocha } = globalThis;
const mochaExports = {
after: (...args) => globalThis.after?.(...args),
afterEach: (...args) => globalThis.afterEach?.(...args),
before: (...args) => globalThis.before?.(...args),
beforeEach: (...args) => globalThis.beforeEach?.(...args),
context: (...args) => globalThis.context?.(...args),
describe: (...args) => globalThis.describe?.(...args),
it: (...args) => globalThis.it?.(...args),
setup: (...args) => globalThis.setup?.(...args),
suite: (...args) => globalThis.suite?.(...args),
suiteSetup: (...args) => globalThis.suiteSetup?.(...args),
suiteTeardown: (...args) => globalThis.suiteTeardown?.(...args),
teardown: (...args) => globalThis.teardown?.(...args),
test: (...args) => globalThis.test?.(...args),
specify: (...args) => globalThis.specify?.(...args),
xcontext: (...args) => globalThis.xcontext?.(...args),
xdescribe: (...args) => globalThis.xdescribe?.(...args),
xit: (...args) => globalThis.xit?.(...args),
xspecify: (...args) => globalThis.xspecify?.(...args),
};
export default Mocha;
// Export the mocha instance (in browser, this has setup/run methods)
export { mocha };
// Re-export class/utility exports from the Mocha module
export const {
utils,
interfaces,
reporters,
Runnable,
Context,
Runner,
Suite,
Hook,
Test,
} = Mocha;
// Re-export test interface functions
export const {
after,
afterEach,
before,
beforeEach,
context,
describe,
it,
run,
setup,
suite,
suiteSetup,
suiteTeardown,
teardown,
test,
specify,
xcontext,
xdescribe,
xit,
xspecify,
} = mochaExports;