@eggjs/mock 6.1.0-beta.3 → 6.1.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/rolldown_runtime.js +24 -1
- package/dist/bootstrap.d.ts +1 -1
- package/dist/bootstrap.js +1 -1
- package/dist/index.js +0 -1
- package/dist/inject_mocha.d.ts +1 -0
- package/dist/inject_mocha.js +35 -0
- package/dist/node_modules/.pnpm/ansi-styles@4.3.0/node_modules/ansi-styles/index.js +142 -0
- package/dist/node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/index.js +157 -0
- package/dist/node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/templates.js +97 -0
- package/dist/node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/util.js +40 -0
- package/dist/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/conversions.js +812 -0
- package/dist/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/index.js +50 -0
- package/dist/node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/route.js +68 -0
- package/dist/node_modules/.pnpm/color-name@1.1.4/node_modules/color-name/index.js +752 -0
- package/dist/node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/browser.js +203 -0
- package/dist/node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/common.js +209 -0
- package/dist/node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/index.js +18 -0
- package/dist/node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/node.js +215 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/convert/dmp.js +24 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/convert/xml.js +33 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/array.js +29 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/base.js +185 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/character.js +23 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/css.js +26 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/json.js +83 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/line.js +51 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/sentence.js +26 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/word.js +151 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/index.js +178 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/apply.js +168 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/create.js +301 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/line-endings.js +137 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/merge.js +367 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/parse.js +91 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/reverse.js +99 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/array.js +23 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/distance-iterator.js +30 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/params.js +22 -0
- package/dist/node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/string.js +97 -0
- package/dist/node_modules/.pnpm/escape-string-regexp@4.0.0/node_modules/escape-string-regexp/index.js +14 -0
- package/dist/node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js +16 -0
- package/dist/node_modules/.pnpm/he@1.2.0/node_modules/he/he.js +4093 -0
- package/dist/node_modules/.pnpm/is-unicode-supported@0.1.0/node_modules/is-unicode-supported/index.js +14 -0
- package/dist/node_modules/.pnpm/log-symbols@4.1.0/node_modules/log-symbols/index.js +27 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/index.js +12 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/context.js +83 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/error-constants.js +35 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/errors.js +392 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/hook.js +86 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/bdd.js +104 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/common.js +99 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/exports.js +65 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/index.js +18 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/qunit.js +95 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/tdd.js +105 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/mocha.js +1037 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/mocharc.js +24 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/buffered-worker-pool.js +152 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/esm-utils.js +74 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/file-unloader.js +22 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/parallel-buffered-runner.js +329 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/nodejs/serializer.js +314 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/pending.js +22 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/base.js +417 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/doc.js +79 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/dot.js +75 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/html.js +283 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/index.js +40 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/json-stream.js +90 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/json.js +145 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/landing.js +107 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/list.js +77 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/markdown.js +106 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/min.js +57 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/nyan.js +233 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/progress.js +92 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/spec.js +91 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/tap.js +261 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/reporters/xunit.js +166 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/runnable.js +346 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/runner.js +922 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/stats-collector.js +72 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/suite.js +517 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/test.js +105 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/utils.js +505 -0
- package/dist/node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/package.js +225 -0
- package/dist/node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js +124 -0
- package/dist/node_modules/.pnpm/randombytes@2.1.0/node_modules/randombytes/index.js +11 -0
- package/dist/node_modules/.pnpm/serialize-javascript@6.0.2/node_modules/serialize-javascript/index.js +114 -0
- package/dist/node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js +76 -0
- package/dist/node_modules/.pnpm/supports-color@8.1.1/node_modules/supports-color/index.js +89 -0
- package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/Pool.js +366 -0
- package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/Promise.js +248 -0
- package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/WorkerHandler.js +419 -0
- package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/debug-port-allocator.js +27 -0
- package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/environment.js +18 -0
- package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/generated/embeddedWorker.js +16 -0
- package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/index.js +63 -0
- package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/transfer.js +21 -0
- package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/validateOptions.js +9 -0
- package/dist/node_modules/.pnpm/workerpool@9.3.4/node_modules/workerpool/src/worker.js +277 -0
- package/dist/register.d.ts +0 -2
- package/dist/register.js +1 -26
- package/package.json +10 -8
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { __commonJS } from "../../../../../../../_virtual/rolldown_runtime.js";
|
|
2
|
+
import { require_suite } from "../suite.js";
|
|
3
|
+
import { require_test } from "../test.js";
|
|
4
|
+
import { require_common } from "./common.js";
|
|
5
|
+
|
|
6
|
+
//#region ../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/bdd.js
|
|
7
|
+
var require_bdd = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/bdd.js": ((exports, module) => {
|
|
8
|
+
/**
|
|
9
|
+
* @typedef {import('../suite.js')} Suite
|
|
10
|
+
*/
|
|
11
|
+
var Test = require_test();
|
|
12
|
+
var EVENT_FILE_PRE_REQUIRE = require_suite().constants.EVENT_FILE_PRE_REQUIRE;
|
|
13
|
+
/**
|
|
14
|
+
* BDD-style interface:
|
|
15
|
+
*
|
|
16
|
+
* describe('Array', function() {
|
|
17
|
+
* describe('#indexOf()', function() {
|
|
18
|
+
* it('should return -1 when not present', function() {
|
|
19
|
+
* // ...
|
|
20
|
+
* });
|
|
21
|
+
*
|
|
22
|
+
* it('should return the index when present', function() {
|
|
23
|
+
* // ...
|
|
24
|
+
* });
|
|
25
|
+
* });
|
|
26
|
+
* });
|
|
27
|
+
*
|
|
28
|
+
* @param {Suite} suite Root suite.
|
|
29
|
+
*/
|
|
30
|
+
module.exports = function bddInterface(suite) {
|
|
31
|
+
var suites = [suite];
|
|
32
|
+
suite.on(EVENT_FILE_PRE_REQUIRE, function(context, file, mocha) {
|
|
33
|
+
var common = require_common()(suites, context, mocha);
|
|
34
|
+
context.before = common.before;
|
|
35
|
+
context.after = common.after;
|
|
36
|
+
context.beforeEach = common.beforeEach;
|
|
37
|
+
context.afterEach = common.afterEach;
|
|
38
|
+
context.run = mocha.options.delay && common.runWithSuite(suite);
|
|
39
|
+
/**
|
|
40
|
+
* Describe a "suite" with the given `title`
|
|
41
|
+
* and callback `fn` containing nested suites
|
|
42
|
+
* and/or tests.
|
|
43
|
+
*/
|
|
44
|
+
context.describe = context.context = function(title, fn) {
|
|
45
|
+
return common.suite.create({
|
|
46
|
+
title,
|
|
47
|
+
file,
|
|
48
|
+
fn
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Pending describe.
|
|
53
|
+
*/
|
|
54
|
+
context.xdescribe = context.xcontext = context.describe.skip = function(title, fn) {
|
|
55
|
+
return common.suite.skip({
|
|
56
|
+
title,
|
|
57
|
+
file,
|
|
58
|
+
fn
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Exclusive suite.
|
|
63
|
+
*/
|
|
64
|
+
context.describe.only = function(title, fn) {
|
|
65
|
+
return common.suite.only({
|
|
66
|
+
title,
|
|
67
|
+
file,
|
|
68
|
+
fn
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Describe a specification or test-case
|
|
73
|
+
* with the given `title` and callback `fn`
|
|
74
|
+
* acting as a thunk.
|
|
75
|
+
*/
|
|
76
|
+
context.it = context.specify = function(title, fn) {
|
|
77
|
+
var suite$1 = suites[0];
|
|
78
|
+
if (suite$1.isPending()) fn = null;
|
|
79
|
+
var test = new Test(title, fn);
|
|
80
|
+
test.file = file;
|
|
81
|
+
suite$1.addTest(test);
|
|
82
|
+
return test;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Exclusive test-case.
|
|
86
|
+
*/
|
|
87
|
+
context.it.only = function(title, fn) {
|
|
88
|
+
return common.test.only(mocha, context.it(title, fn));
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Pending test case.
|
|
92
|
+
*/
|
|
93
|
+
context.xit = context.xspecify = context.it.skip = function(title) {
|
|
94
|
+
return context.it(title);
|
|
95
|
+
};
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
module.exports.description = "BDD or RSpec style [default]";
|
|
99
|
+
}) });
|
|
100
|
+
|
|
101
|
+
//#endregion
|
|
102
|
+
export default require_bdd();
|
|
103
|
+
|
|
104
|
+
export { require_bdd };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { __commonJS } from "../../../../../../../_virtual/rolldown_runtime.js";
|
|
2
|
+
import { require_errors } from "../errors.js";
|
|
3
|
+
import { require_suite } from "../suite.js";
|
|
4
|
+
|
|
5
|
+
//#region ../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/common.js
|
|
6
|
+
var require_common = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/common.js": ((exports, module) => {
|
|
7
|
+
/**
|
|
8
|
+
* @typedef {import('../context.js')} Context
|
|
9
|
+
* @typedef {import('../mocha.js')} Mocha
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
@module interfaces/common
|
|
13
|
+
*/
|
|
14
|
+
var Suite = require_suite();
|
|
15
|
+
var errors = require_errors();
|
|
16
|
+
var createMissingArgumentError = errors.createMissingArgumentError;
|
|
17
|
+
var createUnsupportedError = errors.createUnsupportedError;
|
|
18
|
+
var createForbiddenExclusivityError = errors.createForbiddenExclusivityError;
|
|
19
|
+
/**
|
|
20
|
+
* Functions common to more than one interface.
|
|
21
|
+
*
|
|
22
|
+
* @private
|
|
23
|
+
* @param {Suite[]} suites
|
|
24
|
+
* @param {Context} context
|
|
25
|
+
* @param {Mocha} mocha
|
|
26
|
+
* @return {Object} An object containing common functions.
|
|
27
|
+
*/
|
|
28
|
+
module.exports = function(suites, context, mocha) {
|
|
29
|
+
/**
|
|
30
|
+
* Check if the suite should be tested.
|
|
31
|
+
*
|
|
32
|
+
* @private
|
|
33
|
+
* @param {Suite} suite - suite to check
|
|
34
|
+
* @returns {boolean}
|
|
35
|
+
*/
|
|
36
|
+
function shouldBeTested(suite) {
|
|
37
|
+
return !mocha.options.grep || mocha.options.grep && mocha.options.grep.test(suite.fullTitle()) && !mocha.options.invert;
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
runWithSuite: function runWithSuite(suite) {
|
|
41
|
+
return function run() {
|
|
42
|
+
suite.run();
|
|
43
|
+
};
|
|
44
|
+
},
|
|
45
|
+
before: function(name, fn) {
|
|
46
|
+
return suites[0].beforeAll(name, fn);
|
|
47
|
+
},
|
|
48
|
+
after: function(name, fn) {
|
|
49
|
+
return suites[0].afterAll(name, fn);
|
|
50
|
+
},
|
|
51
|
+
beforeEach: function(name, fn) {
|
|
52
|
+
return suites[0].beforeEach(name, fn);
|
|
53
|
+
},
|
|
54
|
+
afterEach: function(name, fn) {
|
|
55
|
+
return suites[0].afterEach(name, fn);
|
|
56
|
+
},
|
|
57
|
+
suite: {
|
|
58
|
+
only: function only(opts) {
|
|
59
|
+
if (mocha.options.forbidOnly) throw createForbiddenExclusivityError(mocha);
|
|
60
|
+
opts.isOnly = true;
|
|
61
|
+
return this.create(opts);
|
|
62
|
+
},
|
|
63
|
+
skip: function skip(opts) {
|
|
64
|
+
opts.pending = true;
|
|
65
|
+
return this.create(opts);
|
|
66
|
+
},
|
|
67
|
+
create: function create(opts) {
|
|
68
|
+
var suite = Suite.create(suites[0], opts.title);
|
|
69
|
+
suite.pending = Boolean(opts.pending);
|
|
70
|
+
suite.file = opts.file;
|
|
71
|
+
suites.unshift(suite);
|
|
72
|
+
if (opts.isOnly) suite.markOnly();
|
|
73
|
+
if (suite.pending && mocha.options.forbidPending && shouldBeTested(suite)) throw createUnsupportedError("Pending test forbidden");
|
|
74
|
+
if (typeof opts.fn === "function") {
|
|
75
|
+
opts.fn.call(suite);
|
|
76
|
+
suites.shift();
|
|
77
|
+
} else if (typeof opts.fn === "undefined" && !suite.pending) throw createMissingArgumentError("Suite \"" + suite.fullTitle() + "\" was defined but no callback was supplied. Supply a callback or explicitly skip the suite.", "callback", "function");
|
|
78
|
+
else if (!opts.fn && suite.pending) suites.shift();
|
|
79
|
+
return suite;
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
test: {
|
|
83
|
+
only: function(mocha$1, test) {
|
|
84
|
+
if (mocha$1.options.forbidOnly) throw createForbiddenExclusivityError(mocha$1);
|
|
85
|
+
test.markOnly();
|
|
86
|
+
return test;
|
|
87
|
+
},
|
|
88
|
+
skip: function(title) {
|
|
89
|
+
context.test(title);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
}) });
|
|
95
|
+
|
|
96
|
+
//#endregion
|
|
97
|
+
export default require_common();
|
|
98
|
+
|
|
99
|
+
export { require_common };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { __commonJS } from "../../../../../../../_virtual/rolldown_runtime.js";
|
|
2
|
+
import { require_suite } from "../suite.js";
|
|
3
|
+
import { require_test } from "../test.js";
|
|
4
|
+
|
|
5
|
+
//#region ../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/exports.js
|
|
6
|
+
var require_exports = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/exports.js": ((exports, module) => {
|
|
7
|
+
var Suite = require_suite();
|
|
8
|
+
var Test = require_test();
|
|
9
|
+
/**
|
|
10
|
+
* Exports-style (as Node.js module) interface:
|
|
11
|
+
*
|
|
12
|
+
* exports.Array = {
|
|
13
|
+
* '#indexOf()': {
|
|
14
|
+
* 'should return -1 when the value is not present': function() {
|
|
15
|
+
*
|
|
16
|
+
* },
|
|
17
|
+
*
|
|
18
|
+
* 'should return the correct index when the value is present': function() {
|
|
19
|
+
*
|
|
20
|
+
* }
|
|
21
|
+
* }
|
|
22
|
+
* };
|
|
23
|
+
*
|
|
24
|
+
* @param {Suite} suite Root suite.
|
|
25
|
+
*/
|
|
26
|
+
module.exports = function(suite) {
|
|
27
|
+
var suites = [suite];
|
|
28
|
+
suite.on(Suite.constants.EVENT_FILE_REQUIRE, visit);
|
|
29
|
+
function visit(obj, file) {
|
|
30
|
+
var suite$1;
|
|
31
|
+
for (var key in obj) if (typeof obj[key] === "function") {
|
|
32
|
+
var fn = obj[key];
|
|
33
|
+
switch (key) {
|
|
34
|
+
case "before":
|
|
35
|
+
suites[0].beforeAll(fn);
|
|
36
|
+
break;
|
|
37
|
+
case "after":
|
|
38
|
+
suites[0].afterAll(fn);
|
|
39
|
+
break;
|
|
40
|
+
case "beforeEach":
|
|
41
|
+
suites[0].beforeEach(fn);
|
|
42
|
+
break;
|
|
43
|
+
case "afterEach":
|
|
44
|
+
suites[0].afterEach(fn);
|
|
45
|
+
break;
|
|
46
|
+
default:
|
|
47
|
+
var test = new Test(key, fn);
|
|
48
|
+
test.file = file;
|
|
49
|
+
suites[0].addTest(test);
|
|
50
|
+
}
|
|
51
|
+
} else {
|
|
52
|
+
suite$1 = Suite.create(suites[0], key);
|
|
53
|
+
suites.unshift(suite$1);
|
|
54
|
+
visit(obj[key], file);
|
|
55
|
+
suites.shift();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
module.exports.description = "Node.js module (\"exports\") style";
|
|
60
|
+
}) });
|
|
61
|
+
|
|
62
|
+
//#endregion
|
|
63
|
+
export default require_exports();
|
|
64
|
+
|
|
65
|
+
export { require_exports };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { __commonJS } from "../../../../../../../_virtual/rolldown_runtime.js";
|
|
2
|
+
import { require_bdd } from "./bdd.js";
|
|
3
|
+
import { require_tdd } from "./tdd.js";
|
|
4
|
+
import { require_qunit } from "./qunit.js";
|
|
5
|
+
import { require_exports } from "./exports.js";
|
|
6
|
+
|
|
7
|
+
//#region ../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/index.js
|
|
8
|
+
var require_interfaces = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/index.js": ((exports) => {
|
|
9
|
+
exports.bdd = require_bdd();
|
|
10
|
+
exports.tdd = require_tdd();
|
|
11
|
+
exports.qunit = require_qunit();
|
|
12
|
+
exports.exports = require_exports();
|
|
13
|
+
}) });
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
export default require_interfaces();
|
|
17
|
+
|
|
18
|
+
export { require_interfaces };
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { __commonJS } from "../../../../../../../_virtual/rolldown_runtime.js";
|
|
2
|
+
import { require_suite } from "../suite.js";
|
|
3
|
+
import { require_test } from "../test.js";
|
|
4
|
+
import { require_common } from "./common.js";
|
|
5
|
+
|
|
6
|
+
//#region ../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/qunit.js
|
|
7
|
+
var require_qunit = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/qunit.js": ((exports, module) => {
|
|
8
|
+
/**
|
|
9
|
+
* @typedef {import('../suite.js')} Suite
|
|
10
|
+
*/
|
|
11
|
+
var Test = require_test();
|
|
12
|
+
var EVENT_FILE_PRE_REQUIRE = require_suite().constants.EVENT_FILE_PRE_REQUIRE;
|
|
13
|
+
/**
|
|
14
|
+
* QUnit-style interface:
|
|
15
|
+
*
|
|
16
|
+
* suite('Array');
|
|
17
|
+
*
|
|
18
|
+
* test('#length', function() {
|
|
19
|
+
* var arr = [1,2,3];
|
|
20
|
+
* ok(arr.length == 3);
|
|
21
|
+
* });
|
|
22
|
+
*
|
|
23
|
+
* test('#indexOf()', function() {
|
|
24
|
+
* var arr = [1,2,3];
|
|
25
|
+
* ok(arr.indexOf(1) == 0);
|
|
26
|
+
* ok(arr.indexOf(2) == 1);
|
|
27
|
+
* ok(arr.indexOf(3) == 2);
|
|
28
|
+
* });
|
|
29
|
+
*
|
|
30
|
+
* suite('String');
|
|
31
|
+
*
|
|
32
|
+
* test('#length', function() {
|
|
33
|
+
* ok('foo'.length == 3);
|
|
34
|
+
* });
|
|
35
|
+
*
|
|
36
|
+
* @param {Suite} suite Root suite.
|
|
37
|
+
*/
|
|
38
|
+
module.exports = function qUnitInterface(suite) {
|
|
39
|
+
var suites = [suite];
|
|
40
|
+
suite.on(EVENT_FILE_PRE_REQUIRE, function(context, file, mocha) {
|
|
41
|
+
var common = require_common()(suites, context, mocha);
|
|
42
|
+
context.before = common.before;
|
|
43
|
+
context.after = common.after;
|
|
44
|
+
context.beforeEach = common.beforeEach;
|
|
45
|
+
context.afterEach = common.afterEach;
|
|
46
|
+
context.run = mocha.options.delay && common.runWithSuite(suite);
|
|
47
|
+
/**
|
|
48
|
+
* Describe a "suite" with the given `title`.
|
|
49
|
+
*/
|
|
50
|
+
context.suite = function(title) {
|
|
51
|
+
if (suites.length > 1) suites.shift();
|
|
52
|
+
return common.suite.create({
|
|
53
|
+
title,
|
|
54
|
+
file,
|
|
55
|
+
fn: false
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Exclusive Suite.
|
|
60
|
+
*/
|
|
61
|
+
context.suite.only = function(title) {
|
|
62
|
+
if (suites.length > 1) suites.shift();
|
|
63
|
+
return common.suite.only({
|
|
64
|
+
title,
|
|
65
|
+
file,
|
|
66
|
+
fn: false
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Describe a specification or test-case
|
|
71
|
+
* with the given `title` and callback `fn`
|
|
72
|
+
* acting as a thunk.
|
|
73
|
+
*/
|
|
74
|
+
context.test = function(title, fn) {
|
|
75
|
+
var test = new Test(title, fn);
|
|
76
|
+
test.file = file;
|
|
77
|
+
suites[0].addTest(test);
|
|
78
|
+
return test;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Exclusive test-case.
|
|
82
|
+
*/
|
|
83
|
+
context.test.only = function(title, fn) {
|
|
84
|
+
return common.test.only(mocha, context.test(title, fn));
|
|
85
|
+
};
|
|
86
|
+
context.test.skip = common.test.skip;
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
module.exports.description = "QUnit style";
|
|
90
|
+
}) });
|
|
91
|
+
|
|
92
|
+
//#endregion
|
|
93
|
+
export default require_qunit();
|
|
94
|
+
|
|
95
|
+
export { require_qunit };
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { __commonJS } from "../../../../../../../_virtual/rolldown_runtime.js";
|
|
2
|
+
import { require_suite } from "../suite.js";
|
|
3
|
+
import { require_test } from "../test.js";
|
|
4
|
+
import { require_common } from "./common.js";
|
|
5
|
+
|
|
6
|
+
//#region ../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/tdd.js
|
|
7
|
+
var require_tdd = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/mocha@11.7.2/node_modules/mocha/lib/interfaces/tdd.js": ((exports, module) => {
|
|
8
|
+
/**
|
|
9
|
+
* @typedef {import('../suite.js')} Suite
|
|
10
|
+
*/
|
|
11
|
+
var Test = require_test();
|
|
12
|
+
var EVENT_FILE_PRE_REQUIRE = require_suite().constants.EVENT_FILE_PRE_REQUIRE;
|
|
13
|
+
/**
|
|
14
|
+
* TDD-style interface:
|
|
15
|
+
*
|
|
16
|
+
* suite('Array', function() {
|
|
17
|
+
* suite('#indexOf()', function() {
|
|
18
|
+
* suiteSetup(function() {
|
|
19
|
+
*
|
|
20
|
+
* });
|
|
21
|
+
*
|
|
22
|
+
* test('should return -1 when not present', function() {
|
|
23
|
+
*
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* test('should return the index when present', function() {
|
|
27
|
+
*
|
|
28
|
+
* });
|
|
29
|
+
*
|
|
30
|
+
* suiteTeardown(function() {
|
|
31
|
+
*
|
|
32
|
+
* });
|
|
33
|
+
* });
|
|
34
|
+
* });
|
|
35
|
+
*
|
|
36
|
+
* @param {Suite} suite Root suite.
|
|
37
|
+
*/
|
|
38
|
+
module.exports = function(suite) {
|
|
39
|
+
var suites = [suite];
|
|
40
|
+
suite.on(EVENT_FILE_PRE_REQUIRE, function(context, file, mocha) {
|
|
41
|
+
var common = require_common()(suites, context, mocha);
|
|
42
|
+
context.setup = common.beforeEach;
|
|
43
|
+
context.teardown = common.afterEach;
|
|
44
|
+
context.suiteSetup = common.before;
|
|
45
|
+
context.suiteTeardown = common.after;
|
|
46
|
+
context.run = mocha.options.delay && common.runWithSuite(suite);
|
|
47
|
+
/**
|
|
48
|
+
* Describe a "suite" with the given `title` and callback `fn` containing
|
|
49
|
+
* nested suites and/or tests.
|
|
50
|
+
*/
|
|
51
|
+
context.suite = function(title, fn) {
|
|
52
|
+
return common.suite.create({
|
|
53
|
+
title,
|
|
54
|
+
file,
|
|
55
|
+
fn
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Pending suite.
|
|
60
|
+
*/
|
|
61
|
+
context.suite.skip = function(title, fn) {
|
|
62
|
+
return common.suite.skip({
|
|
63
|
+
title,
|
|
64
|
+
file,
|
|
65
|
+
fn
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Exclusive test-case.
|
|
70
|
+
*/
|
|
71
|
+
context.suite.only = function(title, fn) {
|
|
72
|
+
return common.suite.only({
|
|
73
|
+
title,
|
|
74
|
+
file,
|
|
75
|
+
fn
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Describe a specification or test-case with the given `title` and
|
|
80
|
+
* callback `fn` acting as a thunk.
|
|
81
|
+
*/
|
|
82
|
+
context.test = function(title, fn) {
|
|
83
|
+
var suite$1 = suites[0];
|
|
84
|
+
if (suite$1.isPending()) fn = null;
|
|
85
|
+
var test = new Test(title, fn);
|
|
86
|
+
test.file = file;
|
|
87
|
+
suite$1.addTest(test);
|
|
88
|
+
return test;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Exclusive test-case.
|
|
92
|
+
*/
|
|
93
|
+
context.test.only = function(title, fn) {
|
|
94
|
+
return common.test.only(mocha, context.test(title, fn));
|
|
95
|
+
};
|
|
96
|
+
context.test.skip = common.test.skip;
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
module.exports.description = "traditional \"suite\"/\"test\" instead of BDD's \"describe\"/\"it\"";
|
|
100
|
+
}) });
|
|
101
|
+
|
|
102
|
+
//#endregion
|
|
103
|
+
export default require_tdd();
|
|
104
|
+
|
|
105
|
+
export { require_tdd };
|