qunitx 1.2.18 → 1.3.0
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/README.md +388 -198
- package/dist/.build-hash +1 -1
- package/dist/.tsbuildinfo +1 -1
- package/dist/browser/index.d.ts +50 -13
- package/dist/browser/index.js +10 -3
- package/dist/deno/index.d.ts +78 -6
- package/dist/deno/index.js +38 -9
- package/dist/deno/module.d.ts +5 -5
- package/dist/deno/module.js +3 -2
- package/dist/deno/test.d.ts +5 -5
- package/dist/deno/test.js +3 -2
- package/dist/node/index.d.ts +9 -5
- package/dist/node/index.js +15 -4
- package/dist/node/module.d.ts +5 -5
- package/dist/node/module.js +2 -1
- package/dist/node/test.d.ts +7 -7
- package/dist/node/test.js +2 -1
- package/dist/shared/assert.d.ts +21 -0
- package/dist/shared/module-context.d.ts +1 -1
- package/dist/types.d.ts +1 -0
- package/package.json +15 -12
- package/shims/deno/index.ts +86 -4
- package/shims/deno/module.ts +10 -4
- package/shims/deno/test.ts +10 -4
- package/shims/deno/vendor-types/jsr-std-assert.d.ts +1 -1
- package/shims/deno/vendor-types/jsr-std-testing-bdd.d.ts +1 -1
- package/shims/shared/assert.ts +24 -0
- package/shims/types.ts +1 -0
- package/vendor/qunit.css +1 -1
- package/vendor/qunit.js +8 -3
package/dist/deno/index.js
CHANGED
|
@@ -6,7 +6,11 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
8
|
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
-
|
|
9
|
+
try {
|
|
10
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
11
|
+
} catch (e) {
|
|
12
|
+
throw mod = 0, e;
|
|
13
|
+
}
|
|
10
14
|
};
|
|
11
15
|
var __copyProps = (to, from, except, desc) => {
|
|
12
16
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
@@ -555,6 +559,7 @@ var require_qunit = __commonJS({
|
|
|
555
559
|
failOnZeroTests: true,
|
|
556
560
|
// Select by pattern or case-insensitive substring match against "moduleName: testName"
|
|
557
561
|
filter: void 0,
|
|
562
|
+
ignoreUnhandledRejections: false,
|
|
558
563
|
testFilter: null,
|
|
559
564
|
// TODO: Make explicit in QUnit 3.
|
|
560
565
|
// fixture: undefined,
|
|
@@ -1612,6 +1617,7 @@ var require_qunit = __commonJS({
|
|
|
1612
1617
|
expected,
|
|
1613
1618
|
message
|
|
1614
1619
|
});
|
|
1620
|
+
return actual;
|
|
1615
1621
|
}
|
|
1616
1622
|
}, {
|
|
1617
1623
|
key: "rejects",
|
|
@@ -1653,6 +1659,7 @@ var require_qunit = __commonJS({
|
|
|
1653
1659
|
message
|
|
1654
1660
|
});
|
|
1655
1661
|
done();
|
|
1662
|
+
return actual;
|
|
1656
1663
|
});
|
|
1657
1664
|
}
|
|
1658
1665
|
}]);
|
|
@@ -4289,7 +4296,7 @@ var require_qunit = __commonJS({
|
|
|
4289
4296
|
var globalStartCalled = false;
|
|
4290
4297
|
var runStarted = false;
|
|
4291
4298
|
QUnit.isLocal = window$1 && window$1.location && window$1.location.protocol === "file:";
|
|
4292
|
-
QUnit.version = "2.
|
|
4299
|
+
QUnit.version = "2.26.0";
|
|
4293
4300
|
extend(QUnit, {
|
|
4294
4301
|
config,
|
|
4295
4302
|
diff: diff2,
|
|
@@ -5963,7 +5970,9 @@ var require_qunit = __commonJS({
|
|
|
5963
5970
|
return ret;
|
|
5964
5971
|
};
|
|
5965
5972
|
window$1.addEventListener("unhandledrejection", function(event) {
|
|
5966
|
-
QUnit.
|
|
5973
|
+
if (!QUnit.config.ignoreUnhandledRejections) {
|
|
5974
|
+
QUnit.onUncaughtException(event.reason);
|
|
5975
|
+
}
|
|
5967
5976
|
});
|
|
5968
5977
|
})();
|
|
5969
5978
|
})();
|
|
@@ -6875,6 +6884,7 @@ module.todo = function todoModule(moduleName, _moduleContent) {
|
|
|
6875
6884
|
describe(moduleName, { ignore: true }, function() {
|
|
6876
6885
|
});
|
|
6877
6886
|
};
|
|
6887
|
+
var module_default = module;
|
|
6878
6888
|
|
|
6879
6889
|
// shims/deno/test.ts
|
|
6880
6890
|
import ModuleContext2 from "../shared/module-context.js";
|
|
@@ -6933,9 +6943,19 @@ test2.todo = function todoTest(testName, _testContent) {
|
|
|
6933
6943
|
it(testName, { ignore: true }, async function() {
|
|
6934
6944
|
});
|
|
6935
6945
|
};
|
|
6946
|
+
var test_default = test2;
|
|
6936
6947
|
|
|
6937
6948
|
// shims/deno/index.ts
|
|
6938
6949
|
var AssertionError2 = class extends AssertionError {
|
|
6950
|
+
/**
|
|
6951
|
+
* Builds an assertion failure, trimming the stack to the caller's frame.
|
|
6952
|
+
*
|
|
6953
|
+
* @param {object} object - Failure details.
|
|
6954
|
+
* @param {string} [object.message] - Failure message; defaults to `"Assertion failed"`.
|
|
6955
|
+
* @param {Function} [object.stackStartFn] - Frames at and above this function are cut
|
|
6956
|
+
* from the stack, so the trace starts at the caller's assertion rather than inside
|
|
6957
|
+
* QUnitX.
|
|
6958
|
+
*/
|
|
6939
6959
|
constructor(object) {
|
|
6940
6960
|
super(object.message ?? "Assertion failed");
|
|
6941
6961
|
if (object.stackStartFn) Error.captureStackTrace(this, object.stackStartFn);
|
|
@@ -6950,20 +6970,29 @@ TestContext2.Assert = Assert;
|
|
|
6950
6970
|
Object.freeze(Assert);
|
|
6951
6971
|
Object.freeze(ModuleContext3);
|
|
6952
6972
|
Object.freeze(TestContext2);
|
|
6953
|
-
var skip =
|
|
6954
|
-
var todo =
|
|
6955
|
-
var index_default = {
|
|
6973
|
+
var skip = test_default.skip;
|
|
6974
|
+
var todo = test_default.todo;
|
|
6975
|
+
var index_default = {
|
|
6976
|
+
AssertionError: Assert.AssertionError,
|
|
6977
|
+
describe: module_default,
|
|
6978
|
+
it: test_default,
|
|
6979
|
+
module: module_default,
|
|
6980
|
+
test: test_default,
|
|
6981
|
+
config: {}
|
|
6982
|
+
};
|
|
6956
6983
|
export {
|
|
6957
6984
|
Assert,
|
|
6958
6985
|
AssertionError2 as AssertionError,
|
|
6959
6986
|
index_default as default,
|
|
6960
|
-
|
|
6987
|
+
module_default as describe,
|
|
6988
|
+
test_default as it,
|
|
6989
|
+
module_default as module,
|
|
6961
6990
|
skip,
|
|
6962
|
-
|
|
6991
|
+
test_default as test,
|
|
6963
6992
|
todo
|
|
6964
6993
|
};
|
|
6965
6994
|
/*!
|
|
6966
|
-
* QUnit 2.
|
|
6995
|
+
* QUnit 2.26.0
|
|
6967
6996
|
* https://qunitjs.com/
|
|
6968
6997
|
*
|
|
6969
6998
|
* Copyright OpenJS Foundation and other contributors
|
package/dist/deno/module.d.ts
CHANGED
|
@@ -27,21 +27,21 @@ import type { HooksObject } from '../types.d.ts';
|
|
|
27
27
|
* });
|
|
28
28
|
* ```
|
|
29
29
|
*/
|
|
30
|
-
|
|
30
|
+
declare function module(moduleName: string, moduleContent: (hooks: HooksObject<Assert>, meta: {
|
|
31
31
|
moduleName: string;
|
|
32
32
|
options: unknown;
|
|
33
33
|
context: Record<string, unknown>;
|
|
34
34
|
}) => void): void;
|
|
35
|
+
declare namespace module {
|
|
36
|
+
var skip: (moduleName: string, _moduleContent?: unknown) => void;
|
|
37
|
+
var todo: (moduleName: string, _moduleContent?: unknown) => void;
|
|
38
|
+
}
|
|
35
39
|
/** Defines a test module (suite) with optional Deno BDD runtime options forwarded to `describe()`. */
|
|
36
40
|
declare function module(moduleName: string, runtimeOptions: object, moduleContent: (hooks: HooksObject<Assert>, meta: {
|
|
37
41
|
moduleName: string;
|
|
38
42
|
options: unknown;
|
|
39
43
|
context: Record<string, unknown>;
|
|
40
44
|
}) => void): void;
|
|
41
|
-
declare namespace module {
|
|
42
|
-
var skip: (moduleName: string, _moduleContent?: unknown) => void;
|
|
43
|
-
var todo: (moduleName: string, _moduleContent?: unknown) => void;
|
|
44
|
-
}
|
|
45
45
|
export default module;
|
|
46
46
|
export type { Assert };
|
|
47
47
|
export type { HookFn, HooksObject, PushResultInfo } from '../types.d.ts';
|
package/dist/deno/module.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { afterAll, beforeAll, describe } from "jsr:@std/testing/bdd";
|
|
1
|
+
import { afterAll, beforeAll, describe } from "jsr:@std/testing@^1.0.17/bdd";
|
|
2
2
|
import ModuleContext from "../shared/module-context.js";
|
|
3
3
|
function module(moduleName, runtimeOptions, moduleContent) {
|
|
4
4
|
const targetRuntimeOptions = moduleContent ? runtimeOptions : {};
|
|
@@ -59,6 +59,7 @@ module.todo = function todoModule(moduleName, _moduleContent) {
|
|
|
59
59
|
describe(moduleName, { ignore: true }, function() {
|
|
60
60
|
});
|
|
61
61
|
};
|
|
62
|
+
var module_default = module;
|
|
62
63
|
export {
|
|
63
|
-
|
|
64
|
+
module_default as default
|
|
64
65
|
};
|
package/dist/deno/test.d.ts
CHANGED
|
@@ -30,21 +30,21 @@ import type Assert from '../shared/assert.d.ts';
|
|
|
30
30
|
* });
|
|
31
31
|
* ```
|
|
32
32
|
*/
|
|
33
|
-
|
|
33
|
+
declare function test(testName: string, testContent: (assert: Assert, meta: {
|
|
34
34
|
testName: string;
|
|
35
35
|
options: unknown;
|
|
36
36
|
context: Record<string, unknown>;
|
|
37
37
|
}) => void | Promise<void>): void;
|
|
38
|
+
declare namespace test {
|
|
39
|
+
var skip: (testName: string, _testContent?: unknown) => void;
|
|
40
|
+
var todo: (testName: string, _testContent?: unknown) => void;
|
|
41
|
+
}
|
|
38
42
|
/** Defines an individual test with optional Deno BDD runtime options forwarded to `it()`. */
|
|
39
43
|
declare function test(testName: string, runtimeOptions: object, testContent: (assert: Assert, meta: {
|
|
40
44
|
testName: string;
|
|
41
45
|
options: unknown;
|
|
42
46
|
context: Record<string, unknown>;
|
|
43
47
|
}) => void | Promise<void>): void;
|
|
44
|
-
declare namespace test {
|
|
45
|
-
var skip: (testName: string, _testContent?: unknown) => void;
|
|
46
|
-
var todo: (testName: string, _testContent?: unknown) => void;
|
|
47
|
-
}
|
|
48
48
|
export default test;
|
|
49
49
|
export type { Assert };
|
|
50
50
|
export type { PushResultInfo } from '../types.d.ts';
|
package/dist/deno/test.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { it } from "jsr:@std/testing/bdd";
|
|
1
|
+
import { it } from "jsr:@std/testing@^1.0.17/bdd";
|
|
2
2
|
import ModuleContext from "../shared/module-context.js";
|
|
3
3
|
import TestContext from "../shared/test-context.js";
|
|
4
4
|
function test(testName, runtimeOptions, testContent) {
|
|
@@ -55,6 +55,7 @@ test.todo = function todoTest(testName, _testContent) {
|
|
|
55
55
|
it(testName, { ignore: true }, async function() {
|
|
56
56
|
});
|
|
57
57
|
};
|
|
58
|
+
var test_default = test;
|
|
58
59
|
export {
|
|
59
|
-
|
|
60
|
+
test_default as default
|
|
60
61
|
};
|
package/dist/node/index.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import Assert from '../shared/assert.d.ts';
|
|
2
|
-
import Module from './module.d.ts';
|
|
3
|
-
import Test from './test.d.ts';
|
|
1
|
+
import type Assert from '../shared/assert.d.ts';
|
|
2
|
+
import type Module from './module.d.ts';
|
|
3
|
+
import type Test from './test.d.ts';
|
|
4
4
|
export { Assert };
|
|
5
|
-
export { default as
|
|
5
|
+
export { default as describe } from './module.js';
|
|
6
|
+
export { default as it } from './test.js';
|
|
7
|
+
export { default as module } from './module.js';
|
|
6
8
|
export declare const skip: (testName: string, _testContent?: unknown) => void;
|
|
7
|
-
export { default as test } from './test.
|
|
9
|
+
export { default as test } from './test.js';
|
|
8
10
|
export declare const todo: (testName: string, testContent?: (assert: Assert, meta: {
|
|
9
11
|
testName: string;
|
|
10
12
|
options: unknown;
|
|
@@ -12,6 +14,8 @@ export declare const todo: (testName: string, testContent?: (assert: Assert, met
|
|
|
12
14
|
export type { HookFn, HooksObject, PushResultInfo, TestFn } from '../types.d.ts';
|
|
13
15
|
declare const _default: {
|
|
14
16
|
AssertionError: import("../types.d.ts").AssertionErrorConstructor;
|
|
17
|
+
describe: typeof Module;
|
|
18
|
+
it: typeof Test;
|
|
15
19
|
module: typeof Module;
|
|
16
20
|
test: typeof Test;
|
|
17
21
|
config: {};
|
package/dist/node/index.js
CHANGED
|
@@ -22,15 +22,26 @@ Object.freeze(Assert);
|
|
|
22
22
|
Object.freeze(ModuleContext);
|
|
23
23
|
Object.freeze(TestContext);
|
|
24
24
|
import { default as default2 } from "./module.js";
|
|
25
|
-
const skip = Test.skip;
|
|
26
25
|
import { default as default3 } from "./test.js";
|
|
26
|
+
import { default as default4 } from "./module.js";
|
|
27
|
+
const skip = Test.skip;
|
|
28
|
+
import { default as default5 } from "./test.js";
|
|
27
29
|
const todo = Test.todo;
|
|
28
|
-
var node_default = {
|
|
30
|
+
var node_default = {
|
|
31
|
+
AssertionError: Assert.AssertionError,
|
|
32
|
+
describe: Module,
|
|
33
|
+
it: Test,
|
|
34
|
+
module: Module,
|
|
35
|
+
test: Test,
|
|
36
|
+
config: {}
|
|
37
|
+
};
|
|
29
38
|
export {
|
|
30
39
|
Assert,
|
|
31
40
|
node_default as default,
|
|
32
|
-
default2 as
|
|
41
|
+
default2 as describe,
|
|
42
|
+
default3 as it,
|
|
43
|
+
default4 as module,
|
|
33
44
|
skip,
|
|
34
|
-
|
|
45
|
+
default5 as test,
|
|
35
46
|
todo
|
|
36
47
|
};
|
package/dist/node/module.d.ts
CHANGED
|
@@ -33,19 +33,19 @@ import type { HooksObject } from '../types.d.ts';
|
|
|
33
33
|
* });
|
|
34
34
|
* ```
|
|
35
35
|
*/
|
|
36
|
-
|
|
36
|
+
declare function module(moduleName: string, moduleContent: (hooks: HooksObject<Assert>, meta: {
|
|
37
37
|
moduleName: string;
|
|
38
38
|
options: unknown;
|
|
39
39
|
context: Record<string, unknown>;
|
|
40
40
|
}) => void): void;
|
|
41
|
+
declare namespace module {
|
|
42
|
+
var skip: (moduleName: string, _moduleContent?: unknown) => void;
|
|
43
|
+
var todo: (moduleName: string, _moduleContent?: unknown) => void;
|
|
44
|
+
}
|
|
41
45
|
/** Defines a test module (suite) with optional Node test runner options forwarded to `describe()`. */
|
|
42
46
|
declare function module(moduleName: string, runtimeOptions: object, moduleContent: (hooks: HooksObject<Assert>, meta: {
|
|
43
47
|
moduleName: string;
|
|
44
48
|
options: unknown;
|
|
45
49
|
context: Record<string, unknown>;
|
|
46
50
|
}) => void): void;
|
|
47
|
-
declare namespace module {
|
|
48
|
-
var skip: (moduleName: string, _moduleContent?: unknown) => void;
|
|
49
|
-
var todo: (moduleName: string, _moduleContent?: unknown) => void;
|
|
50
|
-
}
|
|
51
51
|
export default module;
|
package/dist/node/module.js
CHANGED
|
@@ -61,6 +61,7 @@ module.todo = function todoModule(moduleName, _moduleContent) {
|
|
|
61
61
|
callAtLocation(describe, captureCallerLocation(todoModule), moduleName, { skip: true }, function() {
|
|
62
62
|
});
|
|
63
63
|
};
|
|
64
|
+
var module_default = module;
|
|
64
65
|
export {
|
|
65
|
-
|
|
66
|
+
module_default as default
|
|
66
67
|
};
|
package/dist/node/test.d.ts
CHANGED
|
@@ -31,13 +31,7 @@ import type Assert from '../shared/assert.d.ts';
|
|
|
31
31
|
* });
|
|
32
32
|
* ```
|
|
33
33
|
*/
|
|
34
|
-
|
|
35
|
-
testName: string;
|
|
36
|
-
options: unknown;
|
|
37
|
-
context: Record<string, unknown>;
|
|
38
|
-
}) => void | Promise<void>): void;
|
|
39
|
-
/** Defines an individual test with optional Node test runner options forwarded to `it()`. */
|
|
40
|
-
declare function test(testName: string, runtimeOptions: object, testContent: (assert: Assert, meta: {
|
|
34
|
+
declare function test(testName: string, testContent: (assert: Assert, meta: {
|
|
41
35
|
testName: string;
|
|
42
36
|
options: unknown;
|
|
43
37
|
context: Record<string, unknown>;
|
|
@@ -49,4 +43,10 @@ declare namespace test {
|
|
|
49
43
|
options: unknown;
|
|
50
44
|
}) => void | Promise<void>) => void;
|
|
51
45
|
}
|
|
46
|
+
/** Defines an individual test with optional Node test runner options forwarded to `it()`. */
|
|
47
|
+
declare function test(testName: string, runtimeOptions: object, testContent: (assert: Assert, meta: {
|
|
48
|
+
testName: string;
|
|
49
|
+
options: unknown;
|
|
50
|
+
context: Record<string, unknown>;
|
|
51
|
+
}) => void | Promise<void>): void;
|
|
52
52
|
export default test;
|
package/dist/node/test.js
CHANGED
package/dist/shared/assert.d.ts
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QUnitX's assertion API, on its own.
|
|
3
|
+
*
|
|
4
|
+
* The same {@linkcode Assert} instance every `test()` callback receives, importable
|
|
5
|
+
* directly for code that wants QUnit's assertions without QUnitX's runner wrapper —
|
|
6
|
+
* a custom harness, a helper that takes `assert` and adds domain checks, or a runtime
|
|
7
|
+
* where no test runner is involved at all. This entrypoint touches no runner API, so
|
|
8
|
+
* unlike the package root it runs anywhere: Deno, Node.js and the browser.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* import Assert from '@izelnakri/qunitx/assert';
|
|
13
|
+
*
|
|
14
|
+
* function assertIsEven(assert: Assert, value: number) {
|
|
15
|
+
* assert.strictEqual(value % 2, 0, `${value} is even`);
|
|
16
|
+
* }
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @module
|
|
20
|
+
*/
|
|
1
21
|
import '../../vendor/qunit.js';
|
|
2
22
|
import type { AssertionErrorConstructor, InspectFn, ModuleState, PushResultInfo, QUnitObject, TestState } from '../types.d.ts';
|
|
3
23
|
/**
|
|
@@ -356,3 +376,4 @@ export default class Assert {
|
|
|
356
376
|
*/
|
|
357
377
|
rejects(promise: unknown, expectedInput?: unknown, assertionMessage?: string): Promise<void>;
|
|
358
378
|
}
|
|
379
|
+
export type { PushResultInfo } from '../types.d.ts';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { HookFn } from '../types.d.ts';
|
|
2
2
|
import type Assert from './assert.d.ts';
|
|
3
|
-
import TestContext from './test-context.d.ts';
|
|
3
|
+
import type TestContext from './test-context.d.ts';
|
|
4
4
|
export default class ModuleContext {
|
|
5
5
|
static Assert: typeof Assert;
|
|
6
6
|
static currentModuleChain: ModuleContext[];
|
package/dist/types.d.ts
CHANGED
|
@@ -50,6 +50,7 @@ export interface ModuleState {
|
|
|
50
50
|
export type HookFn<A = unknown> = (assert: A, meta: {
|
|
51
51
|
context: Record<string, unknown>;
|
|
52
52
|
}) => void | Promise<void>;
|
|
53
|
+
/** A test body: receives an {@linkcode Assert} instance and a meta object naming the test, its runtime options, and the shared context. */
|
|
53
54
|
export type TestFn<A = unknown> = (assert: A, meta: {
|
|
54
55
|
testName: string;
|
|
55
56
|
options: unknown;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qunitx",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.3.0",
|
|
5
5
|
"description": "Universal test library — run the same test file in Node.js, Deno, and the browser with QUnit's battle-tested assertion API",
|
|
6
6
|
"author": "Izel Nakri",
|
|
7
7
|
"license": "MIT",
|
|
@@ -81,13 +81,10 @@
|
|
|
81
81
|
"format": "prettier --check \"test/**/*.ts\" \"*.ts\" \"package.json\"",
|
|
82
82
|
"format:fix": "prettier --write \"test/**/*.ts\" \"*.ts\" \"package.json\"",
|
|
83
83
|
"lint": "deno lint shims/",
|
|
84
|
-
"lint:docs": "deno doc --lint shims/deno/module.ts shims/deno/test.ts",
|
|
84
|
+
"lint:docs": "deno doc --lint shims/deno/index.ts shims/deno/module.ts shims/deno/test.ts shims/shared/assert.ts",
|
|
85
85
|
"build": "node build.ts",
|
|
86
86
|
"build:cold": "rm -rf dist && node build.ts",
|
|
87
87
|
"pretest": "node build.ts && node --input-type=module -e \"import{symlinkSync}from'fs';try{symlinkSync('..','node_modules/qunitx','junction')}catch(_){}\"",
|
|
88
|
-
"run:all": "npm run run:node && npm run run:deno",
|
|
89
|
-
"run:node": "node --test test/helpers/passing-tests.ts && node --test test/helpers/failing-tests.ts",
|
|
90
|
-
"run:deno": "deno test test/helpers/passing-tests.ts && deno test test/helpers/failing-tests.ts",
|
|
91
88
|
"changelog:unreleased": "git-cliff --unreleased --strip all",
|
|
92
89
|
"changelog:preview": "git-cliff",
|
|
93
90
|
"changelog:update": "git-cliff --output CHANGELOG.md",
|
|
@@ -104,15 +101,21 @@
|
|
|
104
101
|
"bench": "deno task bench",
|
|
105
102
|
"bench:check": "deno task bench:check",
|
|
106
103
|
"bench:update": "deno task bench:update",
|
|
107
|
-
"docs": "deno doc --html --name=\"QUnitX\" --output=docs/src shims/deno/index.ts"
|
|
104
|
+
"docs": "deno doc --html --name=\"QUnitX\" --output=docs/src shims/deno/index.ts",
|
|
105
|
+
"run:node": "node --test test/truthy-test.ts test/helpers/failing-location-fixture.ts",
|
|
106
|
+
"run:deno": "deno test --allow-read test/truthy-test.ts test/helpers/failing-location-fixture.ts",
|
|
107
|
+
"prerun:node": "npm run build",
|
|
108
|
+
"version": "node scripts/sync-jsr-version.ts",
|
|
109
|
+
"lint:jsr": "deno publish --dry-run --allow-dirty"
|
|
108
110
|
},
|
|
109
111
|
"devDependencies": {
|
|
110
|
-
"@types/node": "^
|
|
111
|
-
"
|
|
112
|
-
"
|
|
113
|
-
"
|
|
114
|
-
"
|
|
115
|
-
"
|
|
112
|
+
"@types/node": "^26.2.0",
|
|
113
|
+
"esbuild": "0.28.2",
|
|
114
|
+
"playwright-core": "^1.62.1",
|
|
115
|
+
"prettier": "^3.9.6",
|
|
116
|
+
"qunit": "^2.26.0",
|
|
117
|
+
"qunitx-cli": "^0.34.3",
|
|
118
|
+
"typescript": "^7.0.2"
|
|
116
119
|
},
|
|
117
120
|
"volta": {
|
|
118
121
|
"node": "24.14.0"
|
package/shims/deno/index.ts
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
* @module
|
|
26
26
|
*/
|
|
27
27
|
import '../../vendor/qunit.js';
|
|
28
|
-
import { AssertionError as DenoAssertionError } from 'jsr:@std/assert';
|
|
28
|
+
import { AssertionError as DenoAssertionError } from 'jsr:@std/assert@^1.0.17';
|
|
29
29
|
import Assert from '../shared/assert.ts';
|
|
30
30
|
import { filterStack } from '../shared/filter-stack.ts';
|
|
31
31
|
import ModuleContext from '../shared/module-context.ts';
|
|
@@ -53,6 +53,15 @@ import Test from './test.ts';
|
|
|
53
53
|
* ```
|
|
54
54
|
*/
|
|
55
55
|
export class AssertionError extends DenoAssertionError {
|
|
56
|
+
/**
|
|
57
|
+
* Builds an assertion failure, trimming the stack to the caller's frame.
|
|
58
|
+
*
|
|
59
|
+
* @param {object} object - Failure details.
|
|
60
|
+
* @param {string} [object.message] - Failure message; defaults to `"Assertion failed"`.
|
|
61
|
+
* @param {Function} [object.stackStartFn] - Frames at and above this function are cut
|
|
62
|
+
* from the stack, so the trace starts at the caller's assertion rather than inside
|
|
63
|
+
* QUnitX.
|
|
64
|
+
*/
|
|
56
65
|
constructor(object: AssertionErrorOptions) {
|
|
57
66
|
super(object.message ?? 'Assertion failed');
|
|
58
67
|
if (object.stackStartFn) Error.captureStackTrace(this, object.stackStartFn);
|
|
@@ -114,6 +123,49 @@ export { Assert };
|
|
|
114
123
|
*/
|
|
115
124
|
export { default as module } from './module.ts';
|
|
116
125
|
|
|
126
|
+
/**
|
|
127
|
+
* BDD-style alias for {@linkcode module}. The same function object, so
|
|
128
|
+
* `describe.skip` and `describe.todo` behave exactly like `module.skip` and
|
|
129
|
+
* `module.todo`.
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* ```js
|
|
133
|
+
* import { describe, it } from "qunitx";
|
|
134
|
+
*
|
|
135
|
+
* describe("Math", (hooks) => {
|
|
136
|
+
* hooks.beforeEach((assert) => {
|
|
137
|
+
* assert.step("setup");
|
|
138
|
+
* });
|
|
139
|
+
*
|
|
140
|
+
* it("adds", (assert) => {
|
|
141
|
+
* assert.equal(1 + 1, 2);
|
|
142
|
+
* });
|
|
143
|
+
* });
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
146
|
+
export { default as describe } from './module.ts';
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* BDD-style alias for {@linkcode test}. The same function object, so `it.skip`
|
|
150
|
+
* and `it.todo` behave exactly like `test.skip` and `test.todo`.
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* ```js
|
|
154
|
+
* import { describe, it } from "qunitx";
|
|
155
|
+
*
|
|
156
|
+
* describe("Math", () => {
|
|
157
|
+
* it("adds", (assert) => {
|
|
158
|
+
* assert.equal(1 + 1, 2);
|
|
159
|
+
* });
|
|
160
|
+
*
|
|
161
|
+
* it.skip("divides", (assert) => {
|
|
162
|
+
* assert.equal(4 / 2, 2);
|
|
163
|
+
* });
|
|
164
|
+
* });
|
|
165
|
+
* ```
|
|
166
|
+
*/
|
|
167
|
+
export { default as it } from './test.ts';
|
|
168
|
+
|
|
117
169
|
/**
|
|
118
170
|
* Registers a skipped test. Equivalent to `test.skip`. The test body is never
|
|
119
171
|
* executed and the test is reported as ignored by Deno's runner.
|
|
@@ -131,7 +183,7 @@ export { default as module } from './module.ts';
|
|
|
131
183
|
* });
|
|
132
184
|
* ```
|
|
133
185
|
*/
|
|
134
|
-
export const skip = Test.skip;
|
|
186
|
+
export const skip: (testName: string, _testContent?: unknown) => void = Test.skip;
|
|
135
187
|
|
|
136
188
|
/**
|
|
137
189
|
* Defines an individual test. Wraps Deno's `it()` and handles the full QUnit
|
|
@@ -164,7 +216,25 @@ export const skip = Test.skip;
|
|
|
164
216
|
* ```
|
|
165
217
|
*/
|
|
166
218
|
export { default as test } from './test.ts';
|
|
167
|
-
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Registers a todo test. Equivalent to `test.todo`. The test body is never executed
|
|
222
|
+
* and the test is reported as ignored by Deno's runner, which has no native todo concept.
|
|
223
|
+
*
|
|
224
|
+
* @param {string} testName - Name of the test to mark as todo.
|
|
225
|
+
* @param {function} [_testContent] - Optional body (ignored — the test will not run).
|
|
226
|
+
* @example
|
|
227
|
+
* ```js
|
|
228
|
+
* import { module, todo } from "qunitx";
|
|
229
|
+
*
|
|
230
|
+
* module("Math", () => {
|
|
231
|
+
* todo("addition is not yet implemented", (assert) => {
|
|
232
|
+
* assert.equal(1 + 1, 2);
|
|
233
|
+
* });
|
|
234
|
+
* });
|
|
235
|
+
* ```
|
|
236
|
+
*/
|
|
237
|
+
export const todo: (testName: string, _testContent?: unknown) => void = Test.todo;
|
|
168
238
|
|
|
169
239
|
/**
|
|
170
240
|
* The default export provides the full QUnitX API as a single object.
|
|
@@ -186,9 +256,21 @@ export const todo = Test.todo;
|
|
|
186
256
|
* @property {Function} test - Defines an individual test inside a `module()` callback.
|
|
187
257
|
* Receives an {@linkcode Assert} instance as its first argument.
|
|
188
258
|
* See the named {@linkcode test} export for full parameter documentation.
|
|
259
|
+
* @property {Function} describe - BDD-style alias for `module`. Same function object.
|
|
260
|
+
* @property {Function} it - BDD-style alias for `test`. Same function object.
|
|
189
261
|
* @property {typeof AssertionError} AssertionError - The error class thrown when an
|
|
190
262
|
* assertion fails. Extends Deno's built-in `AssertionError`.
|
|
191
263
|
* @property {object} config - Runtime configuration object (currently unused; reserved
|
|
192
264
|
* for future QUnit config compatibility).
|
|
193
265
|
*/
|
|
194
|
-
export default {
|
|
266
|
+
export default {
|
|
267
|
+
AssertionError: Assert.AssertionError,
|
|
268
|
+
describe: Module,
|
|
269
|
+
it: Test,
|
|
270
|
+
module: Module,
|
|
271
|
+
test: Test,
|
|
272
|
+
config: {},
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
/** Public types referenced by the signatures above, so consumers can name them. */
|
|
276
|
+
export type { HookFn, HooksObject, PushResultInfo, TestFn } from '../types.ts';
|
package/shims/deno/module.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { afterAll, beforeAll, describe } from 'jsr:@std/testing/bdd';
|
|
1
|
+
import { afterAll, beforeAll, describe } from 'jsr:@std/testing@^1.0.17/bdd';
|
|
2
2
|
import type Assert from '../shared/assert.ts';
|
|
3
3
|
import ModuleContext from '../shared/module-context.ts';
|
|
4
4
|
import type { HookFn, HooksObject } from '../types.ts';
|
|
@@ -30,10 +30,10 @@ import type { HookFn, HooksObject } from '../types.ts';
|
|
|
30
30
|
* });
|
|
31
31
|
* ```
|
|
32
32
|
*/
|
|
33
|
-
|
|
33
|
+
function module(moduleName: string, moduleContent: (hooks: HooksObject<Assert>, meta: { moduleName: string; options: unknown; context: Record<string, unknown> }) => void): void;
|
|
34
34
|
/** Defines a test module (suite) with optional Deno BDD runtime options forwarded to `describe()`. */
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
function module(moduleName: string, runtimeOptions: object, moduleContent: (hooks: HooksObject<Assert>, meta: { moduleName: string; options: unknown; context: Record<string, unknown> }) => void): void;
|
|
36
|
+
function module(
|
|
37
37
|
moduleName: string,
|
|
38
38
|
runtimeOptions: object | ((hooks: HooksObject<Assert>) => void),
|
|
39
39
|
moduleContent?: (hooks: HooksObject<Assert>, meta: { moduleName: string; options: unknown; context: Record<string, unknown> }) => void,
|
|
@@ -149,5 +149,11 @@ module.todo = function todoModule(moduleName: string, _moduleContent?: unknown):
|
|
|
149
149
|
describe(moduleName, { ignore: true }, function () {});
|
|
150
150
|
};
|
|
151
151
|
|
|
152
|
+
// Exported here rather than on the declarations above: `export default function` on an
|
|
153
|
+
// overload set that also carries a namespace merge (.skip/.todo) emits a .d.ts with two
|
|
154
|
+
// `export default` statements, which is invalid TypeScript (TS2528/TS2652/TS2383) and
|
|
155
|
+
// breaks consumers that typecheck with `skipLibCheck: false`.
|
|
156
|
+
export default module;
|
|
157
|
+
|
|
152
158
|
export type { Assert };
|
|
153
159
|
export type { HookFn, HooksObject, PushResultInfo } from '../types.ts';
|
package/shims/deno/test.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { it } from 'jsr:@std/testing/bdd';
|
|
1
|
+
import { it } from 'jsr:@std/testing@^1.0.17/bdd';
|
|
2
2
|
import type Assert from '../shared/assert.ts';
|
|
3
3
|
import ModuleContext from '../shared/module-context.ts';
|
|
4
4
|
import TestContext from '../shared/test-context.ts';
|
|
@@ -34,10 +34,10 @@ import TestContext from '../shared/test-context.ts';
|
|
|
34
34
|
* });
|
|
35
35
|
* ```
|
|
36
36
|
*/
|
|
37
|
-
|
|
37
|
+
function test(testName: string, testContent: (assert: Assert, meta: { testName: string; options: unknown; context: Record<string, unknown> }) => void | Promise<void>): void;
|
|
38
38
|
/** Defines an individual test with optional Deno BDD runtime options forwarded to `it()`. */
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
function test(testName: string, runtimeOptions: object, testContent: (assert: Assert, meta: { testName: string; options: unknown; context: Record<string, unknown> }) => void | Promise<void>): void;
|
|
40
|
+
function test(
|
|
41
41
|
testName: string,
|
|
42
42
|
runtimeOptions: object | ((assert: Assert, meta: { testName: string; options: unknown; context: Record<string, unknown> }) => void | Promise<void>),
|
|
43
43
|
testContent?: (assert: Assert, meta: { testName: string; options: unknown; context: Record<string, unknown> }) => void | Promise<void>,
|
|
@@ -150,5 +150,11 @@ test.todo = function todoTest(testName: string, _testContent?: unknown): void {
|
|
|
150
150
|
it(testName, { ignore: true }, async function () {});
|
|
151
151
|
};
|
|
152
152
|
|
|
153
|
+
// Exported here rather than on the declarations above: `export default function` on an
|
|
154
|
+
// overload set that also carries a namespace merge (.skip/.todo) emits a .d.ts with two
|
|
155
|
+
// `export default` statements, which is invalid TypeScript (TS2528/TS2652/TS2383) and
|
|
156
|
+
// breaks consumers that typecheck with `skipLibCheck: false`.
|
|
157
|
+
export default test;
|
|
158
|
+
|
|
153
159
|
export type { Assert };
|
|
154
160
|
export type { PushResultInfo } from '../types.ts';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare module 'jsr:@std/testing/bdd' {
|
|
1
|
+
declare module 'jsr:@std/testing@^1.0.17/bdd' {
|
|
2
2
|
function describe(name: string, options: Record<string, unknown>, fn: () => void): void;
|
|
3
3
|
function describe(name: string, fn: () => void): void;
|
|
4
4
|
function beforeAll(fn: () => void | Promise<void>): void;
|