qunitx 0.6.1 → 0.8.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.
Files changed (48) hide show
  1. package/README.md +5 -7
  2. package/build.js +54 -0
  3. package/deno.json +2 -2
  4. package/deno.lock +7 -3752
  5. package/package.json +21 -40
  6. package/{index.js → shims/browser/index.js} +2 -4
  7. package/shims/{deno-assert.js → deno/assert.js} +2 -2
  8. package/shims/{deno.js → deno/index.js} +1 -1
  9. package/shims/{nodejs-assert.js → node/assert.js} +1 -0
  10. package/shims/{nodejs.js → node/index.js} +2 -2
  11. package/vendor/package.json +1 -4
  12. package/cli.js +0 -24
  13. package/deno/cli.js +0 -21
  14. package/deno-bridge.js +0 -16
  15. package/lib/boilerplates/default-project-config-values.js +0 -6
  16. package/lib/boilerplates/setup/tests.hbs +0 -15
  17. package/lib/boilerplates/setup/tsconfig.json +0 -109
  18. package/lib/boilerplates/test.js +0 -25
  19. package/lib/commands/generate.js +0 -33
  20. package/lib/commands/help.js +0 -38
  21. package/lib/commands/init.js +0 -70
  22. package/lib/commands/run/tests-in-browser.js +0 -162
  23. package/lib/commands/run/tests-in-node.js +0 -60
  24. package/lib/commands/run.js +0 -159
  25. package/lib/servers/http.js +0 -233
  26. package/lib/setup/bind-server-to-port.js +0 -14
  27. package/lib/setup/browser.js +0 -55
  28. package/lib/setup/config.js +0 -46
  29. package/lib/setup/file-watcher.js +0 -72
  30. package/lib/setup/fs-tree.js +0 -48
  31. package/lib/setup/keyboard-events.js +0 -57
  32. package/lib/setup/node-js-environment.js +0 -74
  33. package/lib/setup/test-file-paths.js +0 -79
  34. package/lib/setup/web-server.js +0 -241
  35. package/lib/setup/write-output-static-files.js +0 -22
  36. package/lib/tap/display-final-result.js +0 -15
  37. package/lib/tap/display-test-result.js +0 -73
  38. package/lib/utils/find-internal-assets-from-html.js +0 -16
  39. package/lib/utils/find-project-root.js +0 -16
  40. package/lib/utils/indent-string.js +0 -11
  41. package/lib/utils/listen-to-keyboard-key.js +0 -42
  42. package/lib/utils/parse-cli-flags.js +0 -59
  43. package/lib/utils/path-exists.js +0 -11
  44. package/lib/utils/resolve-port-number-for.js +0 -27
  45. package/lib/utils/run-user-module.js +0 -18
  46. package/lib/utils/search-in-parent-directories.js +0 -15
  47. package/lib/utils/time-counter.js +0 -8
  48. package/test-output.log +0 -781
package/README.md CHANGED
@@ -58,27 +58,25 @@ $ node --test some-test.js
58
58
 
59
59
  # Suggested mode: if you want to run it in CI/google chrome:
60
60
 
61
- $ qunitx some-test.js --browser
61
+ $ qunitx some-test.js
62
62
 
63
63
  # with browser output enabled:
64
64
 
65
- $ qunitx some-test.js --browser --debug
65
+ $ qunitx some-test.js --debug
66
66
 
67
67
  # TypeScript also works, make sure on node.js mode, tsconfig.json exists with compilerOptions.module & compilerOptions.moduleResolution set to "NodeNext":
68
68
 
69
69
  $ node --loader=ts-node/esm/transpile-only --test some-test.ts
70
70
 
71
- $ qunitx some-test.ts --browser --debug
71
+ $ qunitx some-test.ts --debug
72
72
 
73
73
  ```
74
74
 
75
75
  ### Code coverage
76
76
 
77
- QUnitX runner on node.js mode(without --browser) supports code coverage with c8, the best coverage tool
78
- in existence at the moment:
79
-
77
+ Since QUnitX proxies to default node.js test runner in when executed with node, you can use any code coverage tool you like. When running the tests in `qunit`(the browser mode) code coverage support is limited.
80
78
  ```
81
- c8 qunitx test/attachments test/user
79
+ c8 node test/attachments test/user
82
80
  ```
83
81
 
84
82
  You can browse [c8 documentation](https://github.com/bcoe/c8) for all configuration options.
package/build.js ADDED
@@ -0,0 +1,54 @@
1
+ import fs from 'fs/promises';
2
+
3
+ let [qunitJS, qunitCSS, _] = await Promise.all([
4
+ fs.readFile('./node_modules/qunit/qunit/qunit.js'),
5
+ fs.readFile('./node_modules/qunit/qunit/qunit.css'),
6
+ fs.mkdir('./vendor', { recursive: true })
7
+ ]);
8
+
9
+ let newQUnit = qunitJS.toString().replace(
10
+ 'start: function start(count) {',
11
+ `reset: function() {
12
+ ProcessingQueue.finished = false;
13
+ globalStartCalled = false;
14
+ runStarted = false;
15
+
16
+ config.queue.length = 0;
17
+ config.modules.length = 0;
18
+ config.autostart = false;
19
+
20
+ Object.assign(config.stats, { total: 0, passed: 0, failed: 0, skipped: 0, todo: 0 });
21
+
22
+ [
23
+ "started", "updateRate", "filter", "depth", "current",
24
+ "pageLoaded", "timeoutHandler", "timeout", "pollution"
25
+ ].forEach( ( key ) => delete config[ key ] );
26
+
27
+ const suiteReport = config.currentModule.suiteReport;
28
+
29
+ suiteReport.childSuites.length = 0;
30
+ delete suiteReport._startTime;
31
+ delete suiteReport._endTime;
32
+
33
+ config.modules.push( config.currentModule );
34
+ },
35
+ start: function start(count) {`);
36
+
37
+ await Promise.all([
38
+ fs.writeFile('./vendor/qunit.js', newQUnit),
39
+ fs.writeFile('./vendor/qunit.css', qunitCSS),
40
+ createPackageJSONIfNotExists()
41
+ ]);
42
+
43
+ async function createPackageJSONIfNotExists() {
44
+ try {
45
+ await fs.stat('./vendor/package.json');
46
+
47
+ return true;
48
+ } catch (error) {
49
+ await fs.writeFile('./vendor/package.json', JSON.stringify({
50
+ name: 'qunitx-vendor',
51
+ version: '0.0.1'
52
+ }));
53
+ }
54
+ }
package/deno.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "imports": {
3
- "qunitx": "./shims/deno.js"
3
+ "qunitx": "./shims/deno/index.js"
4
4
  }
5
- }
5
+ }