jasmine-browser-runner 2.5.0 → 3.0.0-beta.2

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 CHANGED
@@ -345,13 +345,13 @@ import('./spec/support/jasmine-browser.mjs')
345
345
  jasmine-browser-runner tests itself across popular browsers (Safari, Chrome,
346
346
  Firefox, and Microsoft Edge) as well as Node.
347
347
 
348
- | Environment | Supported versions |
349
- |-------------------|------------------------|
350
- | Node | 18, 20 |
351
- | Safari | 15-17 |
352
- | Chrome | Evergreen |
353
- | Firefox | Evergreen, 102, 115 |
354
- | Edge | Evergreen |
348
+ | Environment | Supported versions |
349
+ |-------------------|----------------------------|
350
+ | Node | 18, 20, 22 |
351
+ | Safari | 15*, 16, 17 |
352
+ | Chrome | Evergreen |
353
+ | Firefox | Evergreen, 102*, 115*, 128 |
354
+ | Edge | Evergreen |
355
355
 
356
356
  For evergreen browsers, each version of jasmine-browser-runner is tested against
357
357
  the version of the browser that is available to us at the time of release. Other
@@ -359,6 +359,11 @@ browsers, as well as older & newer versions of some supported browsers, are
359
359
  likely to work. However, jasmine-browser-runner isn't tested against them and
360
360
  they aren't actively supported.
361
361
 
362
+ \* Environments that are past end of life are supported on a best-effort
363
+ basis. They may be dropped in a future minor release if continued support
364
+ becomes impractical.
365
+
366
+
362
367
  To find out what environments work with a particular Jasmine release, see the [release notes](https://github.com/jasmine/jasmine/tree/main/release_notes).
363
368
 
364
369
  Copyright (c) 2019 Pivotal Labs<br>
package/index.js CHANGED
@@ -56,13 +56,12 @@ module.exports = {
56
56
  /**
57
57
  * Starts a {@link Server} that will serve the specs and supporting files via HTTP.
58
58
  * @param {ServerCtorOptions} options to use to construct the server
59
- * @param {ServerStartOptions} serverOptions Options to use to start the server
60
59
  * @return {Promise<undefined>} A promise that is resolved when the server is
61
60
  * started.
62
61
  */
63
- startServer: function(options, serverOptions) {
62
+ startServer: function(options) {
64
63
  const server = new Server(options);
65
- return server.start(serverOptions || {});
64
+ return server.start();
66
65
  },
67
66
  /**
68
67
  * Runs the specs.
@@ -70,8 +69,18 @@ module.exports = {
70
69
  * @return {Promise<JasmineDoneInfo>} A promise that resolves to the {@link https://jasmine.github.io/api/edge/global.html#JasmineDoneInfo|overall result} when the suite has finished running.
71
70
  */
72
71
  runSpecs: async function(options, deps) {
73
- options = options || {};
72
+ options = { ...options };
74
73
  deps = deps || {};
74
+ const useRemote = options.browser && options.browser.useRemoteSeleniumGrid;
75
+
76
+ if (!options.port) {
77
+ if (useRemote) {
78
+ options.port = 5555;
79
+ } else {
80
+ options.port = 0;
81
+ }
82
+ }
83
+
75
84
  const ServerClass = deps.Server || Server;
76
85
  const RunnerClass = deps.Runner || Runner;
77
86
  const buildWebdriver =
@@ -80,23 +89,11 @@ module.exports = {
80
89
  const server = new ServerClass(options);
81
90
 
82
91
  const reporters = await createReporters(options, deps);
83
- const useLegacySauce = options.browser && options.browser.useSauce;
84
- const useRemote = options.browser && options.browser.useRemoteSeleniumGrid;
85
92
  const useSauceCompletionReporting =
86
- useLegacySauce ||
87
- (useRemote &&
88
- options.browser.remoteSeleniumGrid?.url?.includes('saucelabs.com'));
89
- let portRequest;
90
-
91
- if (options.port) {
92
- portRequest = options.port;
93
- } else if (useLegacySauce || useRemote) {
94
- portRequest = 5555;
95
- } else {
96
- portRequest = 0;
97
- }
93
+ useRemote &&
94
+ options.browser.remoteSeleniumGrid?.url?.includes('saucelabs.com');
98
95
 
99
- await server.start({ port: portRequest });
96
+ await server.start();
100
97
 
101
98
  try {
102
99
  const webdriver = buildWebdriver(options.browser);
package/lib/command.js CHANGED
@@ -80,12 +80,6 @@ const subCommands = [
80
80
  type: 'string',
81
81
  description: 'specify a seed for randomization',
82
82
  },
83
- {
84
- name: 'reporter',
85
- type: 'string',
86
- description:
87
- 'path to reporter to use instead of the default Jasmine reporter',
88
- },
89
83
  {
90
84
  name: 'browser',
91
85
  type: 'string',
@@ -13,7 +13,9 @@ export default {
13
13
  env: {
14
14
  stopSpecOnExpectationFailure: false,
15
15
  stopOnSpecFailure: false,
16
- random: true
16
+ random: true,
17
+ // Fail if a suite contains multiple suites or specs with the same name.
18
+ forbidDuplicateNames: true
17
19
  },
18
20
 
19
21
  // For security, listen only to localhost. You can also specify a different
@@ -17,7 +17,9 @@ export default {
17
17
  env: {
18
18
  stopSpecOnExpectationFailure: false,
19
19
  stopOnSpecFailure: false,
20
- random: true
20
+ random: true,
21
+ // Fail if a suite contains multiple suites or specs with the same name.
22
+ forbidDuplicateNames: true
21
23
  },
22
24
 
23
25
  // For security, listen only to localhost. You can also specify a different
package/lib/server.js CHANGED
@@ -19,8 +19,6 @@ class Server {
19
19
  this.options = { ...options };
20
20
  this._deps = deps || { http, https };
21
21
  this.express = this.options.express || defaultExpress;
22
- this.useHtmlReporter =
23
- options.useHtmlReporter === undefined ? true : options.useHtmlReporter;
24
22
  this.projectBaseDir = options.projectBaseDir || path.resolve();
25
23
  this.jasmineCore = options.jasmineCore || require('./jasmineCore');
26
24
  this.jasmineCssFiles = this.jasmineCore.files.cssFiles.map(function(
@@ -70,10 +68,6 @@ class Server {
70
68
 
71
69
  getSupportFiles() {
72
70
  const result = ['/__support__/loaders.js'];
73
- if (!this.useHtmlReporter) {
74
- result.push('/__support__/clearReporters.js');
75
- }
76
-
77
71
  result.push('/__support__/batchReporter.js');
78
72
  return result;
79
73
  }
@@ -133,11 +127,9 @@ class Server {
133
127
 
134
128
  /**
135
129
  * Starts the server.
136
- * @param {ServerStartOptions} options
137
130
  * @return {Promise<undefined>} A promise that resolves upon successful start.
138
131
  */
139
- start(serverOptions) {
140
- serverOptions = serverOptions || {};
132
+ start() {
141
133
  const app = this.express();
142
134
 
143
135
  app.use('/__jasmine__', this.express.static(this.jasmineCore.files.path));
@@ -220,19 +212,18 @@ class Server {
220
212
  }
221
213
  });
222
214
 
223
- const port = findPort(serverOptions.port, this.options.port);
224
- const tlsCert = serverOptions.tlsCert || this.options.tlsCert;
225
- const tlsKey = serverOptions.tlsKey || this.options.tlsKey;
226
- const hostname = serverOptions.hostname || this.options.hostname;
227
- // The last two fallbacks here are necessary for backwards compatibility.
228
- let listenAddress =
229
- serverOptions.listenAddress ||
230
- this.options.listenAddress ||
231
- hostname ||
232
- '';
233
-
234
- if (listenAddress === '*') {
235
- listenAddress = '';
215
+ const port = this.options.port === undefined ? 8888 : this.options.port;
216
+ const tlsCert = this.options.tlsCert;
217
+ const tlsKey = this.options.tlsKey;
218
+ const hostname = this.options.hostname;
219
+ let listenAddress;
220
+
221
+ if (!this.options.listenAddress) {
222
+ listenAddress = 'localhost';
223
+ } else if (this.options.listenAddress === '*') {
224
+ listenAddress = ''; // all interfaces
225
+ } else {
226
+ listenAddress = this.options.listenAddress;
236
227
  }
237
228
 
238
229
  const listenOptions = {
@@ -332,18 +323,6 @@ class Server {
332
323
  }
333
324
  }
334
325
 
335
- function findPort(serverPort, optionsPort) {
336
- if (typeof serverPort !== 'undefined') {
337
- return serverPort;
338
- }
339
-
340
- if (typeof optionsPort !== 'undefined') {
341
- return optionsPort;
342
- }
343
-
344
- return 8888;
345
- }
346
-
347
326
  function isUrl(s) {
348
327
  return s.startsWith('http://') || s.startsWith('https://');
349
328
  }
package/lib/types.js CHANGED
@@ -8,12 +8,6 @@
8
8
  * certainly want to provide at least specFiles and srcFiles as well.
9
9
  * @see Server
10
10
  */
11
- /**
12
- * Whether to use Jasmine's default HTML reporter.
13
- * @name ServerCtorOptions#useHtmlReporter
14
- * @type boolean | undefined
15
- * @default true
16
- */
17
11
  /**
18
12
  * An array of CSS file paths or {@link https://github.com/isaacs/node-glob#glob-primer|globs}
19
13
  * that match CSS files. Each path or glob will be evaluated relative to
@@ -53,19 +47,15 @@
53
47
  */
54
48
  /**
55
49
  * The hostname or IP address of the network interface to listen on. For
56
- * security, this should be set to localhost or an equivalent unless you need
57
- * the server to be accessible over other network interfaces. Set to "*" to
58
- * listen on all interfaces, which may be required by some remote Selenium
59
- * grids.
50
+ * security, jasmine-browser-runner will listen to localhost unless if this
51
+ * property is not specified. Set to "*" to listen on all interfaces, which may
52
+ * be required by some remote Selenium grids.
60
53
  * @name ServerCtorOptions#listenAddress
61
- * @default The value of {@link ServerCtorOptions#hostname} or {@link ServerStartOptions#hostname} if configured, otherwise "*"
54
+ * @default "localhost"
62
55
  * @type string | undefined
63
56
  */
64
57
  /**
65
- * The hostname to use in the URL given to browsers. For backward compatibility,
66
- * setting this property without also setting {@link ServerCtorOptions#listenAddress}
67
- * or {@link ServerStartOptions#listenAddress} has the same effect as setting
68
- * the listen address to the hostname.
58
+ * The hostname to use in the URL given to browsers.
69
59
  * @name ServerCtorOptions#hostname
70
60
  * @default "localhost"
71
61
  * @type string | undefined
@@ -191,12 +181,6 @@
191
181
  * Describes a web browser.
192
182
  * @interface BrowserInfo
193
183
  */
194
- /**
195
- * Whether to run the specs on {@link https://saucelabs.com/|Saucelabs}.
196
- * Defaults to false.
197
- * @name BrowserInfo#useSauce
198
- * @type boolean | undefined
199
- */
200
184
  /**
201
185
  * Whether to run the specs on a remote Selenium grid.
202
186
  * Defaults to false.
@@ -209,63 +193,11 @@
209
193
  * @name BrowserInfo#name
210
194
  * @type string | undefined
211
195
  */
212
- /**
213
- * Configuration for running specs on {@link https://saucelabs.com/|Saucelabs}
214
- * @name BrowserInfo#sauce
215
- * @type SauceConfig | undefined
216
- */
217
196
  /**
218
197
  * Configuration for running specs on a remote Selenium grid
219
198
  * @name BrowserInfo#remoteSeleniumGrid
220
199
  * @type RemoteSeleniumGridConfig | undefined
221
200
  */
222
-
223
- /**
224
- * Configuration for running specs on {@link https://saucelabs.com/|Saucelabs}
225
- * @interface SauceConfig
226
- */
227
- /**
228
- * Saucelabs username
229
- * @name SauceConfig#username
230
- * @type string
231
- */
232
- /**
233
- * Saucelabs access key
234
- * @name SauceConfig#accessKey
235
- * @type string
236
- */
237
- /**
238
- * Browser version. Omit this to use the latest version of the specified browser.
239
- * @name SauceConfig#browserVersion
240
- * @type string
241
- */
242
- /**
243
- * Identifier of the Sauce Connect tunnel to use.
244
- * @name SauceConfig#tunnelIdentifier
245
- * @type string
246
- */
247
- /**
248
- * Operating system to run the browser on.
249
- *
250
- * _Note_: It's best to omit this property
251
- * unless you really need your specs to run on a specific OS. If you omit it,
252
- * Saucelabs will select a suitable OS. If you specify an unsupported combination
253
- * of os and browserVersion, Saucelabs will select a different browser version
254
- * that's available on the specified OS.
255
- * @name SauceConfig#os
256
- * @type string
257
- */
258
- /**
259
- * Build identifier to pass to Saucelabs
260
- * @name SauceConfig#build
261
- * @type string
262
- */
263
- /**
264
- * Tags to pass to Saucelabs
265
- * @name SauceConfig#tags
266
- * @type Array.<string>
267
- */
268
-
269
201
  /**
270
202
  * Configuration for running specs on a remote Selenium grid
271
203
  * Any additional properties, such as "sauce:options" or "bstack:options", will
@@ -292,37 +224,6 @@
292
224
  * @type string
293
225
  */
294
226
 
295
- /**
296
- * Options passed to {@link Server#start}
297
- * @interface
298
- * @name ServerStartOptions
299
- */
300
- /**
301
- * The port number to listen on.
302
- * @name ServerStartOptions#port
303
- * @type number | undefined
304
- */
305
- /**
306
- * The path to a TLS key. Activates HTTPS mode. If specified, tlsCert must also
307
- * be specified.
308
- * @name ServerStartOptions#tlsKey
309
- * @type string
310
- */
311
- /**
312
- * The path to a TLS cert. Activates HTTPS mode. If specified, tlsKey must also
313
- * be specified.
314
- * @name ServerStartOptions#tlsCert
315
- * @type string
316
- */
317
- /**
318
- * @see ServerCtorOptions#hostname
319
- * @name ServerStartOptions#hostname
320
- */
321
- /**
322
- * @see ServerCtorOptions#listenAddress
323
- * @name ServerStartOptions#listenAddress
324
- */
325
-
326
227
  /**
327
228
  * Describes an import map.
328
229
  * @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script/type/importmap}
package/lib/webdriver.js CHANGED
@@ -3,7 +3,6 @@ function buildWebdriver(browserInfo, webdriverBuilder) {
3
3
  Capability = webdriver.Capability;
4
4
 
5
5
  webdriverBuilder = webdriverBuilder || new webdriver.Builder();
6
- const useSauce = typeof browserInfo === 'object' && browserInfo.useSauce;
7
6
  const useRemote =
8
7
  typeof browserInfo === 'object' && browserInfo.useRemoteSeleniumGrid;
9
8
  let browserName;
@@ -16,7 +15,7 @@ function buildWebdriver(browserInfo, webdriverBuilder) {
16
15
 
17
16
  browserName = browserName || 'firefox';
18
17
 
19
- if (!(useRemote || useSauce)) {
18
+ if (!useRemote) {
20
19
  if (browserName === 'headlessChrome') {
21
20
  const caps = webdriver.Capabilities.chrome();
22
21
  caps.set('goog:chromeOptions', {
@@ -58,29 +57,6 @@ function buildWebdriver(browserInfo, webdriverBuilder) {
58
57
  };
59
58
  delete capabilities.url;
60
59
  }
61
- } else if (useSauce) {
62
- // handle legacy `sauce` object
63
- console.warn(
64
- 'Deprecation warning: Direct support for Saucelabs is deprecated and ' +
65
- 'will be removed in a future release. Please use Saucelabs via the ' +
66
- 'remote Selenium grid feature. See the jasmine-browser-runner README ' +
67
- 'for details.'
68
- );
69
- const sauce = browserInfo.sauce;
70
- if (sauce) {
71
- url = `http://${sauce.username}:${sauce.accessKey}@ondemand.saucelabs.com/wd/hub`;
72
- capabilities = {
73
- [Capability.BROWSER_NAME]: browserName,
74
- build: sauce.build,
75
- tags: sauce.tags,
76
- };
77
-
78
- capabilities[Capability.PLATFORM_NAME] = sauce.os;
79
- capabilities[Capability.BROWSER_VERSION] = sauce.browserVersion;
80
- capabilities['sauce:options'] = {
81
- 'tunnel-identifier': sauce.tunnelIdentifier,
82
- };
83
- }
84
60
  }
85
61
 
86
62
  if (!capabilities) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jasmine-browser-runner",
3
- "version": "2.5.0",
3
+ "version": "3.0.0-beta.2",
4
4
  "description": "Serve and run your Jasmine specs in a browser",
5
5
  "bin": "bin/jasmine-browser-runner",
6
6
  "exports": "./index.js",
@@ -38,19 +38,18 @@
38
38
  "homepage": "https://github.com/jasmine/jasmine-browser-runner#readme",
39
39
  "dependencies": {
40
40
  "ejs": "^3.1.6",
41
- "express": "^4.19.2",
41
+ "express": "^5.0.0",
42
42
  "glob": "^10.0.0",
43
43
  "selenium-webdriver": "^4.12.0"
44
44
  },
45
45
  "peerDependencies": {
46
- "jasmine-core": "^5.0.0"
46
+ "jasmine-core": "^5.5.0"
47
47
  },
48
48
  "devDependencies": {
49
- "ejs-lint": "^2.0.0",
50
49
  "eslint": "^8.50.0",
51
50
  "eslint-plugin-jasmine": "^4.1.3",
52
51
  "jasmine": "^5.0.0",
53
- "jasmine-core": "^5.0.0",
52
+ "jasmine-core": "^5.5.0",
54
53
  "prettier": "^1.17.1",
55
54
  "shelljs": "^0.8.3",
56
55
  "temp": "^0.9.4"
@@ -1,2 +0,0 @@
1
- /* eslint-env browser, jasmine */
2
- jasmine.getEnv().clearReporters();