cypress 9.1.0 → 9.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.
@@ -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 = 30000;
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);
@@ -86,9 +86,9 @@ const runSmokeTest = (binaryDir, options) => {
86
86
 
87
87
  const needsXvfb = xvfb.isNeeded();
88
88
  debug('needs Xvfb?', needsXvfb);
89
- /**
90
- * Spawn Cypress running smoke test to check if all operating system
91
- * dependencies are good.
89
+ /**
90
+ * Spawn Cypress running smoke test to check if all operating system
91
+ * dependencies are good.
92
92
  */
93
93
 
94
94
  const spawn = linuxWithDisplayEnv => {
@@ -329,14 +329,14 @@ const start = (options = {}) => {
329
329
  };
330
330
 
331
331
  const isLinuxLike = () => os.platform() !== 'win32';
332
- /**
333
- * Returns true if running on a system where Electron needs "--no-sandbox" flag.
334
- * @see https://crbug.com/638180
335
- *
336
- * On Debian we had problems running in sandbox even for non-root users.
337
- * @see https://github.com/cypress-io/cypress/issues/5434
338
- * Seems there is a lot of discussion around this issue among Electron users
339
- * @see https://github.com/electron/electron/issues/17972
332
+ /**
333
+ * Returns true if running on a system where Electron needs "--no-sandbox" flag.
334
+ * @see https://crbug.com/638180
335
+ *
336
+ * On Debian we had problems running in sandbox even for non-root users.
337
+ * @see https://github.com/cypress-io/cypress/issues/5434
338
+ * Seems there is a lot of discussion around this issue among Electron users
339
+ * @see https://github.com/electron/electron/issues/17972
340
340
  */
341
341
 
342
342
 
package/lib/util.js CHANGED
@@ -52,11 +52,11 @@ const fs = require('./fs');
52
52
 
53
53
  const issuesUrl = 'https://github.com/cypress-io/cypress/issues';
54
54
  const getosAsync = Promise.promisify(getos);
55
- /**
56
- * Returns SHA512 of a file
57
- *
58
- * Implementation lifted from https://github.com/sindresorhus/hasha
59
- * but without bringing that dependency (since hasha is Node v8+)
55
+ /**
56
+ * Returns SHA512 of a file
57
+ *
58
+ * Implementation lifted from https://github.com/sindresorhus/hasha
59
+ * but without bringing that dependency (since hasha is Node v8+)
60
60
  */
61
61
 
62
62
  const getFileChecksum = filename => {
@@ -90,21 +90,21 @@ const stringify = val => {
90
90
  function normalizeModuleOptions(options = {}) {
91
91
  return _.mapValues(options, stringify);
92
92
  }
93
- /**
94
- * Returns true if the platform is Linux. We do a lot of different
95
- * stuff on Linux (like Xvfb) and it helps to has readable code
93
+ /**
94
+ * Returns true if the platform is Linux. We do a lot of different
95
+ * stuff on Linux (like Xvfb) and it helps to has readable code
96
96
  */
97
97
 
98
98
 
99
99
  const isLinux = () => {
100
100
  return os.platform() === 'linux';
101
101
  };
102
- /**
103
- * If the DISPLAY variable is set incorrectly, when trying to spawn
104
- * Cypress executable we get an error like this:
105
- ```
106
- [1005:0509/184205.663837:WARNING:browser_main_loop.cc(258)] Gtk: cannot open display: 99
107
- ```
102
+ /**
103
+ * If the DISPLAY variable is set incorrectly, when trying to spawn
104
+ * Cypress executable we get an error like this:
105
+ ```
106
+ [1005:0509/184205.663837:WARNING:browser_main_loop.cc(258)] Gtk: cannot open display: 99
107
+ ```
108
108
  */
109
109
 
110
110
 
@@ -136,12 +136,12 @@ function stdoutLineMatches(expectedLine, stdout) {
136
136
  const lines = stdout.split('\n').map(val => val.trim());
137
137
  return lines.some(line => line === expectedLine);
138
138
  }
139
- /**
140
- * Confirms if given value is a valid CYPRESS_INTERNAL_ENV value. Undefined values
141
- * are valid, because the system can set the default one.
142
- *
143
- * @param {string} value
144
- * @example util.isValidCypressInternalEnvValue(process.env.CYPRESS_INTERNAL_ENV)
139
+ /**
140
+ * Confirms if given value is a valid CYPRESS_INTERNAL_ENV value. Undefined values
141
+ * are valid, because the system can set the default one.
142
+ *
143
+ * @param {string} value
144
+ * @example util.isValidCypressInternalEnvValue(process.env.CYPRESS_INTERNAL_ENV)
145
145
  */
146
146
 
147
147
 
@@ -155,21 +155,21 @@ function isValidCypressInternalEnvValue(value) {
155
155
  const names = ['development', 'test', 'staging', 'production'];
156
156
  return _.includes(names, value);
157
157
  }
158
- /**
159
- * Confirms if given value is a non-production CYPRESS_INTERNAL_ENV value.
160
- * Undefined values are valid, because the system can set the default one.
161
- *
162
- * @param {string} value
163
- * @example util.isNonProductionCypressInternalEnvValue(process.env.CYPRESS_INTERNAL_ENV)
158
+ /**
159
+ * Confirms if given value is a non-production CYPRESS_INTERNAL_ENV value.
160
+ * Undefined values are valid, because the system can set the default one.
161
+ *
162
+ * @param {string} value
163
+ * @example util.isNonProductionCypressInternalEnvValue(process.env.CYPRESS_INTERNAL_ENV)
164
164
  */
165
165
 
166
166
 
167
167
  function isNonProductionCypressInternalEnvValue(value) {
168
168
  return !_.isUndefined(value) && value !== 'production';
169
169
  }
170
- /**
171
- * Prints NODE_OPTIONS using debug() module, but only
172
- * if DEBUG=cypress... is set
170
+ /**
171
+ * Prints NODE_OPTIONS using debug() module, but only
172
+ * if DEBUG=cypress... is set
173
173
  */
174
174
 
175
175
 
@@ -184,19 +184,19 @@ function printNodeOptions(log = debug) {
184
184
  log('NODE_OPTIONS is not set');
185
185
  }
186
186
  }
187
- /**
188
- * Removes double quote characters
189
- * from the start and end of the given string IF they are both present
190
- *
191
- * @param {string} str Input string
192
- * @returns {string} Trimmed string or the original string if there are no double quotes around it.
193
- * @example
194
- ```
195
- dequote('"foo"')
196
- // returns string 'foo'
197
- dequote('foo')
198
- // returns string 'foo'
199
- ```
187
+ /**
188
+ * Removes double quote characters
189
+ * from the start and end of the given string IF they are both present
190
+ *
191
+ * @param {string} str Input string
192
+ * @returns {string} Trimmed string or the original string if there are no double quotes around it.
193
+ * @example
194
+ ```
195
+ dequote('"foo"')
196
+ // returns string 'foo'
197
+ dequote('foo')
198
+ // returns string 'foo'
199
+ ```
200
200
  */
201
201
 
202
202
 
@@ -232,9 +232,9 @@ const parseOpts = opts => {
232
232
  debug('parsed cli options %o', cleanOpts);
233
233
  return cleanOpts;
234
234
  };
235
- /**
236
- * Copy of packages/server/lib/browsers/utils.ts
237
- * because we need same functionality in CLI to show the path :(
235
+ /**
236
+ * Copy of packages/server/lib/browsers/utils.ts
237
+ * because we need same functionality in CLI to show the path :(
238
238
  */
239
239
 
240
240
 
package/package.json CHANGED
@@ -1,25 +1,26 @@
1
1
  {
2
2
  "name": "cypress",
3
- "version": "9.1.0",
3
+ "version": "9.3.0",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "postinstall": "node index.js --exec install",
7
7
  "size": "t=\"$(npm pack .)\"; wc -c \"${t}\"; tar tvf \"${t}\"; rm \"${t}\";"
8
8
  },
9
9
  "dependencies": {
10
- "@cypress/request": "^2.88.7",
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": "^6.0.2",
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",
21
22
  "cli-cursor": "^3.1.0",
22
- "cli-table3": "~0.6.0",
23
+ "cli-table3": "~0.6.1",
23
24
  "commander": "^5.1.0",
24
25
  "common-tags": "^1.8.0",
25
26
  "dayjs": "^1.10.4",
@@ -1949,8 +1949,8 @@ declare module "chai" {
1949
1949
  export = chai;
1950
1950
  }
1951
1951
 
1952
- // const a = 1; a.should(1); doesn't work with Cypress
1953
- // https://github.com/cypress-io/cypress/issues/16548
1954
- // interface Object {
1955
- // should: Chai.Assertion;
1956
- // }
1952
+ // const a = 1; a.should(1); doesn't work with Cypress
1953
+ // https://github.com/cypress-io/cypress/issues/16548
1954
+ // interface Object {
1955
+ // should: Chai.Assertion;
1956
+ // }
@@ -1,13 +1,13 @@
1
- // Shim definition to export a namespace. Cypress is actually a global module
2
- // so import/export isn't allowed there. We import here and define a global module
3
- // so that Cypress can get and use the Blob type
4
-
5
- // tslint:disable-next-line:no-implicit-dependencies
6
- import * as blobUtil from 'blob-util'
7
-
8
- export = BlobUtil
9
- export as namespace BlobUtil
10
-
11
- declare namespace BlobUtil {
12
- type BlobUtilStatic = typeof blobUtil
13
- }
1
+ // Shim definition to export a namespace. Cypress is actually a global module
2
+ // so import/export isn't allowed there. We import here and define a global module
3
+ // so that Cypress can get and use the Blob type
4
+
5
+ // tslint:disable-next-line:no-implicit-dependencies
6
+ import * as blobUtil from 'blob-util'
7
+
8
+ export = BlobUtil
9
+ export as namespace BlobUtil
10
+
11
+ declare namespace BlobUtil {
12
+ type BlobUtilStatic = typeof blobUtil
13
+ }
@@ -1,12 +1,12 @@
1
- // Shim definition to export a namespace. Cypress is actually a global module
2
- // so import/export isn't allowed there. We import here and define a global module
3
- // so that Cypress can get and use the Blob type
4
- import ImportedBluebird = require('./bluebird')
5
-
6
- export = Bluebird
7
- export as namespace Bluebird
8
-
9
- declare namespace Bluebird {
10
- type BluebirdStatic = typeof ImportedBluebird
11
- interface Promise<T> extends ImportedBluebird<T> {}
12
- }
1
+ // Shim definition to export a namespace. Cypress is actually a global module
2
+ // so import/export isn't allowed there. We import here and define a global module
3
+ // so that Cypress can get and use the Blob type
4
+ import ImportedBluebird = require('./bluebird')
5
+
6
+ export = Bluebird
7
+ export as namespace Bluebird
8
+
9
+ declare namespace Bluebird {
10
+ type BluebirdStatic = typeof ImportedBluebird
11
+ interface Promise<T> extends ImportedBluebird<T> {}
12
+ }
@@ -1,10 +1,10 @@
1
- // Shim definition to export a namespace. Cypress is actually a global module
2
- // so import/export isn't allowed there. We import here and define a global module
3
- /// <reference path="./chai/index.d.ts" />
4
- declare namespace Chai {
5
- interface Include {
6
- html(html: string): Assertion
7
- text(text: string): Assertion
8
- value(text: string): Assertion
9
- }
10
- }
1
+ // Shim definition to export a namespace. Cypress is actually a global module
2
+ // so import/export isn't allowed there. We import here and define a global module
3
+ /// <reference path="./chai/index.d.ts" />
4
+ declare namespace Chai {
5
+ interface Include {
6
+ html(html: string): Assertion
7
+ text(text: string): Assertion
8
+ value(text: string): Assertion
9
+ }
10
+ }
@@ -1,13 +1,13 @@
1
- /**
2
- * This file should be deleted as soon as the serever
3
- * TODO: delete this file when ResolvedDevServerConfig.server is converted to closeServer
4
- */
5
-
6
- /// <reference types="node" />
7
- import * as cyUtilsHttp from 'http'
8
- export = cyUtilsHttp
9
- /**
10
- * namespace created to bridge nodeJs.http typings so that
11
- * we can type http Server in CT
12
- */
13
- export as namespace cyUtilsHttp
1
+ /**
2
+ * This file should be deleted as soon as the serever
3
+ * TODO: delete this file when ResolvedDevServerConfig.server is converted to closeServer
4
+ */
5
+
6
+ /// <reference types="node" />
7
+ import * as cyUtilsHttp from 'http'
8
+ export = cyUtilsHttp
9
+ /**
10
+ * namespace created to bridge nodeJs.http typings so that
11
+ * we can type http Server in CT
12
+ */
13
+ export as namespace cyUtilsHttp
@@ -1,96 +1,96 @@
1
- // I was trying to avoid relying on "import" of actual module from "minimatch"
2
- // because it would not work in test project, and the only reliable way
3
- // to get around type errors finally was to copy the minimal minimatch function
4
- // definition from "minimatch/index.d.ts" here and just keep it in our code
5
-
6
- export = Minimatch
7
- export as namespace Minimatch
8
-
9
- interface MinimatchOptions {
10
- /**
11
- * Dump a ton of stuff to stderr.
12
- *
13
- * @default false
14
- */
15
- debug?: boolean
16
-
17
- /**
18
- * Do not expand {a,b} and {1..3} brace sets.
19
- *
20
- * @default false
21
- */
22
- nobrace?: boolean
23
-
24
- /**
25
- * Disable ** matching against multiple folder names.
26
- *
27
- * @default false
28
- */
29
- noglobstar?: boolean
30
-
31
- /**
32
- * Allow patterns to match filenames starting with a period,
33
- * even if the pattern does not explicitly have a period in that spot.
34
- *
35
- * @default false
36
- */
37
- dot?: boolean
38
-
39
- /**
40
- * Disable "extglob" style patterns like +(a|b).
41
- *
42
- * @default false
43
- */
44
- noext?: boolean
45
-
46
- /**
47
- * Perform a case-insensitive match.
48
- *
49
- * @default false
50
- */
51
- nocase?: boolean
52
-
53
- /**
54
- * When a match is not found by minimatch.match,
55
- * return a list containing the pattern itself if this option is set.
56
- * Otherwise, an empty list is returned if there are no matches.
57
- *
58
- * @default false
59
- */
60
- nonull?: boolean
61
-
62
- /**
63
- * If set, then patterns without slashes will be matched against
64
- * the basename of the path if it contains slashes.
65
- *
66
- * @default false
67
- */
68
- matchBase?: boolean
69
-
70
- /**
71
- * Suppress the behavior of treating #
72
- * at the start of a pattern as a comment.
73
- *
74
- * @default false
75
- */
76
- nocomment?: boolean
77
-
78
- /**
79
- * Suppress the behavior of treating a leading ! character as negation.
80
- *
81
- * @default false
82
- */
83
- nonegate?: boolean
84
-
85
- /**
86
- * Returns from negate expressions the same as if they were not negated.
87
- * (Ie, true on a hit, false on a miss.)
88
- *
89
- * @default false
90
- */
91
- flipNegate?: boolean
92
- }
93
-
94
- declare namespace Minimatch {
95
- function minimatch(target: string, pattern: string, options?: MinimatchOptions): boolean
96
- }
1
+ // I was trying to avoid relying on "import" of actual module from "minimatch"
2
+ // because it would not work in test project, and the only reliable way
3
+ // to get around type errors finally was to copy the minimal minimatch function
4
+ // definition from "minimatch/index.d.ts" here and just keep it in our code
5
+
6
+ export = Minimatch
7
+ export as namespace Minimatch
8
+
9
+ interface MinimatchOptions {
10
+ /**
11
+ * Dump a ton of stuff to stderr.
12
+ *
13
+ * @default false
14
+ */
15
+ debug?: boolean
16
+
17
+ /**
18
+ * Do not expand {a,b} and {1..3} brace sets.
19
+ *
20
+ * @default false
21
+ */
22
+ nobrace?: boolean
23
+
24
+ /**
25
+ * Disable ** matching against multiple folder names.
26
+ *
27
+ * @default false
28
+ */
29
+ noglobstar?: boolean
30
+
31
+ /**
32
+ * Allow patterns to match filenames starting with a period,
33
+ * even if the pattern does not explicitly have a period in that spot.
34
+ *
35
+ * @default false
36
+ */
37
+ dot?: boolean
38
+
39
+ /**
40
+ * Disable "extglob" style patterns like +(a|b).
41
+ *
42
+ * @default false
43
+ */
44
+ noext?: boolean
45
+
46
+ /**
47
+ * Perform a case-insensitive match.
48
+ *
49
+ * @default false
50
+ */
51
+ nocase?: boolean
52
+
53
+ /**
54
+ * When a match is not found by minimatch.match,
55
+ * return a list containing the pattern itself if this option is set.
56
+ * Otherwise, an empty list is returned if there are no matches.
57
+ *
58
+ * @default false
59
+ */
60
+ nonull?: boolean
61
+
62
+ /**
63
+ * If set, then patterns without slashes will be matched against
64
+ * the basename of the path if it contains slashes.
65
+ *
66
+ * @default false
67
+ */
68
+ matchBase?: boolean
69
+
70
+ /**
71
+ * Suppress the behavior of treating #
72
+ * at the start of a pattern as a comment.
73
+ *
74
+ * @default false
75
+ */
76
+ nocomment?: boolean
77
+
78
+ /**
79
+ * Suppress the behavior of treating a leading ! character as negation.
80
+ *
81
+ * @default false
82
+ */
83
+ nonegate?: boolean
84
+
85
+ /**
86
+ * Returns from negate expressions the same as if they were not negated.
87
+ * (Ie, true on a hit, false on a miss.)
88
+ *
89
+ * @default false
90
+ */
91
+ flipNegate?: boolean
92
+ }
93
+
94
+ declare namespace Minimatch {
95
+ function minimatch(target: string, pattern: string, options?: MinimatchOptions): boolean
96
+ }
@@ -1,29 +1,33 @@
1
- // Cypress, cy, Log inherits EventEmitter.
2
- type EventEmitter2 = import("eventemitter2").EventEmitter2
3
-
4
- interface EventEmitter extends EventEmitter2 {
5
- proxyTo: (cy: Cypress.cy) => null
6
- emitMap: (eventName: string, args: any[]) => Array<(...args: any[]) => any>
7
- emitThen: (eventName: string, args: any[]) => Bluebird.BluebirdStatic
8
- }
9
-
10
- // Copied from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/events.d.ts
11
- // to avoid type conflict.
12
- interface NodeEventEmitter {
13
- addListener(event: string | symbol, listener: (...args: any[]) => void): this
14
- on(event: string | symbol, listener: (...args: any[]) => void): this
15
- once(event: string | symbol, listener: (...args: any[]) => void): this
16
- removeListener(event: string | symbol, listener: (...args: any[]) => void): this
17
- off(event: string | symbol, listener: (...args: any[]) => void): this
18
- removeAllListeners(event?: string | symbol): this
19
- setMaxListeners(n: number): this
20
- getMaxListeners(): number
21
- listeners(event: string | symbol): Array<(...args: any[]) => void>
22
- rawListeners(event: string | symbol): Array<(...args: any[]) => void>
23
- emit(event: string | symbol, ...args: any[]): boolean
24
- listenerCount(type: string | symbol): number
25
- // Added in Node 6...
26
- prependListener(event: string | symbol, listener: (...args: any[]) => void): this
27
- prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this
28
- eventNames(): Array<string | symbol>
29
- }
1
+ // Cypress, cy, Log inherits EventEmitter.
2
+ type EventEmitter2 = import("eventemitter2").EventEmitter2
3
+
4
+ interface EventEmitter extends EventEmitter2 {
5
+ proxyTo: (cy: Cypress.cy) => null
6
+ emitMap: (eventName: string, args: any[]) => Array<(...args: any[]) => any>
7
+ emitThen: (eventName: string, args: any[]) => Bluebird.BluebirdStatic
8
+ }
9
+
10
+ // Copied from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/events.d.ts
11
+ // to avoid type conflict.
12
+ interface NodeEventEmitter {
13
+ addListener(event: string | symbol, listener: (...args: any[]) => void): this
14
+ on(event: string | symbol, listener: (...args: any[]) => void): this
15
+ once(event: string | symbol, listener: (...args: any[]) => void): this
16
+ removeListener(event: string | symbol, listener: (...args: any[]) => void): this
17
+ off(event: string | symbol, listener: (...args: any[]) => void): this
18
+ removeAllListeners(event?: string | symbol): this
19
+ setMaxListeners(n: number): this
20
+ getMaxListeners(): number
21
+ listeners(event: string | symbol): Array<(...args: any[]) => void>
22
+ rawListeners(event: string | symbol): Array<(...args: any[]) => void>
23
+ emit(event: string | symbol, ...args: any[]): boolean
24
+ listenerCount(type: string | symbol): number
25
+ // Added in Node 6...
26
+ prependListener(event: string | symbol, listener: (...args: any[]) => void): this
27
+ prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this
28
+ eventNames(): Array<string | symbol>
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
@@ -1,3 +1,3 @@
1
- // Cypress adds chai expect and assert to global
2
- declare const expect: Chai.ExpectStatic
3
- declare const assert: Chai.AssertStatic
1
+ // Cypress adds chai expect and assert to global
2
+ declare const expect: Chai.ExpectStatic
3
+ declare const assert: Chai.AssertStatic
@@ -1,22 +1,22 @@
1
- /**
2
- * Global variables `cy` added by Cypress with all API commands.
3
- * @see https://on.cypress.io/api
4
- *
5
- ```
6
- cy.get('button').click()
7
- cy.get('.result').contains('Expected text')
8
- ```
9
- */
10
- declare const cy: Cypress.cy & EventEmitter
11
-
12
- /**
13
- * Global variable `Cypress` holds common utilities and constants.
14
- * @see https://on.cypress.io/api
15
- *
16
- ```
17
- Cypress.config("pageLoadTimeout") // => 60000
18
- Cypress.version // => "1.4.0"
19
- Cypress._ // => Lodash _
20
- ```
21
- */
22
- declare const Cypress: Cypress.Cypress & EventEmitter
1
+ /**
2
+ * Global variables `cy` added by Cypress with all API commands.
3
+ * @see https://on.cypress.io/api
4
+ *
5
+ ```
6
+ cy.get('button').click()
7
+ cy.get('.result').contains('Expected text')
8
+ ```
9
+ */
10
+ declare const cy: Cypress.cy & EventEmitter
11
+
12
+ /**
13
+ * Global variable `Cypress` holds common utilities and constants.
14
+ * @see https://on.cypress.io/api
15
+ *
16
+ ```
17
+ Cypress.config("pageLoadTimeout") // => 60000
18
+ Cypress.version // => "1.4.0"
19
+ Cypress._ // => Lodash _
20
+ ```
21
+ */
22
+ declare const Cypress: Cypress.Cypress & EventEmitter