cypress 7.7.0 → 8.0.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/lib/cli.js +2 -2
- package/lib/exec/spawn.js +32 -22
- package/lib/exec/xvfb.js +5 -0
- package/package.json +1 -1
- package/types/cypress-npm-api.d.ts +1 -1
- package/types/cypress.d.ts +57 -44
package/lib/cli.js
CHANGED
@@ -129,8 +129,8 @@ const descriptions = {
|
|
129
129
|
forceInstall: 'force install the Cypress binary',
|
130
130
|
global: 'force Cypress into global mode as if its globally installed',
|
131
131
|
group: 'a named group for recorded runs in the Cypress Dashboard',
|
132
|
-
headed: 'displays the browser instead of running headlessly
|
133
|
-
headless: 'hide the browser instead of running headed (
|
132
|
+
headed: 'displays the browser instead of running headlessly',
|
133
|
+
headless: 'hide the browser instead of running headed (default for cypress run)',
|
134
134
|
key: 'your secret Record Key. you can omit this if you set a CYPRESS_RECORD_KEY environment variable.',
|
135
135
|
parallel: 'enables concurrent runs and automatic load balancing of specs across multiple machines or processes',
|
136
136
|
port: 'runs Cypress on a specific port. overrides any value in cypress.json.',
|
package/lib/exec/spawn.js
CHANGED
@@ -76,15 +76,17 @@ module.exports = {
|
|
76
76
|
executable = path.resolve(util.getEnv('CYPRESS_RUN_BINARY'));
|
77
77
|
}
|
78
78
|
|
79
|
-
debug('needs to start own Xvfb?', needsXvfb); //
|
80
|
-
// arguments and does not try to sanitize them. Otherwise on Windows
|
81
|
-
// an url in one of the arguments crashes it :(
|
82
|
-
// https://github.com/cypress-io/cypress/issues/5466
|
83
|
-
// 2. Always push cwd into the args
|
79
|
+
debug('needs to start own Xvfb?', needsXvfb); // Always push cwd into the args
|
84
80
|
// which additionally acts as a signal to the
|
85
81
|
// binary that it was invoked through the NPM module
|
86
82
|
|
87
|
-
args =
|
83
|
+
args = args || [];
|
84
|
+
|
85
|
+
if (typeof args === 'string') {
|
86
|
+
args = [args];
|
87
|
+
}
|
88
|
+
|
89
|
+
args = [...args, '--cwd', process.cwd()];
|
88
90
|
|
89
91
|
_.defaults(options, {
|
90
92
|
dev: false,
|
@@ -100,28 +102,24 @@ module.exports = {
|
|
100
102
|
electronLogging: false
|
101
103
|
});
|
102
104
|
|
103
|
-
if (options.dev) {
|
104
|
-
// if we're in dev then reset
|
105
|
-
// the launch cmd to be 'npm run dev'
|
106
|
-
executable = 'node';
|
107
|
-
args.unshift(path.resolve(__dirname, '..', '..', '..', 'scripts', 'start.js'));
|
108
|
-
debug('in dev mode the args became %o', args);
|
109
|
-
}
|
110
|
-
|
111
105
|
const {
|
112
106
|
onStderrData,
|
113
107
|
electronLogging
|
114
108
|
} = overrides;
|
115
109
|
const envOverrides = util.getEnvOverrides(options);
|
116
|
-
|
117
|
-
const electronArgs = _.clone(args);
|
118
|
-
|
110
|
+
const electronArgs = [];
|
119
111
|
const node11WindowsFix = isPlatform('win32');
|
120
112
|
|
113
|
+
if (options.dev) {
|
114
|
+
// if we're in dev then reset
|
115
|
+
// the launch cmd to be 'npm run dev'
|
116
|
+
executable = 'node';
|
117
|
+
electronArgs.unshift(path.resolve(__dirname, '..', '..', '..', 'scripts', 'start.js'));
|
118
|
+
debug('in dev mode the args became %o', args);
|
119
|
+
}
|
120
|
+
|
121
121
|
if (!options.dev && verify.needsSandbox()) {
|
122
|
-
|
123
|
-
// thus it needs to be before "--" separator
|
124
|
-
electronArgs.unshift('--no-sandbox');
|
122
|
+
electronArgs.push('--no-sandbox');
|
125
123
|
} // strip dev out of child process options
|
126
124
|
|
127
125
|
|
@@ -148,9 +146,21 @@ module.exports = {
|
|
148
146
|
stdioOptions.env.DISPLAY = process.env.DISPLAY;
|
149
147
|
}
|
150
148
|
|
149
|
+
if (stdioOptions.env.ELECTRON_RUN_AS_NODE) {
|
150
|
+
// Since we are running electron as node, we need to add an entry point file.
|
151
|
+
const serverEntryPoint = path.join(state.getBinaryPkgPath(path.dirname(executable)), '..', 'index.js');
|
152
|
+
args = [serverEntryPoint, ...args];
|
153
|
+
} else {
|
154
|
+
// Start arguments with "--" so Electron knows these are OUR
|
155
|
+
// arguments and does not try to sanitize them. Otherwise on Windows
|
156
|
+
// an url in one of the arguments crashes it :(
|
157
|
+
// https://github.com/cypress-io/cypress/issues/5466
|
158
|
+
args = [...electronArgs, '--', ...args];
|
159
|
+
}
|
160
|
+
|
151
161
|
debug('spawning Cypress with executable: %s', executable);
|
152
|
-
debug('spawn args %o %o',
|
153
|
-
const child = cp.spawn(executable,
|
162
|
+
debug('spawn args %o %o', args, _.omit(stdioOptions, 'env'));
|
163
|
+
const child = cp.spawn(executable, args, stdioOptions);
|
154
164
|
|
155
165
|
function resolveOn(event) {
|
156
166
|
return function (code, signal) {
|
package/lib/exec/xvfb.js
CHANGED
@@ -65,6 +65,11 @@ module.exports = {
|
|
65
65
|
},
|
66
66
|
|
67
67
|
isNeeded() {
|
68
|
+
if (process.env.ELECTRON_RUN_AS_NODE) {
|
69
|
+
debug('Environment variable ELECTRON_RUN_AS_NODE detected, xvfb is not needed');
|
70
|
+
return false; // xvfb required for electron processes only.
|
71
|
+
}
|
72
|
+
|
68
73
|
if (os.platform() !== 'linux') {
|
69
74
|
return false;
|
70
75
|
}
|
package/package.json
CHANGED
package/types/cypress.d.ts
CHANGED
@@ -64,6 +64,22 @@ declare namespace Cypress {
|
|
64
64
|
path: string
|
65
65
|
isHeaded: boolean
|
66
66
|
isHeadless: boolean
|
67
|
+
/**
|
68
|
+
* Informational text to accompany this browser. Shown in desktop-gui.
|
69
|
+
*/
|
70
|
+
info?: string
|
71
|
+
/**
|
72
|
+
* Warning text to accompany this browser. Shown in desktop-gui.
|
73
|
+
*/
|
74
|
+
warning?: string
|
75
|
+
/**
|
76
|
+
* The minimum majorVersion of this browser supported by Cypress.
|
77
|
+
*/
|
78
|
+
minSupportedVersion?: number
|
79
|
+
/**
|
80
|
+
* If `true`, this browser is too old to be supported by Cypress.
|
81
|
+
*/
|
82
|
+
unsupportedVersion?: boolean
|
67
83
|
}
|
68
84
|
|
69
85
|
interface LocalStorage {
|
@@ -341,15 +357,6 @@ declare namespace Cypress {
|
|
341
357
|
*/
|
342
358
|
env(object: ObjectLike): void
|
343
359
|
|
344
|
-
/**
|
345
|
-
* Firefox only: Get the current number of tests that will run between forced garbage collections.
|
346
|
-
*
|
347
|
-
* Returns undefined if not in Firefox, returns a null or 0 if forced GC is disabled.
|
348
|
-
*
|
349
|
-
* @see https://on.cypress.io/firefox-gc-issue
|
350
|
-
*/
|
351
|
-
getFirefoxGcInterval(): number | null | undefined
|
352
|
-
|
353
360
|
/**
|
354
361
|
* @returns the number of test retries currently enabled for the run
|
355
362
|
*/
|
@@ -1833,6 +1840,12 @@ declare namespace Cypress {
|
|
1833
1840
|
* @see https://on.cypress.io/then
|
1834
1841
|
*/
|
1835
1842
|
then<S>(options: Partial<Timeoutable>, fn: (this: ObjectLike, currentSubject: Subject) => PromiseLike<S>): Chainable<S>
|
1843
|
+
/**
|
1844
|
+
* Enables you to work with the subject yielded from the previous command / promise.
|
1845
|
+
*
|
1846
|
+
* @see https://on.cypress.io/then
|
1847
|
+
*/
|
1848
|
+
then<S extends string | number | boolean>(fn: (this: ObjectLike, currentSubject: Subject) => S): Chainable<S>
|
1836
1849
|
/**
|
1837
1850
|
* Enables you to work with the subject yielded from the previous command / promise.
|
1838
1851
|
*
|
@@ -1850,7 +1863,7 @@ declare namespace Cypress {
|
|
1850
1863
|
*
|
1851
1864
|
* @see https://on.cypress.io/then
|
1852
1865
|
*/
|
1853
|
-
then<S extends
|
1866
|
+
then<S extends any[] | object>(fn: (this: ObjectLike, currentSubject: Subject) => S): Chainable<S>
|
1854
1867
|
/**
|
1855
1868
|
* Enables you to work with the subject yielded from the previous command / promise.
|
1856
1869
|
*
|
@@ -2640,13 +2653,6 @@ declare namespace Cypress {
|
|
2640
2653
|
* @default 'top'
|
2641
2654
|
*/
|
2642
2655
|
scrollBehavior: scrollBehaviorOptions
|
2643
|
-
/**
|
2644
|
-
* Firefox version 79 and below only: The number of tests that will run between forced garbage collections.
|
2645
|
-
* If a number is supplied, it will apply to `run` mode and `open` mode.
|
2646
|
-
* Set the interval to `null` or 0 to disable forced garbage collections.
|
2647
|
-
* @default { runMode: 1, openMode: null }
|
2648
|
-
*/
|
2649
|
-
firefoxGcInterval: Nullable<number | { runMode: Nullable<number>, openMode: Nullable<number> }>
|
2650
2656
|
/**
|
2651
2657
|
* Allows listening to the `before:run`, `after:run`, `before:spec`, and `after:spec` events in the plugins file during interactive mode.
|
2652
2658
|
* @default false
|
@@ -2678,17 +2684,46 @@ declare namespace Cypress {
|
|
2678
2684
|
*/
|
2679
2685
|
includeShadowDom: boolean
|
2680
2686
|
|
2687
|
+
/**
|
2688
|
+
* The list of hosts to be blocked
|
2689
|
+
*/
|
2690
|
+
blockHosts: null | string | string[]
|
2691
|
+
/**
|
2692
|
+
* Path to folder containing component test files.
|
2693
|
+
*/
|
2694
|
+
componentFolder: false | string
|
2695
|
+
/**
|
2696
|
+
* A unique ID for the project used for recording
|
2697
|
+
*/
|
2698
|
+
projectId: null | string
|
2699
|
+
/**
|
2700
|
+
* Path to the support folder.
|
2701
|
+
*/
|
2702
|
+
supportFolder: string
|
2703
|
+
/**
|
2704
|
+
* Glob pattern to determine what test files to load.
|
2705
|
+
*/
|
2706
|
+
testFiles: string | string[]
|
2707
|
+
/**
|
2708
|
+
* The user agent the browser sends in all request headers.
|
2709
|
+
*/
|
2710
|
+
userAgent: null | string
|
2711
|
+
/**
|
2712
|
+
* Polyfills `window.fetch` to enable Network spying and stubbing
|
2713
|
+
*/
|
2714
|
+
experimentalFetchPolyfill: boolean
|
2715
|
+
|
2681
2716
|
/**
|
2682
2717
|
* Override default config options for Component Testing runner.
|
2683
2718
|
* @default {}
|
2684
2719
|
*/
|
2685
|
-
component: ResolvedConfigOptions
|
2720
|
+
component: Omit<ResolvedConfigOptions, 'e2e' | 'component'>
|
2686
2721
|
|
2687
2722
|
/**
|
2688
2723
|
* Override default config options for E2E Testing runner.
|
2689
2724
|
* @default {}
|
2690
2725
|
*/
|
2691
|
-
e2e: ResolvedConfigOptions
|
2726
|
+
e2e: Omit<ResolvedConfigOptions, 'e2e' | 'component'>
|
2692
2727
|
}
|
2693
2728
|
|
2694
2729
|
/**
|
@@ -2701,10 +2736,6 @@ declare namespace Cypress {
|
|
2701
2736
|
* @see https://nodejs.org/api/os.html#os_os_arch
|
2702
2737
|
*/
|
2703
2738
|
arch: string
|
2704
|
-
/**
|
2705
|
-
* The list of hosts to be blocked
|
2706
|
-
*/
|
2707
|
-
blockHosts: null | string | string[]
|
2708
2739
|
/**
|
2709
2740
|
* The browser Cypress is running on.
|
2710
2741
|
*/
|
@@ -2713,10 +2744,6 @@ declare namespace Cypress {
|
|
2713
2744
|
* Available browsers found on your system.
|
2714
2745
|
*/
|
2715
2746
|
browsers: Browser[]
|
2716
|
-
/**
|
2717
|
-
* Path to folder containing component test files.
|
2718
|
-
*/
|
2719
|
-
componentFolder: string
|
2720
2747
|
/**
|
2721
2748
|
* Hosts mappings to IP addresses.
|
2722
2749
|
*/
|
@@ -2736,22 +2763,6 @@ declare namespace Cypress {
|
|
2736
2763
|
* The platform Cypress is running on.
|
2737
2764
|
*/
|
2738
2765
|
platform: 'linux' | 'darwin' | 'win32'
|
2739
|
-
/**
|
2740
|
-
* A unique ID for the project used for recording
|
2741
|
-
*/
|
2742
|
-
projectId: null | string
|
2743
|
-
/**
|
2744
|
-
* Path to the support folder.
|
2745
|
-
*/
|
2746
|
-
supportFolder: string
|
2747
|
-
/**
|
2748
|
-
* Glob pattern to determine what test files to load.
|
2749
|
-
*/
|
2750
|
-
testFiles: string
|
2751
|
-
/**
|
2752
|
-
* The user agent the browser sends in all request headers.
|
2753
|
-
*/
|
2754
|
-
userAgent: null | string
|
2755
2766
|
/**
|
2756
2767
|
* The Cypress version being used.
|
2757
2768
|
*/
|
@@ -2763,6 +2774,7 @@ declare namespace Cypress {
|
|
2763
2774
|
clientRoute: string
|
2764
2775
|
configFile: string
|
2765
2776
|
cypressEnv: string
|
2777
|
+
devServerPublicPathRoute: string
|
2766
2778
|
isNewProject: boolean
|
2767
2779
|
isTextTerminal: boolean
|
2768
2780
|
morgan: boolean
|
@@ -2797,7 +2809,8 @@ declare namespace Cypress {
|
|
2797
2809
|
/**
|
2798
2810
|
* All configuration items are optional.
|
2799
2811
|
*/
|
2800
|
-
type
|
2812
|
+
type CoreConfigOptions = Partial<Omit<ResolvedConfigOptions, 'e2e' | 'component'>>
|
2813
|
+
type ConfigOptions = CoreConfigOptions & {e2e?: CoreConfigOptions, component?: CoreConfigOptions }
|
2801
2814
|
|
2802
2815
|
interface PluginConfigOptions extends ResolvedConfigOptions {
|
2803
2816
|
/**
|