jasmine-browser-runner 2.5.0 → 3.0.0-beta.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.
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-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
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/server.js CHANGED
@@ -133,11 +133,9 @@ class Server {
133
133
 
134
134
  /**
135
135
  * Starts the server.
136
- * @param {ServerStartOptions} options
137
136
  * @return {Promise<undefined>} A promise that resolves upon successful start.
138
137
  */
139
- start(serverOptions) {
140
- serverOptions = serverOptions || {};
138
+ start() {
141
139
  const app = this.express();
142
140
 
143
141
  app.use('/__jasmine__', this.express.static(this.jasmineCore.files.path));
@@ -220,19 +218,18 @@ class Server {
220
218
  }
221
219
  });
222
220
 
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 = '';
221
+ const port = this.options.port === undefined ? 8888 : this.options.port;
222
+ const tlsCert = this.options.tlsCert;
223
+ const tlsKey = this.options.tlsKey;
224
+ const hostname = this.options.hostname;
225
+ let listenAddress;
226
+
227
+ if (!this.options.listenAddress) {
228
+ listenAddress = 'localhost';
229
+ } else if (this.options.listenAddress === '*') {
230
+ listenAddress = ''; // all interfaces
231
+ } else {
232
+ listenAddress = this.options.listenAddress;
236
233
  }
237
234
 
238
235
  const listenOptions = {
@@ -332,18 +329,6 @@ class Server {
332
329
  }
333
330
  }
334
331
 
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
332
  function isUrl(s) {
348
333
  return s.startsWith('http://') || s.startsWith('https://');
349
334
  }
package/lib/types.js CHANGED
@@ -53,19 +53,15 @@
53
53
  */
54
54
  /**
55
55
  * 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.
56
+ * security, jasmine-browser-runner will listen to localhost unless if this
57
+ * property is not specified. Set to "*" to listen on all interfaces, which may
58
+ * be required by some remote Selenium grids.
60
59
  * @name ServerCtorOptions#listenAddress
61
- * @default The value of {@link ServerCtorOptions#hostname} or {@link ServerStartOptions#hostname} if configured, otherwise "*"
60
+ * @default "localhost"
62
61
  * @type string | undefined
63
62
  */
64
63
  /**
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.
64
+ * The hostname to use in the URL given to browsers.
69
65
  * @name ServerCtorOptions#hostname
70
66
  * @default "localhost"
71
67
  * @type string | undefined
@@ -191,12 +187,6 @@
191
187
  * Describes a web browser.
192
188
  * @interface BrowserInfo
193
189
  */
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
190
  /**
201
191
  * Whether to run the specs on a remote Selenium grid.
202
192
  * Defaults to false.
@@ -209,63 +199,11 @@
209
199
  * @name BrowserInfo#name
210
200
  * @type string | undefined
211
201
  */
212
- /**
213
- * Configuration for running specs on {@link https://saucelabs.com/|Saucelabs}
214
- * @name BrowserInfo#sauce
215
- * @type SauceConfig | undefined
216
- */
217
202
  /**
218
203
  * Configuration for running specs on a remote Selenium grid
219
204
  * @name BrowserInfo#remoteSeleniumGrid
220
205
  * @type RemoteSeleniumGridConfig | undefined
221
206
  */
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
207
  /**
270
208
  * Configuration for running specs on a remote Selenium grid
271
209
  * Any additional properties, such as "sauce:options" or "bstack:options", will
@@ -292,37 +230,6 @@
292
230
  * @type string
293
231
  */
294
232
 
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
233
  /**
327
234
  * Describes an import map.
328
235
  * @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.1",
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,7 +38,7 @@
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
  },
@@ -46,7 +46,6 @@
46
46
  "jasmine-core": "^5.0.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",