karma-qunit 4.1.2 → 4.2.1

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 (3) hide show
  1. package/README.md +4 -8
  2. package/lib/adapter.js +19 -19
  3. package/package.json +20 -25
package/README.md CHANGED
@@ -1,9 +1,6 @@
1
1
  # karma-qunit
2
2
 
3
- [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/karma-runner/karma-qunit)
4
- [![npm version](https://img.shields.io/npm/v/karma-qunit.svg?style=flat-square)](https://www.npmjs.com/package/karma-qunit) [![npm downloads](https://img.shields.io/npm/dm/karma-qunit.svg?style=flat-square)](https://www.npmjs.com/package/karma-qunit)
5
-
6
- [![Build Status](https://img.shields.io/github/workflow/status/karma-runner/karma-qunit/Tests/master?style=flat-square)](https://github.com/karma-runner/karma-qunit/actions?workflow=Tests)
3
+ [![npm version](https://img.shields.io/npm/v/karma-qunit?style=flat-square&logo=npm&logoColor=fff)](https://www.npmjs.com/package/karma-qunit) [![Build Status](https://img.shields.io/github/actions/workflow/status/karma-runner/karma-qunit/test.yml?style=flat-square&logo=github&branch=master)](https://github.com/karma-runner/karma-qunit/actions/workflows/test.yml?query=workflow%3ATests+branch%3Amaster) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen?style=flat-square)](https://github.com/karma-runner/karma-qunit) [![npm downloads](https://img.shields.io/npm/dm/karma-qunit?style=flat-square)](https://www.npmjs.com/package/karma-qunit)
7
4
 
8
5
  > Adapter for the [QUnit](https://qunitjs.com/) testing framework.
9
6
 
@@ -12,14 +9,13 @@
12
9
  The easiest way is to keep `karma-qunit` as a devDependency in your `package.json` by running
13
10
 
14
11
  ```bash
15
- $ npm install karma-qunit --save-dev
12
+ npm install karma-qunit --save-dev
16
13
  ```
17
14
 
18
15
  ## Configuration
19
16
 
20
17
  Add `qunit` in the `frameworks` array in your `karma.conf.js` file. Then, in the `plugins`
21
- array, add `karma-qunit`.
22
- The following code shows the default configuration:
18
+ array, add `karma-qunit`. The following code shows the default configuration:
23
19
 
24
20
  ```js
25
21
  // karma.conf.js
@@ -64,4 +60,4 @@ Note: `showUI: true` needs the `clearContext: false` option to display correctly
64
60
 
65
61
  For more information on Karma see the [homepage]. If you're using `karma-qunit` to test Ember.js, you might find Karma's [Ember guide](https://karma-runner.github.io/latest/plus/emberjs.html) helpful.
66
62
 
67
- [homepage]: https://karma-runner.github.com/
63
+ [homepage]: https://karma-runner.github.io/
package/lib/adapter.js CHANGED
@@ -2,15 +2,15 @@
2
2
 
3
3
  'use strict'
4
4
 
5
- function createQUnitConfig (karma, defaultConfig) { // eslint-disable-line no-unused-vars
6
- var config = defaultConfig || {}
7
-
8
- if (!karma.config || !karma.config.qunit) {
9
- return config
5
+ function createQUnitConfig (karma) { // eslint-disable-line no-unused-vars
6
+ var config = {
7
+ autostart: false
10
8
  }
11
9
 
12
- for (var key in karma.config.qunit) {
13
- config[key] = karma.config.qunit[key]
10
+ if (karma.config && karma.config.qunit) {
11
+ for (var key in karma.config.qunit) {
12
+ config[key] = karma.config.qunit[key]
13
+ }
14
14
  }
15
15
 
16
16
  return config
@@ -113,9 +113,17 @@ function createQUnitStartFn (tc, runnerPassedIn) { // eslint-disable-line no-unu
113
113
  tc.result(result)
114
114
  })
115
115
 
116
- runner.load()
117
-
118
- // honor autostart config, useful for tests loaded asynchronously
116
+ // karma-qunit uses `QUnit.config.autostart = false` internally
117
+ // so window.__karma__.start (points to here) controls QUnit.start
118
+ // and thus naturally waits for any file-loading karma plugins
119
+ // (especially async like AMD/RequireJS).
120
+ //
121
+ // ensure the the option to turn off QUnit autostart is also
122
+ // available to end-users, by letting them set `qunit.autostart: false`
123
+ // in karma.config.js. The end-user may then call QUnit.start() when
124
+ // they are ready.
125
+ //
126
+ // https://github.com/karma-runner/karma-qunit/issues/27
119
127
  if (config.autostart !== false) {
120
128
  setTimeout(function () {
121
129
  runner.start()
@@ -124,19 +132,11 @@ function createQUnitStartFn (tc, runnerPassedIn) { // eslint-disable-line no-unu
124
132
  }
125
133
  }
126
134
 
127
- var config = createQUnitConfig(window.__karma__, {
128
- autostart: false
129
- });
135
+ var config = createQUnitConfig(window.__karma__);
130
136
 
131
137
  for (var key in config) {
132
138
  window.QUnit.config[key] = config[key];
133
139
  }
134
140
 
135
- if (window.removeEventListener) {
136
- window.removeEventListener('load', window.QUnit.load, false);
137
- } else if (window.detachEvent) {
138
- window.detachEvent('onload', window.QUnit.load);
139
- }
140
-
141
141
  window.__karma__.start = createQUnitStartFn(window.__karma__);
142
142
  })(typeof window !== 'undefined' ? window : global);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "karma-qunit",
3
- "version": "4.1.2",
3
+ "version": "4.2.1",
4
4
  "description": "A Karma plugin. Adapter for QUnit testing framework.",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -32,47 +32,42 @@
32
32
  "author": "Vojta Jina <vojta.jina@gmail.com>",
33
33
  "dependencies": {},
34
34
  "devDependencies": {
35
- "chai": "^4.2.0",
36
- "eslint": "^6.8.0",
37
- "eslint-config-standard": "^14.1.1",
38
- "eslint-plugin-import": "^2.22.1",
35
+ "chai": "^4.3.4",
36
+ "eslint": "^7.32.0",
37
+ "eslint-config-standard": "^15.0.1",
38
+ "eslint-plugin-import": "^2.25.3",
39
39
  "eslint-plugin-node": "^11.1.0",
40
- "eslint-plugin-promise": "^4.2.1",
40
+ "eslint-plugin-promise": "^5.2.0",
41
41
  "eslint-plugin-standard": "^4.1.0",
42
- "grunt": "1.1.0",
42
+ "grunt": "^1.4.1",
43
43
  "grunt-bump": "^0.8.0",
44
44
  "grunt-npm": "0.0.2",
45
- "karma": "^5.2.3",
46
- "karma-chrome-launcher": "^3.1.0",
47
- "karma-firefox-launcher": "^1.3.0",
48
- "karma-jasmine": "^3.3.1",
49
- "mocha": "^7.2.0",
50
- "qunit": "^2.14.0"
45
+ "karma": "^6.3.9",
46
+ "karma-firefox-launcher": "^2.1.2",
47
+ "karma-jasmine": "^4.0.1",
48
+ "mocha": "^9.1.3",
49
+ "qunit": "^2.17.2"
51
50
  },
52
51
  "peerDependencies": {
53
52
  "karma": "^4.0.0 || ^5.0.0 || ^6.0.0",
54
- "qunit": "^2.0.0"
53
+ "qunit": ">=2.1.1"
55
54
  },
56
55
  "license": "MIT",
57
56
  "contributors": [
58
- "Vojta Jina <vojta.jina@gmail.com>",
59
57
  "Friedel Ziegelmayer <dignifiedquire@gmail.com>",
60
- "dignifiedquire <dignifiedquire@gmail.com>",
58
+ "XhmikosR <xhmikosr@gmail.com>",
59
+ "Vojta Jina <vojta.jina@gmail.com>",
60
+ "dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>",
61
61
  "johnjbarton <johnjbarton@johnjbarton.com>",
62
+ "Timo Tijhof <krinkle@fastmail.com>",
62
63
  "Matt DuVall <matt@stripe.com>",
64
+ "masubi <justin.masui@gmail.com>",
63
65
  "Johann-S <johann.servoire@gmail.com>",
64
- "Timo Tijhof <krinklemail@gmail.com>",
65
- "dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>",
66
- "Friedel Ziegelmayer <friedel.ziegelmayer@gmail.com>",
66
+ "Aymeric Beaumet <hi@aymericbeaumet.com>",
67
67
  "Mark Ethan Trostler <mark@zzo.com>",
68
68
  "Stefan Sechelmann <stefan@sechel.de>",
69
- "masubi <justin.masui@gmail.com>",
70
- "Aymeric Beaumet <aymeric@beaumet.me>",
71
- "Ulrich Block <u.block@sap.com>",
72
- "masubi <masubi@users.noreply.github.com>",
73
- "Aliaksei Sapach <aliaksei.dreamsonic@gmail.com>",
74
69
  "Aliaksei Sapach <dreamsonic@tut.by>",
75
- "Aymeric Beaumet <aymeric.beaumet@gmail.com>",
70
+ "Ulrich Block <u.block@sap.com>",
76
71
  "Brian Donovan <donovan@squareup.com>",
77
72
  "Daniel Herman <daniel.c.herman@gmail.com>",
78
73
  "Kristof Neirynck <k.neirynck@gmail.com>",