qunitx 0.9.1 → 0.9.3

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/flake.lock ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "nodes": {
3
+ "flake-utils": {
4
+ "locked": {
5
+ "lastModified": 1659877975,
6
+ "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
7
+ "owner": "numtide",
8
+ "repo": "flake-utils",
9
+ "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
10
+ "type": "github"
11
+ },
12
+ "original": {
13
+ "owner": "numtide",
14
+ "repo": "flake-utils",
15
+ "type": "github"
16
+ }
17
+ },
18
+ "napalm": {
19
+ "inputs": {
20
+ "flake-utils": "flake-utils",
21
+ "nixpkgs": [
22
+ "nixpkgs"
23
+ ]
24
+ },
25
+ "locked": {
26
+ "lastModified": 1672245824,
27
+ "narHash": "sha256-i596lbPiA/Rfx3DiJiCluxdgxWY7oGSgYMT7OmM+zik=",
28
+ "owner": "nix-community",
29
+ "repo": "napalm",
30
+ "rev": "7c25a05cef52dc405f4688422ce0046ca94aadcf",
31
+ "type": "github"
32
+ },
33
+ "original": {
34
+ "owner": "nix-community",
35
+ "repo": "napalm",
36
+ "type": "github"
37
+ }
38
+ },
39
+ "nixpkgs": {
40
+ "locked": {
41
+ "lastModified": 1690860117,
42
+ "narHash": "sha256-srkCfjMlg777HxDVMfhkIFgRhhtuZjIOIyR2ejLYK+Y=",
43
+ "owner": "NixOS",
44
+ "repo": "nixpkgs",
45
+ "rev": "96d403ee2479f2070050353b94808209f1352edb",
46
+ "type": "github"
47
+ },
48
+ "original": {
49
+ "owner": "NixOS",
50
+ "ref": "nixpkgs-unstable",
51
+ "repo": "nixpkgs",
52
+ "type": "github"
53
+ }
54
+ },
55
+ "root": {
56
+ "inputs": {
57
+ "napalm": "napalm",
58
+ "nixpkgs": "nixpkgs"
59
+ }
60
+ }
61
+ },
62
+ "root": "root",
63
+ "version": 7
64
+ }
package/flake.nix ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ description = "A flake for qunitx npm package";
3
+
4
+ inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
5
+ inputs.napalm.url = "github:nix-community/napalm";
6
+
7
+ # NOTE: This is optional, but is how to configure napalm's env
8
+ inputs.napalm.inputs.nixpkgs.follows = "nixpkgs";
9
+
10
+ outputs = { self, nixpkgs, napalm }:
11
+ let
12
+ system = "x86_64-linux";
13
+ pkgs = nixpkgs.legacyPackages."${system}";
14
+ in {
15
+ packages."${system}".default = napalm.legacyPackages."${system}".buildPackage ./. {
16
+ nodejs = pkgs.nodejs_20;
17
+ PUPPETEER_SKIP_DOWNLOAD=1;
18
+ };
19
+
20
+ devShells."${system}".default = pkgs.mkShell {
21
+ nativeBuildInputs = with pkgs; [
22
+ deno
23
+ nodejs_20
24
+ ];
25
+ };
26
+ };
27
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "qunitx",
3
3
  "type": "module",
4
- "version": "0.9.1",
4
+ "version": "0.9.3",
5
5
  "description": "A universal test framework for testing any js file on node.js, browser or deno with QUnit API",
6
6
  "author": "Izel Nakri",
7
7
  "license": "MIT",
@@ -75,7 +75,7 @@
75
75
  "release": "node_modules/.bin/release-it",
76
76
  "test": "npm run test:browser && npm run test:node && npm run test:deno",
77
77
  "test:dev": "npm run test | tee test-output.log",
78
- "test:browser": "qunitx test/index.js --debug",
78
+ "test:browser": "node_modules/.bin/qunitx test/index.js --debug",
79
79
  "test:deno": "deno test --allow-read --allow-env --allow-run test/index.js",
80
80
  "test:node": "node --test test/index.js"
81
81
  },
@@ -83,9 +83,9 @@
83
83
  "auto-changelog": "^2.4.0",
84
84
  "prettier": "^3.0.0",
85
85
  "qunit": "^2.19.4",
86
- "qunitx": "^0.8.0",
87
- "qunitx-cli": "^0.1.0",
88
- "release-it": "^16.1.0",
86
+ "qunitx": "^0.9.1",
87
+ "qunitx-cli": "^0.1.1",
88
+ "release-it": "^16.1.3",
89
89
  "ts-node": ">=10.7.0"
90
90
  },
91
91
  "volta": {
@@ -12,7 +12,7 @@ export class AssertionError extends DenoAssertionError {
12
12
  }
13
13
  }
14
14
 
15
- Assert.QUnit = QUnit;
15
+ Assert.QUnit = globalThis.QUnit;
16
16
  Assert.AssertionError = AssertionError;
17
17
  ModuleContext.Assert = Assert;
18
18
  TestContext.Assert = Assert;
@@ -13,14 +13,13 @@ export default function test(testName, runtimeOptions, testContent) {
13
13
  let context = new TestContext(testName, moduleContext);
14
14
 
15
15
  return it(testName, { concurrency: true, ...targetRuntimeOptions }, async function () {
16
- let result;
17
16
  for (let module of context.module.moduleChain) {
18
17
  for (let hook of module.beforeEachHooks) {
19
18
  await hook.call(context, context.assert);
20
19
  }
21
20
  }
22
21
 
23
- result = await targetTestContent.call(context, context.assert, { testName, options: runtimeOptions });
22
+ let result = await targetTestContent.call(context, context.assert, { testName, options: runtimeOptions });
24
23
 
25
24
  await context.assert.waitForAsyncOps();
26
25
 
@@ -13,14 +13,13 @@ export default function test(testName, runtimeOptions, testContent) {
13
13
  let context = new TestContext(testName, moduleContext);
14
14
 
15
15
  return it(testName, { concurrency: true, ...targetRuntimeOptions }, async function () {
16
- let result;
17
16
  for (let module of context.module.moduleChain) {
18
17
  for (let hook of module.beforeEachHooks) {
19
18
  await hook.call(context, context.assert);
20
19
  }
21
20
  }
22
21
 
23
- result = await targetTestContent.call(context, context.assert, { testName, options: runtimeOptions });
22
+ let result = await targetTestContent.call(context, context.assert, { testName, options: runtimeOptions });
24
23
 
25
24
  await context.assert.waitForAsyncOps();
26
25
 
@@ -115,7 +115,7 @@ export default class Assert {
115
115
  if (state !== false) {
116
116
  throw new Assert.AssertionError({
117
117
  actual: state,
118
- expected: true,
118
+ expected: false,
119
119
  message: message || `Expected argument to be false, it was: ${inspect(state)}`,
120
120
  stackStartFn: this.false,
121
121
  });
@@ -10,28 +10,10 @@ export default class ModuleContext {
10
10
 
11
11
  context = new TestContext();
12
12
 
13
- #tests = [];
14
- get tests() {
15
- return this.#tests;
16
- }
17
-
18
- #beforeEachHooks = [];
19
- get beforeEachHooks() {
20
- return this.#beforeEachHooks;
21
- }
22
-
23
- #afterEachHooks = [];
24
- get afterEachHooks() {
25
- return this.#afterEachHooks;
26
- }
27
-
28
- #moduleChain = [];
29
- get moduleChain() {
30
- return this.#moduleChain;
31
- }
32
- set moduleChain(value) {
33
- this.#moduleChain = value;
34
- }
13
+ moduleChain = [];
14
+ beforeEachHooks = [];
15
+ afterEachHooks = [];
16
+ tests = [];
35
17
 
36
18
  constructor(name) {
37
19
  let parentModule = ModuleContext.currentModuleChain[ModuleContext.currentModuleChain.length - 1];