@harnessed-ts/qunit 0.0.0-stage → 0.7.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/CHANGELOG.md ADDED
@@ -0,0 +1,39 @@
1
+ # @harnessed-ts/qunit
2
+
3
+ ## 0.7.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [ec06bdf]
8
+ - @harnessed-ts/core@0.7.0
9
+
10
+ ## 0.6.0
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [e324e94]
15
+ - @harnessed-ts/core@0.6.0
16
+
17
+ ## 0.5.0
18
+
19
+ ### Patch Changes
20
+
21
+ - @harnessed-ts/core@0.5.0
22
+
23
+ ## 0.4.0
24
+
25
+ ### Minor Changes
26
+
27
+ - 9666a3d: Two new assertion packages, both backed by core's one matcher implementation so the messages read the same under every runner:
28
+
29
+ - `@harnessed-ts/qunit`: `install(QUnit)` adds `assert.harness(x)` with `isAbsent`/`isPresent`, `isSelected`/`isNotSelected`, and `readsAs`/`doesNotReadAs`, reported through `pushResult`. For ember-qunit and any QUnit suite.
30
+ - `@harnessed-ts/chai`: `chai.use(harnessedChai)` adds `absent`, `selected`, and `readAs`, awaitable and negatable. For Mocha, ember-mocha, Cypress, and WebdriverIO under Mocha.
31
+
32
+ `harnessMatchers` results now carry `observed: { actual, expected }`, which the QUnit and Chai adapters report so their runners can show what was read.
33
+
34
+ ### Patch Changes
35
+
36
+ - Updated dependencies [9666a3d]
37
+ - Updated dependencies [9666a3d]
38
+ - Updated dependencies [1823546]
39
+ - @harnessed-ts/core@0.4.0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Joe Gaudet, Jay Seo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,32 @@
1
- # Temporary Holding Version
1
+ # @harnessed-ts/qunit
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ QUnit assertions for [harnessed](https://github.com/joegaudet/harnessed#readme)
4
+ harnesses, in the qunit-dom style. For ember-qunit and any other QUnit suite.
5
+
6
+ ```ts
7
+ // tests/test-helper.ts — once, before start()
8
+ import QUnit from 'qunit'
9
+ import { install } from '@harnessed-ts/qunit'
10
+ install(QUnit)
11
+ ```
12
+
13
+ ```ts
14
+ test('saving shows the banner', async function (assert) {
15
+ await page.save()
16
+ await assert.harness(page.banner).isPresent()
17
+ await assert.harness(page.price).readsAs(/^\$/)
18
+ })
19
+ ```
20
+
21
+ | Check | Passes when |
22
+ | ---------------------------------- | --------------------------------------------- |
23
+ | `isAbsent()` / `isPresent()` | nothing matches / something does |
24
+ | `isSelected()` / `isNotSelected()` | `aria-pressed="true"` / anything else |
25
+ | `readsAs(x)` / `doesNotReadAs(x)` | the text equals a string or matches a pattern |
26
+
27
+ Each takes a target or a harness, is async (await it), reports through
28
+ `assert.pushResult` with `actual` and `expected`, and takes an optional message
29
+ that replaces the default. The default messages are the same ones the Vitest,
30
+ Playwright and Chai assertions use.
31
+
32
+ MIT © Joe Gaudet, Jay Seo
package/dist/index.cjs ADDED
@@ -0,0 +1,41 @@
1
+ 'use strict';
2
+
3
+ var core = require('@harnessed-ts/core');
4
+
5
+ // src/index.ts
6
+ function checks(assert, subject) {
7
+ const report = async (run, negated, message) => {
8
+ const outcome = await run;
9
+ assert.pushResult({
10
+ result: outcome.pass !== negated,
11
+ actual: outcome.observed.actual,
12
+ expected: outcome.observed.expected,
13
+ // QUnit then reports "Expected: NOT 0" rather than an equal pair.
14
+ negative: negated,
15
+ // Core's message describes whichever way the check went, so a failed
16
+ // negation already reads "expected … not to …".
17
+ message: message ?? outcome.message()
18
+ });
19
+ };
20
+ return {
21
+ isAbsent: (message) => report(core.harnessMatchers.toBeAbsent(subject), false, message),
22
+ isPresent: (message) => report(core.harnessMatchers.toBeAbsent(subject), true, message),
23
+ isSelected: (message) => report(core.harnessMatchers.toBeSelected(subject), false, message),
24
+ isNotSelected: (message) => report(core.harnessMatchers.toBeSelected(subject), true, message),
25
+ readsAs: (expected, message) => report(core.harnessMatchers.toReadAs(subject, expected), false, message),
26
+ doesNotReadAs: (expected, message) => report(core.harnessMatchers.toReadAs(subject, expected), true, message)
27
+ };
28
+ }
29
+ function install(qunit) {
30
+ Object.defineProperty(qunit.assert, "harness", {
31
+ configurable: true,
32
+ writable: true,
33
+ value: function harness(subject) {
34
+ return checks(this, subject);
35
+ }
36
+ });
37
+ }
38
+
39
+ exports.install = install;
40
+ //# sourceMappingURL=index.cjs.map
41
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"names":["harnessMatchers"],"mappings":";;;;;AAqCA,SAAS,MAAA,CAAO,QAAoB,OAAA,EAAwC;AAC1E,EAAA,MAAM,MAAA,GAAS,OACb,GAAA,EACA,OAAA,EACA,OAAA,KACkB;AAClB,IAAA,MAAM,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AU,IAAA;AAAA,IACV,KAAA,EAAO,SAAS,OAAA,CAA0B,OAAA,EAAwC;AAChF,MAAA,OAAO,MAAA,CAAO,MAAM,OAAO,CAAA;AAAA,IAC7B;AAAA,GACD,CAAA;AACH","file":"index.cjs","sourcesContent":["import { harnessMatchers } from '@harnessed-ts/core'\nimport type { Assertable, MatcherResult } from '@harnessed-ts/core'\n\n/**\n * The checks `assert.harness(subject)` offers. Each is async — a harness reads\n * the page through a driver — so await it. Every one takes an optional message\n * that replaces the default.\n */\nexport interface HarnessAssertions {\n /** Nothing matches. */\n isAbsent(message?: string): Promise<void>\n /** Something matches. */\n isPresent(message?: string): Promise<void>\n /** `aria-pressed=\"true\"`. */\n isSelected(message?: string): Promise<void>\n isNotSelected(message?: string): Promise<void>\n /** The text equals a string or matches a pattern. */\n readsAs(expected: string | RegExp, message?: string): Promise<void>\n doesNotReadAs(expected: string | RegExp, message?: string): Promise<void>\n}\n\n/** The slice of QUnit's `assert` these checks report through. */\ninterface PushResult {\n pushResult(result: {\n result: boolean\n actual: unknown\n expected: unknown\n message: string\n negative?: boolean\n }): void\n}\n\n/** The slice of the QUnit global `install` needs. */\nexport interface QUnitLike {\n assert: object\n}\n\nfunction checks(assert: PushResult, subject: Assertable): HarnessAssertions {\n const report = async (\n run: Promise<MatcherResult>,\n negated: boolean,\n message: string | undefined,\n ): Promise<void> => {\n const outcome = await run\n assert.pushResult({\n result: outcome.pass !== negated,\n actual: outcome.observed.actual,\n expected: outcome.observed.expected,\n // QUnit then reports \"Expected: NOT 0\" rather than an equal pair.\n negative: negated,\n // Core's message describes whichever way the check went, so a failed\n // negation already reads \"expected … not to …\".\n message: message ?? outcome.message(),\n })\n }\n\n return {\n isAbsent: message => report(harnessMatchers.toBeAbsent(subject), false, message),\n isPresent: message => report(harnessMatchers.toBeAbsent(subject), true, message),\n isSelected: message => report(harnessMatchers.toBeSelected(subject), false, message),\n isNotSelected: message => report(harnessMatchers.toBeSelected(subject), true, message),\n readsAs: (expected, message) =>\n report(harnessMatchers.toReadAs(subject, expected), false, message),\n doesNotReadAs: (expected, message) =>\n report(harnessMatchers.toReadAs(subject, expected), true, message),\n }\n}\n\n/**\n * Adds `assert.harness(subject)` to every QUnit test. Call once, from\n * `tests/test-helper` in an Ember app, before `start()`:\n *\n * ```ts\n * import QUnit from 'qunit'\n * import { install } from '@harnessed-ts/qunit'\n * install(QUnit)\n *\n * // in a test\n * await assert.harness(banner).isAbsent()\n * await assert.harness(price).readsAs(/^\\$/)\n * ```\n */\nexport function install(qunit: QUnitLike): void {\n Object.defineProperty(qunit.assert, 'harness', {\n configurable: true,\n writable: true,\n value: function harness(this: PushResult, subject: Assertable): HarnessAssertions {\n return checks(this, subject)\n },\n })\n}\n\ndeclare global {\n // QUnit's `assert` is typed as this global interface.\n interface Assert {\n /** Harness checks in the qunit-dom style. Each is async: await it. */\n harness(subject: Assertable): HarnessAssertions\n }\n}\n"]}
@@ -0,0 +1,44 @@
1
+ import type { Assertable } from '@harnessed-ts/core';
2
+ /**
3
+ * The checks `assert.harness(subject)` offers. Each is async — a harness reads
4
+ * the page through a driver — so await it. Every one takes an optional message
5
+ * that replaces the default.
6
+ */
7
+ export interface HarnessAssertions {
8
+ /** Nothing matches. */
9
+ isAbsent(message?: string): Promise<void>;
10
+ /** Something matches. */
11
+ isPresent(message?: string): Promise<void>;
12
+ /** `aria-pressed="true"`. */
13
+ isSelected(message?: string): Promise<void>;
14
+ isNotSelected(message?: string): Promise<void>;
15
+ /** The text equals a string or matches a pattern. */
16
+ readsAs(expected: string | RegExp, message?: string): Promise<void>;
17
+ doesNotReadAs(expected: string | RegExp, message?: string): Promise<void>;
18
+ }
19
+ /** The slice of the QUnit global `install` needs. */
20
+ export interface QUnitLike {
21
+ assert: object;
22
+ }
23
+ /**
24
+ * Adds `assert.harness(subject)` to every QUnit test. Call once, from
25
+ * `tests/test-helper` in an Ember app, before `start()`:
26
+ *
27
+ * ```ts
28
+ * import QUnit from 'qunit'
29
+ * import { install } from '@harnessed-ts/qunit'
30
+ * install(QUnit)
31
+ *
32
+ * // in a test
33
+ * await assert.harness(banner).isAbsent()
34
+ * await assert.harness(price).readsAs(/^\$/)
35
+ * ```
36
+ */
37
+ export declare function install(qunit: QUnitLike): void;
38
+ declare global {
39
+ interface Assert {
40
+ /** Harness checks in the qunit-dom style. Each is async: await it. */
41
+ harness(subject: Assertable): HarnessAssertions;
42
+ }
43
+ }
44
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAiB,MAAM,oBAAoB,CAAA;AAEnE;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,uBAAuB;IACvB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACzC,yBAAyB;IACzB,SAAS,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC1C,6BAA6B;IAC7B,UAAU,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC3C,aAAa,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC9C,qDAAqD;IACrD,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACnE,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAC1E;AAaD,qDAAqD;AACrD,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAA;CACf;AAiCD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAQ9C;AAED,OAAO,CAAC,MAAM,CAAC;IAEb,UAAU,MAAM;QACd,sEAAsE;QACtE,OAAO,CAAC,OAAO,EAAE,UAAU,GAAG,iBAAiB,CAAA;KAChD;CACF"}
package/dist/index.js ADDED
@@ -0,0 +1,39 @@
1
+ import { harnessMatchers } from '@harnessed-ts/core';
2
+
3
+ // src/index.ts
4
+ function checks(assert, subject) {
5
+ const report = async (run, negated, message) => {
6
+ const outcome = await run;
7
+ assert.pushResult({
8
+ result: outcome.pass !== negated,
9
+ actual: outcome.observed.actual,
10
+ expected: outcome.observed.expected,
11
+ // QUnit then reports "Expected: NOT 0" rather than an equal pair.
12
+ negative: negated,
13
+ // Core's message describes whichever way the check went, so a failed
14
+ // negation already reads "expected … not to …".
15
+ message: message ?? outcome.message()
16
+ });
17
+ };
18
+ return {
19
+ isAbsent: (message) => report(harnessMatchers.toBeAbsent(subject), false, message),
20
+ isPresent: (message) => report(harnessMatchers.toBeAbsent(subject), true, message),
21
+ isSelected: (message) => report(harnessMatchers.toBeSelected(subject), false, message),
22
+ isNotSelected: (message) => report(harnessMatchers.toBeSelected(subject), true, message),
23
+ readsAs: (expected, message) => report(harnessMatchers.toReadAs(subject, expected), false, message),
24
+ doesNotReadAs: (expected, message) => report(harnessMatchers.toReadAs(subject, expected), true, message)
25
+ };
26
+ }
27
+ function install(qunit) {
28
+ Object.defineProperty(qunit.assert, "harness", {
29
+ configurable: true,
30
+ writable: true,
31
+ value: function harness(subject) {
32
+ return checks(this, subject);
33
+ }
34
+ });
35
+ }
36
+
37
+ export { install };
38
+ //# sourceMappingURL=index.js.map
39
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;AAqCA,SAAS,MAAA,CAAO,QAAoB,OAAA,EAAwC;AAC1E,EAAA,MAAM,MAAA,GAAS,OACb,GAAA,EACA,OAAA,EACA,OAAA,KACkB;AAClB,IAAA,MAAM,UAAU,MAAM,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EAAO,SAAS,OAAA,CAA0B,OAAA,EAAwC;AAChF,MAAA,OAAO,MAAA,CAAO,MAAM,OAAO,CAAA;AAAA,IAC7B;AAAA,GACD,CAAA;AACH","file":"index.js","sourcesContent":["import { harnessMatchers } from '@harnessed-ts/core'\nimport type { Assertable, MatcherResult } from '@harnessed-ts/core'\n\n/**\n * The checks `assert.harness(subject)` offers. Each is async — a harness reads\n * the page through a driver — so await it. Every one takes an optional message\n * that replaces the default.\n */\nexport interface HarnessAssertions {\n /** Nothing matches. */\n isAbsent(message?: string): Promise<void>\n /** Something matches. */\n isPresent(message?: string): Promise<void>\n /** `aria-pressed=\"true\"`. */\n isSelected(message?: string): Promise<void>\n isNotSelected(message?: string): Promise<void>\n /** The text equals a string or matches a pattern. */\n readsAs(expected: string | RegExp, message?: string): Promise<void>\n doesNotReadAs(expected: string | RegExp, message?: string): Promise<void>\n}\n\n/** The slice of QUnit's `assert` these checks report through. */\ninterface PushResult {\n pushResult(result: {\n result: boolean\n actual: unknown\n expected: unknown\n message: string\n negative?: boolean\n }): void\n}\n\n/** The slice of the QUnit global `install` needs. */\nexport interface QUnitLike {\n assert: object\n}\n\nfunction checks(assert: PushResult, subject: Assertable): HarnessAssertions {\n const report = async (\n run: Promise<MatcherResult>,\n negated: boolean,\n message: string | undefined,\n ): Promise<void> => {\n const outcome = await run\n assert.pushResult({\n result: outcome.pass !== negated,\n actual: outcome.observed.actual,\n expected: outcome.observed.expected,\n // QUnit then reports \"Expected: NOT 0\" rather than an equal pair.\n negative: negated,\n // Core's message describes whichever way the check went, so a failed\n // negation already reads \"expected … not to …\".\n message: message ?? outcome.message(),\n })\n }\n\n return {\n isAbsent: message => report(harnessMatchers.toBeAbsent(subject), false, message),\n isPresent: message => report(harnessMatchers.toBeAbsent(subject), true, message),\n isSelected: message => report(harnessMatchers.toBeSelected(subject), false, message),\n isNotSelected: message => report(harnessMatchers.toBeSelected(subject), true, message),\n readsAs: (expected, message) =>\n report(harnessMatchers.toReadAs(subject, expected), false, message),\n doesNotReadAs: (expected, message) =>\n report(harnessMatchers.toReadAs(subject, expected), true, message),\n }\n}\n\n/**\n * Adds `assert.harness(subject)` to every QUnit test. Call once, from\n * `tests/test-helper` in an Ember app, before `start()`:\n *\n * ```ts\n * import QUnit from 'qunit'\n * import { install } from '@harnessed-ts/qunit'\n * install(QUnit)\n *\n * // in a test\n * await assert.harness(banner).isAbsent()\n * await assert.harness(price).readsAs(/^\\$/)\n * ```\n */\nexport function install(qunit: QUnitLike): void {\n Object.defineProperty(qunit.assert, 'harness', {\n configurable: true,\n writable: true,\n value: function harness(this: PushResult, subject: Assertable): HarnessAssertions {\n return checks(this, subject)\n },\n })\n}\n\ndeclare global {\n // QUnit's `assert` is typed as this global interface.\n interface Assert {\n /** Harness checks in the qunit-dom style. Each is async: await it. */\n harness(subject: Assertable): HarnessAssertions\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,73 @@
1
1
  {
2
2
  "name": "@harnessed-ts/qunit",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.7.0",
4
+ "description": "QUnit assertions for harnesses: `await assert.harness(banner).isAbsent()`, for ember-qunit and any QUnit suite.",
5
+ "keywords": [
6
+ "testing",
7
+ "harness",
8
+ "qunit",
9
+ "ember"
10
+ ],
11
+ "license": "MIT",
12
+ "contributors": [
13
+ {
14
+ "name": "Joe Gaudet",
15
+ "url": "https://github.com/joegaudet"
16
+ },
17
+ {
18
+ "name": "Jay Seo",
19
+ "url": "https://github.com/jayseo5953"
20
+ }
21
+ ],
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/joegaudet/harnessed.git",
25
+ "directory": "packages/qunit"
26
+ },
27
+ "homepage": "https://github.com/joegaudet/harnessed#readme",
28
+ "bugs": "https://github.com/joegaudet/harnessed/issues",
29
+ "type": "module",
30
+ "main": "./dist/index.cjs",
31
+ "module": "./dist/index.js",
32
+ "types": "./dist/index.d.ts",
33
+ "exports": {
34
+ ".": {
35
+ "types": "./dist/index.d.ts",
36
+ "import": "./dist/index.js",
37
+ "require": "./dist/index.cjs"
38
+ },
39
+ "./package.json": "./package.json"
40
+ },
41
+ "files": [
42
+ "dist",
43
+ "CHANGELOG.md",
44
+ "README.md",
45
+ "LICENSE"
46
+ ],
47
+ "engines": {
48
+ "node": ">=22.12.0"
49
+ },
50
+ "dependencies": {
51
+ "@harnessed-ts/core": "^0.7.0"
52
+ },
53
+ "peerDependencies": {
54
+ "qunit": ">=2.19"
55
+ },
56
+ "publishConfig": {
57
+ "access": "public"
58
+ },
59
+ "devDependencies": {
60
+ "@harnessed-ts/dom": "^0.7.0",
61
+ "@testing-library/dom": "^10.4.2",
62
+ "@testing-library/user-event": "^14.6.7",
63
+ "@types/qunit": "^2.19.14",
64
+ "jsdom": "^30.1.1",
65
+ "qunit": "^3.0.0",
66
+ "vitest": "^5.0.3"
67
+ },
68
+ "scripts": {
69
+ "build": "tsup",
70
+ "clean": "rm -rf dist *.tsbuildinfo",
71
+ "test": "vitest run"
72
+ }
6
73
  }