jasmine-browser-runner 1.1.0 → 1.3.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 -4
- package/index.js +23 -5
- package/lib/console_reporter.js +11 -5
- package/lib/server.js +25 -2
- package/lib/types.js +7 -0
- package/package.json +4 -5
package/README.md
CHANGED
|
@@ -185,11 +185,10 @@ active tunnel.
|
|
|
185
185
|
## Want more control?
|
|
186
186
|
|
|
187
187
|
```javascript
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
jasmineCore = require('../../lib/jasmine-core.js');
|
|
188
|
+
const path = require('path');
|
|
189
|
+
const jasmineBrowser = require('jasmine-browser-runner');
|
|
191
190
|
|
|
192
|
-
|
|
191
|
+
const config = require(path.resolve('spec/support/jasmine-browser.json'));
|
|
193
192
|
config.projectBaseDir = path.resolve('some/path');
|
|
194
193
|
|
|
195
194
|
jasmineBrowser.startServer(config, { port: 4321 });
|
package/index.js
CHANGED
|
@@ -4,12 +4,17 @@ const ConsoleReporter = require('./lib/console_reporter'),
|
|
|
4
4
|
Runner = require('./lib/runner'),
|
|
5
5
|
ModuleLoader = require('./lib/moduleLoader');
|
|
6
6
|
|
|
7
|
-
async function createReporters(options) {
|
|
7
|
+
async function createReporters(options, deps) {
|
|
8
8
|
const result = [];
|
|
9
9
|
|
|
10
10
|
if (options.useConsoleReporter !== false) {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
deps = deps || {};
|
|
12
|
+
const ReporterCtor = deps.ConsoleReporter || ConsoleReporter;
|
|
13
|
+
const consoleReporter = new ReporterCtor();
|
|
14
|
+
consoleReporter.setOptions({
|
|
15
|
+
color: options.color,
|
|
16
|
+
alwaysListPendingSpecs: options.alwaysListPendingSpecs,
|
|
17
|
+
});
|
|
13
18
|
result.push(consoleReporter);
|
|
14
19
|
}
|
|
15
20
|
|
|
@@ -74,9 +79,22 @@ module.exports = {
|
|
|
74
79
|
const setExitCode = deps.setExitCode || (code => (process.exitCode = code));
|
|
75
80
|
const server = new ServerClass(options);
|
|
76
81
|
|
|
77
|
-
const reporters = await createReporters(options);
|
|
82
|
+
const reporters = await createReporters(options, deps);
|
|
78
83
|
const useSauce = options.browser && options.browser.useSauce;
|
|
79
|
-
|
|
84
|
+
let portRequest;
|
|
85
|
+
|
|
86
|
+
if (useSauce) {
|
|
87
|
+
if (options.port) {
|
|
88
|
+
throw new Error("Can't specify a port when browser.useSauce is true");
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
portRequest = 5555;
|
|
92
|
+
} else if (options.port) {
|
|
93
|
+
portRequest = options.port;
|
|
94
|
+
} else {
|
|
95
|
+
portRequest = 0;
|
|
96
|
+
}
|
|
97
|
+
|
|
80
98
|
await server.start({ port: portRequest });
|
|
81
99
|
|
|
82
100
|
try {
|
package/lib/console_reporter.js
CHANGED
|
@@ -22,6 +22,7 @@ function ConsoleReporter() {
|
|
|
22
22
|
failureCount,
|
|
23
23
|
failedSpecs = [],
|
|
24
24
|
pendingSpecs = [],
|
|
25
|
+
alwaysListPendingSpecs = true,
|
|
25
26
|
ansi = {
|
|
26
27
|
green: '\x1B[32m',
|
|
27
28
|
red: '\x1B[31m',
|
|
@@ -61,6 +62,9 @@ function ConsoleReporter() {
|
|
|
61
62
|
if (options.stackFilter) {
|
|
62
63
|
stackFilter = options.stackFilter;
|
|
63
64
|
}
|
|
65
|
+
if (options.alwaysListPendingSpecs !== undefined) {
|
|
66
|
+
alwaysListPendingSpecs = options.alwaysListPendingSpecs;
|
|
67
|
+
}
|
|
64
68
|
};
|
|
65
69
|
|
|
66
70
|
this.jasmineStarted = function(options) {
|
|
@@ -101,11 +105,13 @@ function ConsoleReporter() {
|
|
|
101
105
|
suiteFailureDetails(result);
|
|
102
106
|
}
|
|
103
107
|
|
|
104
|
-
if (
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
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
|
+
}
|
|
109
115
|
}
|
|
110
116
|
|
|
111
117
|
if (specCount > 0) {
|
package/lib/server.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
const express = require('express'),
|
|
2
2
|
glob = require('glob'),
|
|
3
3
|
ejs = require('ejs'),
|
|
4
4
|
path = require('path'),
|
|
5
|
-
fs = require('fs')
|
|
5
|
+
fs = require('fs'),
|
|
6
|
+
os = require('os');
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* @class Server
|
|
@@ -29,6 +30,28 @@ class Server {
|
|
|
29
30
|
return unWindows(path.join('/__jasmine__', fileName));
|
|
30
31
|
})
|
|
31
32
|
.concat(this.bootFiles());
|
|
33
|
+
|
|
34
|
+
// Validate globs
|
|
35
|
+
const isWindows = (options.platform || os.platform)() === 'win32';
|
|
36
|
+
for (const globs of [
|
|
37
|
+
options.specFiles,
|
|
38
|
+
options.srcFiles,
|
|
39
|
+
options.helpers,
|
|
40
|
+
]) {
|
|
41
|
+
if (globs) {
|
|
42
|
+
for (const g of globs) {
|
|
43
|
+
if (isWindows && g.includes('\\')) {
|
|
44
|
+
const fixed = g.replace(/\\/g, '/');
|
|
45
|
+
console.warn(
|
|
46
|
+
'Backslashes in file paths behave inconsistently ' +
|
|
47
|
+
'between platforms and might not be treated as directory ' +
|
|
48
|
+
'separators in a future version. Consider changing ' +
|
|
49
|
+
`${g} to ${fixed}.`
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
32
55
|
}
|
|
33
56
|
|
|
34
57
|
bootFiles() {
|
package/lib/types.js
CHANGED
|
@@ -104,6 +104,13 @@
|
|
|
104
104
|
* @type boolean | undefined
|
|
105
105
|
* @default true
|
|
106
106
|
*/
|
|
107
|
+
/**
|
|
108
|
+
* Whether the default reporter should list pending specs even if there are
|
|
109
|
+
* failures.
|
|
110
|
+
* @name Configuration#alwaysListPendingSpecs
|
|
111
|
+
* @type boolean | undefined
|
|
112
|
+
* @default true
|
|
113
|
+
*/
|
|
107
114
|
|
|
108
115
|
/**
|
|
109
116
|
* Describes a web browser.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jasmine-browser-runner",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.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,10 +17,9 @@
|
|
|
17
17
|
"lib/examples/default_esm_config.json"
|
|
18
18
|
],
|
|
19
19
|
"scripts": {
|
|
20
|
-
"posttest": "eslint bin/* lib spec
|
|
20
|
+
"posttest": "eslint bin/* lib spec index.js --ignore-path=.styleIgnore && prettier --check --ignore-path=.styleIgnore \"lib/**/*.js\" \"spec/**/*.js\" index.js",
|
|
21
21
|
"test": "jasmine",
|
|
22
|
-
"cleanup": "prettier --write --ignore-path=.styleIgnore \"lib/**/*.js\" \"spec/**/*.js\"
|
|
23
|
-
"release": "node scripts/release.js"
|
|
22
|
+
"cleanup": "prettier --write --ignore-path=.styleIgnore \"lib/**/*.js\" \"spec/**/*.js\" index.js"
|
|
24
23
|
},
|
|
25
24
|
"repository": {
|
|
26
25
|
"type": "git",
|
|
@@ -41,7 +40,7 @@
|
|
|
41
40
|
"ejs": "^3.1.6",
|
|
42
41
|
"express": "^4.16.4",
|
|
43
42
|
"glob": "^7.1.7",
|
|
44
|
-
"selenium-webdriver": "
|
|
43
|
+
"selenium-webdriver": ">=4.1.0 <4.8.0"
|
|
45
44
|
},
|
|
46
45
|
"peerDependencies": {
|
|
47
46
|
"jasmine-core": "^4.0.0"
|