qunitx 1.2.17 → 1.2.19
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 +1 -1
- package/dist/.build-hash +1 -1
- package/dist/.tsbuildinfo +1 -1
- package/dist/browser/index.d.ts +17 -13
- package/dist/deno/index.d.ts +33 -6
- package/dist/deno/index.js +99 -964
- 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 +5 -5
- 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 +33 -3
- 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/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,10 @@
|
|
|
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 module } from './module.
|
|
5
|
+
export { default as module } from './module.js';
|
|
6
6
|
export declare const skip: (testName: string, _testContent?: unknown) => void;
|
|
7
|
-
export { default as test } from './test.
|
|
7
|
+
export { default as test } from './test.js';
|
|
8
8
|
export declare const todo: (testName: string, testContent?: (assert: Assert, meta: {
|
|
9
9
|
testName: string;
|
|
10
10
|
options: unknown;
|
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.2.
|
|
4
|
+
"version": "1.2.19",
|
|
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);
|
|
@@ -131,7 +140,7 @@ export { default as module } from './module.ts';
|
|
|
131
140
|
* });
|
|
132
141
|
* ```
|
|
133
142
|
*/
|
|
134
|
-
export const skip = Test.skip;
|
|
143
|
+
export const skip: (testName: string, _testContent?: unknown) => void = Test.skip;
|
|
135
144
|
|
|
136
145
|
/**
|
|
137
146
|
* Defines an individual test. Wraps Deno's `it()` and handles the full QUnit
|
|
@@ -164,7 +173,25 @@ export const skip = Test.skip;
|
|
|
164
173
|
* ```
|
|
165
174
|
*/
|
|
166
175
|
export { default as test } from './test.ts';
|
|
167
|
-
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Registers a todo test. Equivalent to `test.todo`. The test body is never executed
|
|
179
|
+
* and the test is reported as ignored by Deno's runner, which has no native todo concept.
|
|
180
|
+
*
|
|
181
|
+
* @param {string} testName - Name of the test to mark as todo.
|
|
182
|
+
* @param {function} [_testContent] - Optional body (ignored — the test will not run).
|
|
183
|
+
* @example
|
|
184
|
+
* ```js
|
|
185
|
+
* import { module, todo } from "qunitx";
|
|
186
|
+
*
|
|
187
|
+
* module("Math", () => {
|
|
188
|
+
* todo("addition is not yet implemented", (assert) => {
|
|
189
|
+
* assert.equal(1 + 1, 2);
|
|
190
|
+
* });
|
|
191
|
+
* });
|
|
192
|
+
* ```
|
|
193
|
+
*/
|
|
194
|
+
export const todo: (testName: string, _testContent?: unknown) => void = Test.todo;
|
|
168
195
|
|
|
169
196
|
/**
|
|
170
197
|
* The default export provides the full QUnitX API as a single object.
|
|
@@ -192,3 +219,6 @@ export const todo = Test.todo;
|
|
|
192
219
|
* for future QUnit config compatibility).
|
|
193
220
|
*/
|
|
194
221
|
export default { AssertionError: Assert.AssertionError, module: Module, test: Test, config: {} };
|
|
222
|
+
|
|
223
|
+
/** Public types referenced by the signatures above, so consumers can name them. */
|
|
224
|
+
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;
|
package/shims/shared/assert.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.ts';
|
|
3
23
|
import { objectValues, objectValuesSubset, validateException, validateExpectedExceptionArgs } from './index.ts';
|
|
@@ -717,3 +737,7 @@ function lcsDiff(a: string[], b: string[]): DiffEntry[] {
|
|
|
717
737
|
}
|
|
718
738
|
return result.reverse();
|
|
719
739
|
}
|
|
740
|
+
|
|
741
|
+
// Re-exported so the public signature of Assert#pushResult does not reference a type
|
|
742
|
+
// that consumers of this entrypoint cannot name (deno doc: private-type-ref).
|
|
743
|
+
export type { PushResultInfo } from '../types.ts';
|
package/shims/types.ts
CHANGED
|
@@ -49,6 +49,7 @@ export interface ModuleState {
|
|
|
49
49
|
|
|
50
50
|
/** A lifecycle hook callback that receives an {@linkcode Assert} instance and a meta object with the shared context. */
|
|
51
51
|
export type HookFn<A = unknown> = (assert: A, meta: { context: Record<string, unknown> }) => void | Promise<void>;
|
|
52
|
+
/** A test body: receives an {@linkcode Assert} instance and a meta object naming the test, its runtime options, and the shared context. */
|
|
52
53
|
export type TestFn<A = unknown> = (
|
|
53
54
|
assert: A,
|
|
54
55
|
meta: { testName: string; options: unknown; context: Record<string, unknown> },
|
package/vendor/qunit.css
CHANGED
package/vendor/qunit.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
}
|
|
6
6
|
})();
|
|
7
7
|
/*!
|
|
8
|
-
* QUnit 2.
|
|
8
|
+
* QUnit 2.26.0
|
|
9
9
|
* https://qunitjs.com/
|
|
10
10
|
*
|
|
11
11
|
* Copyright OpenJS Foundation and other contributors
|
|
@@ -716,6 +716,7 @@
|
|
|
716
716
|
failOnZeroTests: true,
|
|
717
717
|
// Select by pattern or case-insensitive substring match against "moduleName: testName"
|
|
718
718
|
filter: undefined,
|
|
719
|
+
ignoreUnhandledRejections: false,
|
|
719
720
|
testFilter: null,
|
|
720
721
|
// TODO: Make explicit in QUnit 3.
|
|
721
722
|
// fixture: undefined,
|
|
@@ -1945,6 +1946,7 @@
|
|
|
1945
1946
|
expected: expected,
|
|
1946
1947
|
message: message
|
|
1947
1948
|
});
|
|
1949
|
+
return actual;
|
|
1948
1950
|
}
|
|
1949
1951
|
}, {
|
|
1950
1952
|
key: "rejects",
|
|
@@ -1986,6 +1988,7 @@
|
|
|
1986
1988
|
message: message
|
|
1987
1989
|
});
|
|
1988
1990
|
done();
|
|
1991
|
+
return actual;
|
|
1989
1992
|
});
|
|
1990
1993
|
}
|
|
1991
1994
|
}]);
|
|
@@ -5529,7 +5532,7 @@
|
|
|
5529
5532
|
QUnit.isLocal = window$1 && window$1.location && window$1.location.protocol === 'file:';
|
|
5530
5533
|
|
|
5531
5534
|
// Expose the current QUnit version
|
|
5532
|
-
QUnit.version = '2.
|
|
5535
|
+
QUnit.version = '2.26.0';
|
|
5533
5536
|
extend(QUnit, {
|
|
5534
5537
|
config: config,
|
|
5535
5538
|
diff: diff,
|
|
@@ -7484,7 +7487,9 @@
|
|
|
7484
7487
|
return ret;
|
|
7485
7488
|
};
|
|
7486
7489
|
window$1.addEventListener('unhandledrejection', function (event) {
|
|
7487
|
-
QUnit.
|
|
7490
|
+
if (!QUnit.config.ignoreUnhandledRejections) {
|
|
7491
|
+
QUnit.onUncaughtException(event.reason);
|
|
7492
|
+
}
|
|
7488
7493
|
});
|
|
7489
7494
|
})();
|
|
7490
7495
|
|