jasmine-browser-runner 3.0.0 → 4.0.0-beta.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/README.md +3 -3
- package/index.js +5 -2
- package/package.json +13 -80
- package/lib/console_reporter.js +0 -317
package/README.md
CHANGED
|
@@ -300,7 +300,7 @@ export default {
|
|
|
300
300
|
"url": "https://ondemand.saucelabs.com/wd/hub",
|
|
301
301
|
"platformName": "macOS 12",
|
|
302
302
|
"sauce:options": {
|
|
303
|
-
"
|
|
303
|
+
"tunnelName": "the same tunnel name that was provided to Sauce Connect",
|
|
304
304
|
"userName": "your Saucelabs username",
|
|
305
305
|
"accessKey": "your Saucelabs access key"
|
|
306
306
|
}
|
|
@@ -353,8 +353,8 @@ Firefox, and Microsoft Edge) as well as Node.
|
|
|
353
353
|
|
|
354
354
|
| Environment | Supported versions |
|
|
355
355
|
|-------------------|----------------------------|
|
|
356
|
-
| Node |
|
|
357
|
-
| Safari |
|
|
356
|
+
| Node | 20, 22, 24 |
|
|
357
|
+
| Safari | 16*, 17* |
|
|
358
358
|
| Chrome | Evergreen |
|
|
359
359
|
| Firefox | Evergreen, 102*, 115*, 128 |
|
|
360
360
|
| Edge | Evergreen |
|
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const ConsoleReporter = require('
|
|
1
|
+
const ConsoleReporter = require('@jasminejs/reporters/console');
|
|
2
2
|
const webdriverModule = require('./lib/webdriver');
|
|
3
3
|
const Server = require('./lib/server');
|
|
4
4
|
const Runner = require('./lib/runner');
|
|
@@ -11,9 +11,12 @@ async function createReporters(options, deps) {
|
|
|
11
11
|
deps = deps || {};
|
|
12
12
|
const ReporterCtor = deps.ConsoleReporter || ConsoleReporter;
|
|
13
13
|
const consoleReporter = new ReporterCtor();
|
|
14
|
-
consoleReporter.
|
|
14
|
+
consoleReporter.configure({
|
|
15
15
|
color: options.color,
|
|
16
16
|
alwaysListPendingSpecs: options.alwaysListPendingSpecs,
|
|
17
|
+
randomSeedReproductionCmd(seed) {
|
|
18
|
+
return 'jasmine-browser-runner runSpecs --seed=' + seed;
|
|
19
|
+
},
|
|
17
20
|
});
|
|
18
21
|
result.push(consoleReporter);
|
|
19
22
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jasmine-browser-runner",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-beta.0",
|
|
4
4
|
"description": "Serve and run your Jasmine specs in a browser",
|
|
5
5
|
"bin": "bin/jasmine-browser-runner",
|
|
6
6
|
"exports": "./index.js",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"lib/examples/default_esm_config.mjs"
|
|
18
18
|
],
|
|
19
19
|
"scripts": {
|
|
20
|
-
"posttest": "eslint
|
|
20
|
+
"posttest": "eslint && prettier --check --ignore-path=.styleIgnore \"lib/**/*.js\" \"spec/**/*.js\" index.js",
|
|
21
21
|
"test": "jasmine",
|
|
22
22
|
"cleanup": "prettier --write --ignore-path=.styleIgnore \"lib/**/*.js\" \"spec/**/*.js\" index.js"
|
|
23
23
|
},
|
|
@@ -37,94 +37,27 @@
|
|
|
37
37
|
},
|
|
38
38
|
"homepage": "https://github.com/jasmine/jasmine-browser-runner#readme",
|
|
39
39
|
"dependencies": {
|
|
40
|
+
"@jasminejs/reporters": "^0.1.0",
|
|
40
41
|
"ejs": "^3.1.6",
|
|
41
42
|
"express": "^5.0.0",
|
|
42
|
-
"glob": "^10.0.0",
|
|
43
|
+
"glob": "^10.2.2 || ^11.0.3 || ^12.0.0 || ^13.0.0",
|
|
43
44
|
"selenium-webdriver": "^4.12.0"
|
|
44
45
|
},
|
|
45
46
|
"peerDependencies": {
|
|
46
|
-
"jasmine-core": "
|
|
47
|
+
"jasmine-core": "6.0.0-beta.1"
|
|
47
48
|
},
|
|
48
49
|
"devDependencies": {
|
|
49
|
-
"eslint": "^
|
|
50
|
-
"eslint
|
|
51
|
-
"
|
|
52
|
-
"jasmine
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
50
|
+
"@eslint/eslintrc": "^3.3.1",
|
|
51
|
+
"@eslint/js": "^9.29.0",
|
|
52
|
+
"eslint": "^9.29.0",
|
|
53
|
+
"eslint-plugin-jasmine": "^4.2.2",
|
|
54
|
+
"globals": "^16.2.0",
|
|
55
|
+
"jasmine": "github:jasmine/jasmine-npm",
|
|
56
|
+
"jasmine-core": "6.0.0-beta.1",
|
|
57
|
+
"prettier": "^1.17.1"
|
|
56
58
|
},
|
|
57
59
|
"prettier": {
|
|
58
60
|
"singleQuote": true,
|
|
59
61
|
"trailingComma": "es5"
|
|
60
|
-
},
|
|
61
|
-
"eslintConfig": {
|
|
62
|
-
"env": {
|
|
63
|
-
"commonjs": true,
|
|
64
|
-
"es6": true,
|
|
65
|
-
"node": true
|
|
66
|
-
},
|
|
67
|
-
"extends": "eslint:recommended",
|
|
68
|
-
"globals": {
|
|
69
|
-
"Atomics": "readonly",
|
|
70
|
-
"SharedArrayBuffer": "readonly",
|
|
71
|
-
"expectAsync": "readonly"
|
|
72
|
-
},
|
|
73
|
-
"parserOptions": {
|
|
74
|
-
"ecmaVersion": 2022
|
|
75
|
-
},
|
|
76
|
-
"plugins": [
|
|
77
|
-
"jasmine"
|
|
78
|
-
],
|
|
79
|
-
"rules": {
|
|
80
|
-
"quotes": [
|
|
81
|
-
"error",
|
|
82
|
-
"single",
|
|
83
|
-
{
|
|
84
|
-
"avoidEscape": true
|
|
85
|
-
}
|
|
86
|
-
],
|
|
87
|
-
"no-unused-vars": [
|
|
88
|
-
"error",
|
|
89
|
-
{
|
|
90
|
-
"args": "none"
|
|
91
|
-
}
|
|
92
|
-
],
|
|
93
|
-
"block-spacing": "error",
|
|
94
|
-
"comma-dangle": [
|
|
95
|
-
"error",
|
|
96
|
-
{
|
|
97
|
-
"arrays": "always-multiline",
|
|
98
|
-
"objects": "always-multiline",
|
|
99
|
-
"imports": "always-multiline",
|
|
100
|
-
"exports": "always-multiline",
|
|
101
|
-
"functions": "never"
|
|
102
|
-
}
|
|
103
|
-
],
|
|
104
|
-
"eqeqeq": "error",
|
|
105
|
-
"func-call-spacing": [
|
|
106
|
-
"error",
|
|
107
|
-
"never"
|
|
108
|
-
],
|
|
109
|
-
"key-spacing": "error",
|
|
110
|
-
"no-tabs": "error",
|
|
111
|
-
"no-trailing-spaces": "error",
|
|
112
|
-
"no-whitespace-before-property": "error",
|
|
113
|
-
"semi": [
|
|
114
|
-
"error",
|
|
115
|
-
"always"
|
|
116
|
-
],
|
|
117
|
-
"space-before-blocks": "error",
|
|
118
|
-
"no-console": "off",
|
|
119
|
-
"no-var": "error"
|
|
120
|
-
},
|
|
121
|
-
"overrides": [
|
|
122
|
-
{
|
|
123
|
-
"files": "spec/**/*.js",
|
|
124
|
-
"env": {
|
|
125
|
-
"jasmine": true
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
]
|
|
129
62
|
}
|
|
130
63
|
}
|
package/lib/console_reporter.js
DELETED
|
@@ -1,317 +0,0 @@
|
|
|
1
|
-
const util = require('util');
|
|
2
|
-
module.exports = exports = ConsoleReporter;
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @classdesc A reporter that prints spec and suite results to the console.
|
|
6
|
-
* A ConsoleReporter is installed unless {@link Configuration#useConsoleReporter}
|
|
7
|
-
* is set to false.
|
|
8
|
-
*
|
|
9
|
-
* @constructor
|
|
10
|
-
* @example
|
|
11
|
-
* const {ConsoleReporter} = require('jasmine');
|
|
12
|
-
* const reporter = new ConsoleReporter();
|
|
13
|
-
*/
|
|
14
|
-
function ConsoleReporter() {
|
|
15
|
-
let print = function() {
|
|
16
|
-
process.stdout.write(util.format.apply(this, arguments));
|
|
17
|
-
},
|
|
18
|
-
showColors = true,
|
|
19
|
-
jasmineCorePath = null,
|
|
20
|
-
specCount,
|
|
21
|
-
executableSpecCount,
|
|
22
|
-
failureCount,
|
|
23
|
-
failedSpecs = [],
|
|
24
|
-
pendingSpecs = [],
|
|
25
|
-
alwaysListPendingSpecs = true,
|
|
26
|
-
ansi = {
|
|
27
|
-
green: '\x1B[32m',
|
|
28
|
-
red: '\x1B[31m',
|
|
29
|
-
yellow: '\x1B[33m',
|
|
30
|
-
none: '\x1B[0m',
|
|
31
|
-
},
|
|
32
|
-
failedSuites = [],
|
|
33
|
-
stackFilter = defaultStackFilter;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Configures the reporter.
|
|
37
|
-
* @function
|
|
38
|
-
* @name ConsoleReporter#setOptions
|
|
39
|
-
* @param {ConsoleReporterOptions} options
|
|
40
|
-
*/
|
|
41
|
-
this.setOptions = function(options) {
|
|
42
|
-
if (options.print) {
|
|
43
|
-
print = options.print;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* @interface ConsoleReporterOptions
|
|
48
|
-
*/
|
|
49
|
-
/**
|
|
50
|
-
* Whether to colorize the output
|
|
51
|
-
* @name ConsoleReporterOptions#color
|
|
52
|
-
* @type Boolean|undefined
|
|
53
|
-
* @default true
|
|
54
|
-
*/
|
|
55
|
-
if (options.color !== undefined) {
|
|
56
|
-
showColors = options.color;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (options.jasmineCorePath) {
|
|
60
|
-
jasmineCorePath = options.jasmineCorePath;
|
|
61
|
-
}
|
|
62
|
-
if (options.stackFilter) {
|
|
63
|
-
stackFilter = options.stackFilter;
|
|
64
|
-
}
|
|
65
|
-
if (options.alwaysListPendingSpecs !== undefined) {
|
|
66
|
-
alwaysListPendingSpecs = options.alwaysListPendingSpecs;
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
this.jasmineStarted = function(options) {
|
|
71
|
-
specCount = 0;
|
|
72
|
-
executableSpecCount = 0;
|
|
73
|
-
failureCount = 0;
|
|
74
|
-
if (options && options.order && options.order.random) {
|
|
75
|
-
print('Randomized with seed ' + options.order.seed);
|
|
76
|
-
printNewline();
|
|
77
|
-
}
|
|
78
|
-
print('Started');
|
|
79
|
-
printNewline();
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
this.jasmineDone = function(result) {
|
|
83
|
-
if (result.failedExpectations) {
|
|
84
|
-
failureCount += result.failedExpectations.length;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
printNewline();
|
|
88
|
-
printNewline();
|
|
89
|
-
if (failedSpecs.length > 0) {
|
|
90
|
-
print('Failures:');
|
|
91
|
-
}
|
|
92
|
-
for (let i = 0; i < failedSpecs.length; i++) {
|
|
93
|
-
specFailureDetails(failedSpecs[i], i + 1);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
for (let i = 0; i < failedSuites.length; i++) {
|
|
97
|
-
suiteFailureDetails(failedSuites[i]);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
if (
|
|
101
|
-
result &&
|
|
102
|
-
result.failedExpectations &&
|
|
103
|
-
result.failedExpectations.length > 0
|
|
104
|
-
) {
|
|
105
|
-
suiteFailureDetails(result);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
if (alwaysListPendingSpecs || result.overallStatus === 'passed') {
|
|
109
|
-
if (pendingSpecs.length > 0) {
|
|
110
|
-
print('Pending:');
|
|
111
|
-
}
|
|
112
|
-
for (let i = 0; i < pendingSpecs.length; i++) {
|
|
113
|
-
pendingSpecDetails(pendingSpecs[i], i + 1);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
if (specCount > 0) {
|
|
118
|
-
printNewline();
|
|
119
|
-
|
|
120
|
-
if (executableSpecCount !== specCount) {
|
|
121
|
-
print(
|
|
122
|
-
'Ran ' +
|
|
123
|
-
executableSpecCount +
|
|
124
|
-
' of ' +
|
|
125
|
-
specCount +
|
|
126
|
-
plural(' spec', specCount)
|
|
127
|
-
);
|
|
128
|
-
printNewline();
|
|
129
|
-
}
|
|
130
|
-
let specCounts =
|
|
131
|
-
executableSpecCount +
|
|
132
|
-
' ' +
|
|
133
|
-
plural('spec', executableSpecCount) +
|
|
134
|
-
', ' +
|
|
135
|
-
failureCount +
|
|
136
|
-
' ' +
|
|
137
|
-
plural('failure', failureCount);
|
|
138
|
-
|
|
139
|
-
if (pendingSpecs.length) {
|
|
140
|
-
specCounts +=
|
|
141
|
-
', ' +
|
|
142
|
-
pendingSpecs.length +
|
|
143
|
-
' pending ' +
|
|
144
|
-
plural('spec', pendingSpecs.length);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
print(specCounts);
|
|
148
|
-
} else {
|
|
149
|
-
print('No specs found');
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
printNewline();
|
|
153
|
-
const seconds = result ? result.totalTime / 1000 : 0;
|
|
154
|
-
print('Finished in ' + seconds + ' ' + plural('second', seconds));
|
|
155
|
-
printNewline();
|
|
156
|
-
|
|
157
|
-
if (result && result.overallStatus === 'incomplete') {
|
|
158
|
-
print('Incomplete: ' + result.incompleteReason);
|
|
159
|
-
printNewline();
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
if (result && result.order && result.order.random) {
|
|
163
|
-
print('Randomized with seed ' + result.order.seed);
|
|
164
|
-
print(
|
|
165
|
-
' (jasmine-browser-runner runSpecs --seed=' + result.order.seed + ')'
|
|
166
|
-
);
|
|
167
|
-
printNewline();
|
|
168
|
-
}
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
this.specDone = function(result) {
|
|
172
|
-
specCount++;
|
|
173
|
-
|
|
174
|
-
if (result.status === 'pending') {
|
|
175
|
-
pendingSpecs.push(result);
|
|
176
|
-
executableSpecCount++;
|
|
177
|
-
print(colored('yellow', '*'));
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
if (result.status === 'passed') {
|
|
182
|
-
executableSpecCount++;
|
|
183
|
-
print(colored('green', '.'));
|
|
184
|
-
return;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
if (result.status === 'failed') {
|
|
188
|
-
failureCount++;
|
|
189
|
-
failedSpecs.push(result);
|
|
190
|
-
executableSpecCount++;
|
|
191
|
-
print(colored('red', 'F'));
|
|
192
|
-
}
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
this.suiteDone = function(result) {
|
|
196
|
-
if (result.failedExpectations && result.failedExpectations.length > 0) {
|
|
197
|
-
failureCount++;
|
|
198
|
-
failedSuites.push(result);
|
|
199
|
-
}
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
return this;
|
|
203
|
-
|
|
204
|
-
function printNewline() {
|
|
205
|
-
print('\n');
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
function colored(color, str) {
|
|
209
|
-
return showColors ? ansi[color] + str + ansi.none : str;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
function plural(str, count) {
|
|
213
|
-
return count === 1 ? str : str + 's';
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
function repeat(thing, times) {
|
|
217
|
-
const arr = [];
|
|
218
|
-
for (let i = 0; i < times; i++) {
|
|
219
|
-
arr.push(thing);
|
|
220
|
-
}
|
|
221
|
-
return arr;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
function indent(str, spaces) {
|
|
225
|
-
const lines = (str || '').split('\n');
|
|
226
|
-
const newArr = [];
|
|
227
|
-
for (let i = 0; i < lines.length; i++) {
|
|
228
|
-
newArr.push(repeat(' ', spaces).join('') + lines[i]);
|
|
229
|
-
}
|
|
230
|
-
return newArr.join('\n');
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
function defaultStackFilter(stack) {
|
|
234
|
-
if (!stack) {
|
|
235
|
-
return '';
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
const filteredStack = stack
|
|
239
|
-
.split('\n')
|
|
240
|
-
.filter(function(stackLine) {
|
|
241
|
-
return stackLine.indexOf(jasmineCorePath) === -1;
|
|
242
|
-
})
|
|
243
|
-
.join('\n');
|
|
244
|
-
return filteredStack;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
function specFailureDetails(result, failedSpecNumber) {
|
|
248
|
-
printNewline();
|
|
249
|
-
print(failedSpecNumber + ') ');
|
|
250
|
-
print(result.fullName);
|
|
251
|
-
printFailedExpectations(result);
|
|
252
|
-
|
|
253
|
-
if (result.debugLogs) {
|
|
254
|
-
printNewline();
|
|
255
|
-
print(indent('Debug logs:', 2));
|
|
256
|
-
printNewline();
|
|
257
|
-
|
|
258
|
-
for (const entry of result.debugLogs) {
|
|
259
|
-
print(indent(`${entry.timestamp}ms: ${entry.message}`, 4));
|
|
260
|
-
printNewline();
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
function suiteFailureDetails(result) {
|
|
266
|
-
printNewline();
|
|
267
|
-
print('Suite error: ' + result.fullName);
|
|
268
|
-
printFailedExpectations(result);
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
function printFailedExpectations(result) {
|
|
272
|
-
for (let i = 0; i < result.failedExpectations.length; i++) {
|
|
273
|
-
const failedExpectation = result.failedExpectations[i];
|
|
274
|
-
printNewline();
|
|
275
|
-
print(indent('Message:', 2));
|
|
276
|
-
printNewline();
|
|
277
|
-
print(colored('red', indent(failedExpectation.message, 4)));
|
|
278
|
-
printNewline();
|
|
279
|
-
print(indent('Stack:', 2));
|
|
280
|
-
printNewline();
|
|
281
|
-
print(indent(stackFilter(failedExpectation.stack), 4));
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
// When failSpecWithNoExpectations = true and a spec fails because of no expectations found,
|
|
285
|
-
// jasmine-core reports it as a failure with no message.
|
|
286
|
-
//
|
|
287
|
-
// Therefore we assume that when there are no failed or passed expectations,
|
|
288
|
-
// the failure was because of our failSpecWithNoExpectations setting.
|
|
289
|
-
//
|
|
290
|
-
// Same logic is used by jasmine.HtmlReporter, see https://github.com/jasmine/jasmine/blob/main/src/html/HtmlReporter.js
|
|
291
|
-
if (
|
|
292
|
-
result.failedExpectations.length === 0 &&
|
|
293
|
-
result.passedExpectations.length === 0
|
|
294
|
-
) {
|
|
295
|
-
printNewline();
|
|
296
|
-
print(indent('Message:', 2));
|
|
297
|
-
printNewline();
|
|
298
|
-
print(colored('red', indent('Spec has no expectations', 4)));
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
printNewline();
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
function pendingSpecDetails(result, pendingSpecNumber) {
|
|
305
|
-
printNewline();
|
|
306
|
-
printNewline();
|
|
307
|
-
print(pendingSpecNumber + ') ');
|
|
308
|
-
print(result.fullName);
|
|
309
|
-
printNewline();
|
|
310
|
-
let pendingReason = 'No reason given';
|
|
311
|
-
if (result.pendingReason && result.pendingReason !== '') {
|
|
312
|
-
pendingReason = result.pendingReason;
|
|
313
|
-
}
|
|
314
|
-
print(indent(colored('yellow', pendingReason), 2));
|
|
315
|
-
printNewline();
|
|
316
|
-
}
|
|
317
|
-
}
|