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/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
|
|