cypress 9.2.1 → 9.4.1
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/tasks/download.js +8 -7
- package/lib/tasks/verify.js +1 -1
- package/lib/util.js +24 -8
- package/package.json +5 -4
- package/types/cypress-eventemitter.d.ts +4 -0
- package/types/cypress.d.ts +46 -0
- package/types/sinon/index.d.ts +227 -217
- package/types/sinon/ts3.1/index.d.ts +0 -1789
package/lib/tasks/download.js
CHANGED
@@ -8,7 +8,7 @@ const is = require('check-more-types');
|
|
8
8
|
|
9
9
|
const os = require('os');
|
10
10
|
|
11
|
-
const
|
11
|
+
const url = require('url');
|
12
12
|
|
13
13
|
const path = require('path');
|
14
14
|
|
@@ -77,9 +77,10 @@ const getCA = () => {
|
|
77
77
|
};
|
78
78
|
|
79
79
|
const prepend = urlPath => {
|
80
|
-
const endpoint =
|
80
|
+
const endpoint = url.resolve(getBaseUrl(), urlPath);
|
81
81
|
const platform = os.platform();
|
82
|
-
|
82
|
+
const pathTemplate = util.getEnv('CYPRESS_DOWNLOAD_PATH_TEMPLATE');
|
83
|
+
return pathTemplate ? pathTemplate.replace('${endpoint}', endpoint).replace('${platform}', platform).replace('${arch}', arch()) : `${endpoint}?platform=${platform}&arch=${arch()}`;
|
83
84
|
};
|
84
85
|
|
85
86
|
const getUrl = version => {
|
@@ -300,7 +301,7 @@ const downloadFromUrl = ({
|
|
300
301
|
});
|
301
302
|
};
|
302
303
|
/**
|
303
|
-
* Download Cypress.zip from external
|
304
|
+
* Download Cypress.zip from external versionUrl to local file.
|
304
305
|
* @param [string] version Could be "3.3.0" or full URL
|
305
306
|
* @param [string] downloadDestination Local filename to save as
|
306
307
|
*/
|
@@ -326,17 +327,17 @@ const start = opts => {
|
|
326
327
|
};
|
327
328
|
}
|
328
329
|
|
329
|
-
const
|
330
|
+
const versionUrl = getUrl(version);
|
330
331
|
progress.throttle = 100;
|
331
332
|
debug('needed Cypress version: %s', version);
|
332
|
-
debug('source url %s',
|
333
|
+
debug('source url %s', versionUrl);
|
333
334
|
debug(`downloading cypress.zip to "${downloadDestination}"`); // ensure download dir exists
|
334
335
|
|
335
336
|
return fs.ensureDirAsync(path.dirname(downloadDestination)).then(() => {
|
336
337
|
return getCA();
|
337
338
|
}).then(ca => {
|
338
339
|
return downloadFromUrl({
|
339
|
-
url,
|
340
|
+
url: versionUrl,
|
340
341
|
downloadDestination,
|
341
342
|
progress,
|
342
343
|
ca,
|
package/lib/tasks/verify.js
CHANGED
@@ -37,7 +37,7 @@ const xvfb = require('../exec/xvfb');
|
|
37
37
|
|
38
38
|
const state = require('./state');
|
39
39
|
|
40
|
-
const VERIFY_TEST_RUNNER_TIMEOUT_MS = +
|
40
|
+
const VERIFY_TEST_RUNNER_TIMEOUT_MS = +util.getEnv('CYPRESS_VERIFY_TIMEOUT') || 30000;
|
41
41
|
|
42
42
|
const checkExecutable = binaryDir => {
|
43
43
|
const executable = state.getPathToExecutable(binaryDir);
|
package/lib/util.js
CHANGED
@@ -42,14 +42,16 @@ const supportsColor = require('supports-color');
|
|
42
42
|
|
43
43
|
const isInstalledGlobally = require('is-installed-globally');
|
44
44
|
|
45
|
-
const pkg = require(path.join(__dirname, '..', 'package.json'));
|
46
|
-
|
47
45
|
const logger = require('./logger');
|
48
46
|
|
49
47
|
const debug = require('debug')('cypress:cli');
|
50
48
|
|
51
49
|
const fs = require('./fs');
|
52
50
|
|
51
|
+
const semver = require('semver');
|
52
|
+
|
53
|
+
const pkg = require(path.join(__dirname, '..', 'package.json'));
|
54
|
+
|
53
55
|
const issuesUrl = 'https://github.com/cypress-io/cypress/issues';
|
54
56
|
const getosAsync = Promise.promisify(getos);
|
55
57
|
/**
|
@@ -267,17 +269,31 @@ const util = {
|
|
267
269
|
.mapValues(value => {
|
268
270
|
// stringify to 1 or 0
|
269
271
|
return value ? '1' : '0';
|
270
|
-
}).extend(util.getOriginalNodeOptions(
|
272
|
+
}).extend(util.getOriginalNodeOptions()).value();
|
271
273
|
},
|
272
274
|
|
273
|
-
getOriginalNodeOptions(
|
275
|
+
getOriginalNodeOptions() {
|
276
|
+
const opts = {};
|
277
|
+
|
274
278
|
if (process.env.NODE_OPTIONS) {
|
275
|
-
|
276
|
-
|
277
|
-
|
279
|
+
opts.ORIGINAL_NODE_OPTIONS = process.env.NODE_OPTIONS;
|
280
|
+
} // https://github.com/cypress-io/cypress/issues/18914
|
281
|
+
// Node 17+ ships with OpenSSL 3 by default, so we may need the option
|
282
|
+
// --openssl-legacy-provider so that webpack@4 can use the legacy MD4 hash
|
283
|
+
// function. This option doesn't exist on Node <17 or when it is built
|
284
|
+
// against OpenSSL 1, so we have to detect Node's major version and check
|
285
|
+
// which version of OpenSSL it was built against before spawning the plugins
|
286
|
+
// process.
|
287
|
+
// To be removed when the Cypress binary pulls in the @cypress/webpack-batteries-included-preprocessor
|
288
|
+
// version that has been updated to webpack >= 5.61, which no longer relies on
|
289
|
+
// Node's builtin crypto.hash function.
|
290
|
+
|
291
|
+
|
292
|
+
if (process.versions && semver.satisfies(process.versions.node, '>=17.0.0') && process.versions.openssl.startsWith('3.')) {
|
293
|
+
opts.ORIGINAL_NODE_OPTIONS = `${opts.ORIGINAL_NODE_OPTIONS || ''} --openssl-legacy-provider`;
|
278
294
|
}
|
279
295
|
|
280
|
-
return
|
296
|
+
return opts;
|
281
297
|
},
|
282
298
|
|
283
299
|
getForceTty() {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "cypress",
|
3
|
-
"version": "9.
|
3
|
+
"version": "9.4.1",
|
4
4
|
"main": "index.js",
|
5
5
|
"scripts": {
|
6
6
|
"postinstall": "node index.js --exec install",
|
@@ -10,11 +10,12 @@
|
|
10
10
|
"@cypress/request": "^2.88.10",
|
11
11
|
"@cypress/xvfb": "^1.2.4",
|
12
12
|
"@types/node": "^14.14.31",
|
13
|
-
"@types/sinonjs__fake-timers": "
|
13
|
+
"@types/sinonjs__fake-timers": "8.1.1",
|
14
14
|
"@types/sizzle": "^2.3.2",
|
15
15
|
"arch": "^2.2.0",
|
16
16
|
"blob-util": "^2.0.2",
|
17
|
-
"bluebird": "3.7.2",
|
17
|
+
"bluebird": "^3.7.2",
|
18
|
+
"buffer": "^5.6.0",
|
18
19
|
"cachedir": "^2.3.0",
|
19
20
|
"chalk": "^4.1.0",
|
20
21
|
"check-more-types": "^2.24.0",
|
@@ -43,10 +44,10 @@
|
|
43
44
|
"pretty-bytes": "^5.6.0",
|
44
45
|
"proxy-from-env": "1.0.0",
|
45
46
|
"request-progress": "^3.0.0",
|
47
|
+
"semver": "^7.3.2",
|
46
48
|
"supports-color": "^8.1.1",
|
47
49
|
"tmp": "~0.2.1",
|
48
50
|
"untildify": "^4.0.0",
|
49
|
-
"url": "^0.11.0",
|
50
51
|
"yauzl": "^2.10.0"
|
51
52
|
},
|
52
53
|
"files": [
|
@@ -27,3 +27,7 @@ interface NodeEventEmitter {
|
|
27
27
|
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this
|
28
28
|
eventNames(): Array<string | symbol>
|
29
29
|
}
|
30
|
+
|
31
|
+
// We use the Buffer class for dealing with binary data, especially around the
|
32
|
+
// selectFile interface.
|
33
|
+
type BufferType = import("buffer/").Buffer
|
package/types/cypress.d.ts
CHANGED
@@ -231,6 +231,15 @@ declare namespace Cypress {
|
|
231
231
|
* Cypress.Blob.method()
|
232
232
|
*/
|
233
233
|
Blob: BlobUtil.BlobUtilStatic
|
234
|
+
/**
|
235
|
+
* Cypress automatically includes a Buffer library and exposes it as Cypress.Buffer.
|
236
|
+
*
|
237
|
+
* @see https://on.cypress.io/buffer
|
238
|
+
* @see https://github.com/feross/buffer
|
239
|
+
* @example
|
240
|
+
* Cypress.Buffer.method()
|
241
|
+
*/
|
242
|
+
Buffer: BufferType
|
234
243
|
/**
|
235
244
|
* Cypress automatically includes minimatch and exposes it as Cypress.minimatch.
|
236
245
|
*
|
@@ -662,6 +671,20 @@ declare namespace Cypress {
|
|
662
671
|
*/
|
663
672
|
as(alias: string): Chainable<Subject>
|
664
673
|
|
674
|
+
/**
|
675
|
+
* Select a file with the given <input> element, or drag and drop a file over any DOM subject.
|
676
|
+
*
|
677
|
+
* @param {FileReference} files - The file(s) to select or drag onto this element.
|
678
|
+
* @see https://on.cypress.io/selectfile
|
679
|
+
* @example
|
680
|
+
* cy.get('input[type=file]').selectFile(Cypress.Buffer.from('text'))
|
681
|
+
* cy.get('input[type=file]').selectFile({
|
682
|
+
* fileName: 'users.json',
|
683
|
+
* fileContents: [{name: 'John Doe'}]
|
684
|
+
* })
|
685
|
+
*/
|
686
|
+
selectFile(files: FileReference | FileReference[], options?: Partial<SelectFileOptions>): Chainable<Subject>
|
687
|
+
|
665
688
|
/**
|
666
689
|
* Blur a focused element. This element must currently be in focus.
|
667
690
|
* If you want to ensure an element is focused before blurring,
|
@@ -2466,6 +2489,17 @@ declare namespace Cypress {
|
|
2466
2489
|
scrollBehavior: scrollBehaviorOptions
|
2467
2490
|
}
|
2468
2491
|
|
2492
|
+
interface SelectFileOptions extends Loggable, Timeoutable, ActionableOptions {
|
2493
|
+
/**
|
2494
|
+
* Which user action to perform. `select` matches selecting a file while
|
2495
|
+
* `drag-drop` matches dragging files from the operating system into the
|
2496
|
+
* document.
|
2497
|
+
*
|
2498
|
+
* @default 'select'
|
2499
|
+
*/
|
2500
|
+
action: 'select' | 'drag-drop'
|
2501
|
+
}
|
2502
|
+
|
2469
2503
|
interface BlurOptions extends Loggable, Forceable { }
|
2470
2504
|
|
2471
2505
|
interface CheckOptions extends Loggable, Timeoutable, ActionableOptions {
|
@@ -5641,6 +5675,18 @@ declare namespace Cypress {
|
|
5641
5675
|
stderr: string
|
5642
5676
|
}
|
5643
5677
|
|
5678
|
+
type FileReference = string | BufferType | FileReferenceObject
|
5679
|
+
interface FileReferenceObject {
|
5680
|
+
/*
|
5681
|
+
* Buffers will be used as-is, while strings will be interpreted as an alias or a file path.
|
5682
|
+
* All other types will have `Buffer.from(JSON.stringify())` applied.
|
5683
|
+
*/
|
5684
|
+
contents: any
|
5685
|
+
fileName?: string
|
5686
|
+
mimeType?: string
|
5687
|
+
lastModified?: number
|
5688
|
+
}
|
5689
|
+
|
5644
5690
|
interface LogAttrs {
|
5645
5691
|
url: string
|
5646
5692
|
consoleProps: ObjectLike
|