karma-qunit 4.2.2 → 4.2.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/lib/adapter.js +35 -68
- package/package.json +9 -10
package/lib/adapter.js
CHANGED
|
@@ -20,12 +20,6 @@ function createQUnitStartFn (tc, runnerPassedIn) { // eslint-disable-line no-unu
|
|
|
20
20
|
return function () {
|
|
21
21
|
var FIXTURE_ID = 'qunit-fixture'
|
|
22
22
|
var runner = runnerPassedIn || window.QUnit
|
|
23
|
-
var totalNumberOfTest = 0
|
|
24
|
-
var timer = null
|
|
25
|
-
var testResult = {
|
|
26
|
-
errors: []
|
|
27
|
-
}
|
|
28
|
-
var supportsTestTracking = false
|
|
29
23
|
var config = (tc.config && tc.config.qunit) || {}
|
|
30
24
|
var qunitOldTimeout = 13
|
|
31
25
|
|
|
@@ -35,79 +29,48 @@ function createQUnitStartFn (tc, runnerPassedIn) { // eslint-disable-line no-unu
|
|
|
35
29
|
document.body.appendChild(ui)
|
|
36
30
|
}
|
|
37
31
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
if (
|
|
51
|
-
fixture =
|
|
52
|
-
fixture.id = FIXTURE_ID
|
|
53
|
-
document.body.appendChild(fixture)
|
|
54
|
-
if (typeof runner.config.fixture === 'undefined') {
|
|
55
|
-
runner.config.fixture = ''
|
|
56
|
-
}
|
|
32
|
+
runner.begin(function (args) {
|
|
33
|
+
tc.info({ total: args.totalTests })
|
|
34
|
+
|
|
35
|
+
if (typeof document !== 'undefined' && document.getElementById && document.createElement && document.body) {
|
|
36
|
+
// Create a qunit-fixture element to match behaviour of regular qunit runner.
|
|
37
|
+
// The fixture is only created once when the runner begins.
|
|
38
|
+
// Resetting is handled by qunit
|
|
39
|
+
var fixture = document.getElementById(FIXTURE_ID)
|
|
40
|
+
if (!fixture) {
|
|
41
|
+
fixture = document.createElement('div')
|
|
42
|
+
fixture.id = FIXTURE_ID
|
|
43
|
+
document.body.appendChild(fixture)
|
|
44
|
+
if (typeof runner.config.fixture === 'undefined') {
|
|
45
|
+
runner.config.fixture = ''
|
|
57
46
|
}
|
|
58
47
|
}
|
|
59
|
-
})
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
runner.done(function () {
|
|
63
|
-
if (!supportsTestTracking) {
|
|
64
|
-
tc.info({ total: totalNumberOfTest })
|
|
65
48
|
}
|
|
49
|
+
})
|
|
66
50
|
|
|
51
|
+
runner.done(function () {
|
|
67
52
|
tc.complete({
|
|
68
53
|
coverage: window.__coverage__
|
|
69
54
|
})
|
|
70
55
|
})
|
|
71
56
|
|
|
72
|
-
runner.
|
|
73
|
-
totalNumberOfTest += 1
|
|
74
|
-
timer = new Date().getTime()
|
|
75
|
-
testResult = { success: true, errors: [] }
|
|
76
|
-
})
|
|
77
|
-
|
|
78
|
-
runner.log(function (details) {
|
|
79
|
-
if (!details.result) {
|
|
80
|
-
var msg = ''
|
|
81
|
-
|
|
82
|
-
if (details.message) {
|
|
83
|
-
msg += details.message + '\n'
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
if (typeof details.expected !== 'undefined') {
|
|
87
|
-
msg += 'Expected: ' + runner.dump.parse(details.expected) + '\n' + 'Actual: ' + runner.dump.parse(details.actual) + '\n'
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
if (details.source) {
|
|
91
|
-
msg += details.source + '\n'
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
testResult.success = false
|
|
95
|
-
testResult.errors.push(msg)
|
|
96
|
-
}
|
|
97
|
-
})
|
|
98
|
-
|
|
99
|
-
runner.testDone(function (test) {
|
|
57
|
+
runner.on('testEnd', function (test) {
|
|
100
58
|
var result = {
|
|
101
59
|
description: test.name,
|
|
102
|
-
suite: (test.
|
|
103
|
-
success:
|
|
104
|
-
skipped: test.skipped,
|
|
105
|
-
log:
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
60
|
+
suite: (test.suiteName && [test.suiteName]) || [],
|
|
61
|
+
success: test.status === 'passed' || test.status === 'skipped' || test.status === 'todo',
|
|
62
|
+
skipped: test.status === 'skipped',
|
|
63
|
+
log: (test.errors || []).map(function (details) {
|
|
64
|
+
var msg = details.message + '\n'
|
|
65
|
+
if (details.expected !== undefined) {
|
|
66
|
+
msg += 'Expected: ' + runner.dump.parse(details.expected) + '\n' + 'Actual: ' + runner.dump.parse(details.actual) + '\n'
|
|
67
|
+
}
|
|
68
|
+
if (details.stack) {
|
|
69
|
+
msg += details.stack + '\n'
|
|
70
|
+
}
|
|
71
|
+
return msg
|
|
72
|
+
}),
|
|
73
|
+
time: test.runtime
|
|
111
74
|
}
|
|
112
75
|
|
|
113
76
|
tc.result(result)
|
|
@@ -125,6 +88,10 @@ function createQUnitStartFn (tc, runnerPassedIn) { // eslint-disable-line no-unu
|
|
|
125
88
|
//
|
|
126
89
|
// https://github.com/karma-runner/karma-qunit/issues/27
|
|
127
90
|
if (config.autostart !== false) {
|
|
91
|
+
// If config.autostart is undefined (default) or explicitly true,
|
|
92
|
+
// start when Karma is ready. Otherwise, if the user explicitly
|
|
93
|
+
// sets it to false (instead of merely karma-qunit setting it to false),
|
|
94
|
+
// then we step out of the way and let the user call QUnit.start.
|
|
128
95
|
setTimeout(function () {
|
|
129
96
|
runner.start()
|
|
130
97
|
}, qunitOldTimeout)
|
package/package.json
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "karma-qunit",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.3",
|
|
4
4
|
"description": "A Karma plugin. Adapter for QUnit testing framework.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "grunt build",
|
|
8
|
-
"lint": "eslint .",
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"unit": "qunit test/lib",
|
|
13
|
-
"test": "npm run lint && npm run build && npm run karma && npm run unit"
|
|
8
|
+
"lint": "eslint --cache .",
|
|
9
|
+
"lint-fix": "eslint --cache --fix .",
|
|
10
|
+
"unit": "qunit test/",
|
|
11
|
+
"test": "npm run lint && npm run build && npm run unit"
|
|
14
12
|
},
|
|
15
13
|
"repository": {
|
|
16
14
|
"type": "git",
|
|
@@ -43,12 +41,13 @@
|
|
|
43
41
|
"grunt-npm": "0.0.2",
|
|
44
42
|
"karma": "^6.3.9",
|
|
45
43
|
"karma-firefox-launcher": "^2.1.2",
|
|
46
|
-
"karma-
|
|
47
|
-
"qunit": "^3.0.0"
|
|
44
|
+
"karma-mocha-reporter": "^2.2.5",
|
|
45
|
+
"qunit": "^2.26.0 || ^3.0.0",
|
|
46
|
+
"sinon": "^12.0.1"
|
|
48
47
|
},
|
|
49
48
|
"peerDependencies": {
|
|
50
49
|
"karma": "^4.0.0 || ^5.0.0 || ^6.0.0",
|
|
51
|
-
"qunit": ">=2.
|
|
50
|
+
"qunit": ">=2.2.0"
|
|
52
51
|
},
|
|
53
52
|
"license": "MIT",
|
|
54
53
|
"contributors": [
|