cypress 10.4.0 → 10.5.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.
@@ -231,7 +231,7 @@ var injectStyles = function (options) {
231
231
  return injectStylesBeforeElement(options, document, el);
232
232
  };
233
233
  };
234
- var lastMountedReactDom;
234
+ var mountCleanup;
235
235
  /**
236
236
  * Create an `mount` function. Performs all the non-React-version specific
237
237
  * behavior related to mounting. The React-version-specific code
@@ -246,6 +246,7 @@ var makeMountFn = function (type, jsx, options, rerenderKey, internalMountOption
246
246
  if (!internalMountOptions) {
247
247
  throw Error('internalMountOptions must be provided with `render` and `reactDom` parameters');
248
248
  }
249
+ mountCleanup = internalMountOptions.cleanup;
249
250
  // Get the display name property via the component constructor
250
251
  // @ts-ignore FIXME
251
252
  var componentName = getDisplayName(jsx.type, options.alias);
@@ -259,7 +260,6 @@ var makeMountFn = function (type, jsx, options, rerenderKey, internalMountOption
259
260
  .then(function () {
260
261
  var _a, _b, _c;
261
262
  var reactDomToUse = internalMountOptions.reactDom;
262
- lastMountedReactDom = reactDomToUse;
263
263
  var el = getContainerEl();
264
264
  if (!el) {
265
265
  throw new Error([
@@ -319,39 +319,31 @@ var makeMountFn = function (type, jsx, options, rerenderKey, internalMountOption
319
319
  * This is designed to be consumed by `npm/react{16,17,18}`, and other React adapters,
320
320
  * or people writing adapters for third-party, custom adapters.
321
321
  */
322
- var makeUnmountFn = function (options, internalUnmountOptions) {
322
+ var makeUnmountFn = function (options) {
323
323
  return cy.then(function () {
324
- return cy.get(ROOT_SELECTOR, { log: false }).then(function ($el) {
325
- var _a;
326
- if (lastMountedReactDom) {
327
- internalUnmountOptions.unmount($el[0]);
328
- var wasUnmounted = internalUnmountOptions.unmount($el[0]);
329
- if (wasUnmounted && options.log) {
330
- Cypress.log({
331
- name: 'unmount',
332
- type: 'parent',
333
- message: [(_a = options.boundComponentMessage) !== null && _a !== void 0 ? _a : 'Unmounted component'],
334
- consoleProps: function () {
335
- return {
336
- description: 'Unmounts React component',
337
- parent: $el[0],
338
- home: 'https://github.com/cypress-io/cypress',
339
- };
340
- },
341
- });
342
- }
343
- }
344
- });
324
+ var _a;
325
+ var wasUnmounted = mountCleanup === null || mountCleanup === void 0 ? void 0 : mountCleanup();
326
+ if (wasUnmounted && options.log) {
327
+ Cypress.log({
328
+ name: 'unmount',
329
+ type: 'parent',
330
+ message: [(_a = options.boundComponentMessage) !== null && _a !== void 0 ? _a : 'Unmounted component'],
331
+ consoleProps: function () {
332
+ return {
333
+ description: 'Unmounts React component',
334
+ parent: getContainerEl().parentNode,
335
+ home: 'https://github.com/cypress-io/cypress',
336
+ };
337
+ },
338
+ });
339
+ }
345
340
  });
346
341
  };
347
342
  // Cleanup before each run
348
343
  // NOTE: we cannot use unmount here because
349
344
  // we are not in the context of a test
350
345
  var preMountCleanup = function () {
351
- var el = getContainerEl();
352
- if (el && lastMountedReactDom) {
353
- lastMountedReactDom.unmountComponentAtNode(el);
354
- }
346
+ mountCleanup === null || mountCleanup === void 0 ? void 0 : mountCleanup();
355
347
  };
356
348
  // Side effects from "import { mount } from '@cypress/<my-framework>'" are annoying, we should avoid doing this
357
349
  // by creating an explicit function/import that the user can register in their 'component.js' support file,
@@ -366,7 +358,232 @@ var preMountCleanup = function () {
366
358
  // @see npm/react/cypress/component/advanced/set-timeout-example/loading-indicator-spec.js
367
359
  setupHooks(preMountCleanup);
368
360
 
361
+ const debug = (
362
+ typeof process === 'object' &&
363
+ process.env &&
364
+ process.env.NODE_DEBUG &&
365
+ /\bsemver\b/i.test(process.env.NODE_DEBUG)
366
+ ) ? (...args) => console.error('SEMVER', ...args)
367
+ : () => {};
368
+
369
+ var debug_1 = debug;
370
+
371
+ // Note: this is the semver.org version of the spec that it implements
372
+ // Not necessarily the package version of this code.
373
+ const SEMVER_SPEC_VERSION = '2.0.0';
374
+
375
+ const MAX_LENGTH$1 = 256;
376
+ const MAX_SAFE_INTEGER$1 = Number.MAX_SAFE_INTEGER ||
377
+ /* istanbul ignore next */ 9007199254740991;
378
+
379
+ // Max safe segment length for coercion.
380
+ const MAX_SAFE_COMPONENT_LENGTH = 16;
381
+
382
+ var constants = {
383
+ SEMVER_SPEC_VERSION,
384
+ MAX_LENGTH: MAX_LENGTH$1,
385
+ MAX_SAFE_INTEGER: MAX_SAFE_INTEGER$1,
386
+ MAX_SAFE_COMPONENT_LENGTH,
387
+ };
388
+
389
+ function createCommonjsModule(fn) {
390
+ var module = { exports: {} };
391
+ return fn(module, module.exports), module.exports;
392
+ }
393
+
394
+ createCommonjsModule(function (module, exports) {
395
+ const { MAX_SAFE_COMPONENT_LENGTH } = constants;
396
+
397
+ exports = module.exports = {};
398
+
399
+ // The actual regexps go on exports.re
400
+ const re = exports.re = [];
401
+ const src = exports.src = [];
402
+ const t = exports.t = {};
403
+ let R = 0;
404
+
405
+ const createToken = (name, value, isGlobal) => {
406
+ const index = R++;
407
+ debug_1(name, index, value);
408
+ t[name] = index;
409
+ src[index] = value;
410
+ re[index] = new RegExp(value, isGlobal ? 'g' : undefined);
411
+ };
412
+
413
+ // The following Regular Expressions can be used for tokenizing,
414
+ // validating, and parsing SemVer version strings.
415
+
416
+ // ## Numeric Identifier
417
+ // A single `0`, or a non-zero digit followed by zero or more digits.
418
+
419
+ createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*');
420
+ createToken('NUMERICIDENTIFIERLOOSE', '[0-9]+');
421
+
422
+ // ## Non-numeric Identifier
423
+ // Zero or more digits, followed by a letter or hyphen, and then zero or
424
+ // more letters, digits, or hyphens.
425
+
426
+ createToken('NONNUMERICIDENTIFIER', '\\d*[a-zA-Z-][a-zA-Z0-9-]*');
427
+
428
+ // ## Main Version
429
+ // Three dot-separated numeric identifiers.
430
+
431
+ createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` +
432
+ `(${src[t.NUMERICIDENTIFIER]})\\.` +
433
+ `(${src[t.NUMERICIDENTIFIER]})`);
434
+
435
+ createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
436
+ `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
437
+ `(${src[t.NUMERICIDENTIFIERLOOSE]})`);
438
+
439
+ // ## Pre-release Version Identifier
440
+ // A numeric identifier, or a non-numeric identifier.
441
+
442
+ createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER]
443
+ }|${src[t.NONNUMERICIDENTIFIER]})`);
444
+
445
+ createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE]
446
+ }|${src[t.NONNUMERICIDENTIFIER]})`);
447
+
448
+ // ## Pre-release Version
449
+ // Hyphen, followed by one or more dot-separated pre-release version
450
+ // identifiers.
451
+
452
+ createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]
453
+ }(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
454
+
455
+ createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]
456
+ }(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
457
+
458
+ // ## Build Metadata Identifier
459
+ // Any combination of digits, letters, or hyphens.
460
+
461
+ createToken('BUILDIDENTIFIER', '[0-9A-Za-z-]+');
462
+
463
+ // ## Build Metadata
464
+ // Plus sign, followed by one or more period-separated build metadata
465
+ // identifiers.
466
+
467
+ createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER]
468
+ }(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
469
+
470
+ // ## Full Version String
471
+ // A main version, followed optionally by a pre-release version and
472
+ // build metadata.
473
+
474
+ // Note that the only major, minor, patch, and pre-release sections of
475
+ // the version string are capturing groups. The build metadata is not a
476
+ // capturing group, because it should not ever be used in version
477
+ // comparison.
478
+
479
+ createToken('FULLPLAIN', `v?${src[t.MAINVERSION]
480
+ }${src[t.PRERELEASE]}?${
481
+ src[t.BUILD]}?`);
482
+
483
+ createToken('FULL', `^${src[t.FULLPLAIN]}$`);
484
+
485
+ // like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
486
+ // also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
487
+ // common in the npm registry.
488
+ createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE]
489
+ }${src[t.PRERELEASELOOSE]}?${
490
+ src[t.BUILD]}?`);
491
+
492
+ createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`);
493
+
494
+ createToken('GTLT', '((?:<|>)?=?)');
495
+
496
+ // Something like "2.*" or "1.2.x".
497
+ // Note that "x.x" is a valid xRange identifer, meaning "any version"
498
+ // Only the first item is strictly required.
499
+ createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
500
+ createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
501
+
502
+ createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` +
503
+ `(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
504
+ `(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
505
+ `(?:${src[t.PRERELEASE]})?${
506
+ src[t.BUILD]}?` +
507
+ `)?)?`);
508
+
509
+ createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +
510
+ `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
511
+ `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
512
+ `(?:${src[t.PRERELEASELOOSE]})?${
513
+ src[t.BUILD]}?` +
514
+ `)?)?`);
515
+
516
+ createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
517
+ createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
518
+
519
+ // Coercion.
520
+ // Extract anything that could conceivably be a part of a valid semver
521
+ createToken('COERCE', `${'(^|[^\\d])' +
522
+ '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +
523
+ `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
524
+ `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
525
+ `(?:$|[^\\d])`);
526
+ createToken('COERCERTL', src[t.COERCE], true);
527
+
528
+ // Tilde ranges.
529
+ // Meaning is "reasonably at or greater than"
530
+ createToken('LONETILDE', '(?:~>?)');
531
+
532
+ createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true);
533
+ exports.tildeTrimReplace = '$1~';
534
+
535
+ createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
536
+ createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
537
+
538
+ // Caret ranges.
539
+ // Meaning is "at least and backwards compatible with"
540
+ createToken('LONECARET', '(?:\\^)');
541
+
542
+ createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true);
543
+ exports.caretTrimReplace = '$1^';
544
+
545
+ createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
546
+ createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
547
+
548
+ // A simple gt/lt/eq thing, or just "" to indicate "any version"
549
+ createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
550
+ createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
551
+
552
+ // An expression to strip any whitespace between the gtlt and the thing
553
+ // it modifies, so that `> 1.2.3` ==> `>1.2.3`
554
+ createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT]
555
+ }\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
556
+ exports.comparatorTrimReplace = '$1$2$3';
557
+
558
+ // Something like `1.2.3 - 1.2.4`
559
+ // Note that these all use the loose form, because they'll be
560
+ // checked against either the strict or loose comparator form
561
+ // later.
562
+ createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` +
563
+ `\\s+-\\s+` +
564
+ `(${src[t.XRANGEPLAIN]})` +
565
+ `\\s*$`);
566
+
567
+ createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` +
568
+ `\\s+-\\s+` +
569
+ `(${src[t.XRANGEPLAINLOOSE]})` +
570
+ `\\s*$`);
571
+
572
+ // Star ranges basically just allow anything at all.
573
+ createToken('STAR', '(<|>)?=?\\s*\\*');
574
+ // >=0.0.0 is like a star
575
+ createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$');
576
+ createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$');
577
+ });
578
+
369
579
  var root;
580
+ var cleanup = function () {
581
+ if (root) {
582
+ root.unmount();
583
+ return true;
584
+ }
585
+ return false;
586
+ };
370
587
  function mount(jsx, options, rerenderKey) {
371
588
  if (options === void 0) { options = {}; }
372
589
  var internalOptions = {
@@ -376,19 +593,13 @@ function mount(jsx, options, rerenderKey) {
376
593
  return root.render(reactComponent);
377
594
  },
378
595
  unmount: unmount,
596
+ cleanup: cleanup,
379
597
  };
380
598
  return makeMountFn('mount', jsx, __assign({ ReactDom: ReactDOM }, options), rerenderKey, internalOptions);
381
599
  }
382
600
  function unmount(options) {
383
601
  if (options === void 0) { options = { log: true }; }
384
- var internalOptions = {
385
- // type is ReturnType<typeof ReactDOM.createRoot>
386
- unmount: function () {
387
- root.unmount();
388
- return true;
389
- },
390
- };
391
- return makeUnmountFn(options, internalOptions);
602
+ return makeUnmountFn(options);
392
603
  }
393
604
 
394
605
  export { mount, unmount };
@@ -2,4 +2,4 @@
2
2
  import React from 'react';
3
3
  import type { MountOptions, UnmountArgs } from '@cypress/react';
4
4
  export declare function mount(jsx: React.ReactNode, options?: MountOptions, rerenderKey?: string): Cypress.Chainable<import("@cypress/react").MountReturn>;
5
- export declare function unmount(options?: UnmountArgs): Cypress.Chainable<JQuery<HTMLElement>>;
5
+ export declare function unmount(options?: UnmountArgs): Cypress.Chainable<undefined>;
@@ -2784,6 +2784,13 @@ declare namespace Cypress {
2784
2784
  * @default "cypress/support/{e2e|component}.js"
2785
2785
  */
2786
2786
  supportFile: string | false
2787
+ /**
2788
+ * The test isolation level applied to ensure a clean slate between tests.
2789
+ * - legacy - resets/clears aliases, intercepts, clock, viewport, cookies, and local storage before each test.
2790
+ * - strict - applies all resets/clears from legacy, plus clears the page by visiting 'about:blank' to ensure clean app state before each test.
2791
+ * @default "legacy", however, when experimentalSessionAndOrigin=true, the default is "strict"
2792
+ */
2793
+ testIsolation: 'legacy' | 'strict'
2787
2794
  /**
2788
2795
  * Path to folder where videos will be saved after a headless or CI run
2789
2796
  * @default "cypress/videos"
@@ -3044,7 +3051,7 @@ declare namespace Cypress {
3044
3051
 
3045
3052
  type DevServerConfigOptions = {
3046
3053
  bundler: 'webpack'
3047
- framework: 'react' | 'vue' | 'vue-cli' | 'nuxt' | 'create-react-app' | 'next'
3054
+ framework: 'react' | 'vue' | 'vue-cli' | 'nuxt' | 'create-react-app' | 'next' | 'angular'
3048
3055
  webpackConfig?: PickConfigOpt<'webpackConfig'>
3049
3056
  } | {
3050
3057
  bundler: 'vite'
@@ -3066,7 +3073,12 @@ declare namespace Cypress {
3066
3073
  * Takes ComponentDevServerOpts to track the signature of the devServerConfig for the provided `devServer`,
3067
3074
  * so we have proper completion for `devServerConfig`
3068
3075
  */
3069
- type ConfigOptions<ComponentDevServerOpts = any> = Partial<UserConfigOptions<ComponentDevServerOpts>>
3076
+ type ConfigOptions<ComponentDevServerOpts = any> = Partial<UserConfigOptions<ComponentDevServerOpts>> & {
3077
+ /**
3078
+ * Hosts mappings to IP addresses.
3079
+ */
3080
+ hosts?: null | {[key: string]: string}
3081
+ }
3070
3082
 
3071
3083
  interface PluginConfigOptions extends ResolvedConfigOptions, RuntimeConfigOptions {
3072
3084
  /**
package/vue/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [@cypress/vue-v4.1.0](https://github.com/cypress-io/cypress/compare/@cypress/vue-v4.0.0...@cypress/vue-v4.1.0) (2022-08-11)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * remove CT side effects from mount when e2e testing ([#22633](https://github.com/cypress-io/cypress/issues/22633)) ([a9476ec](https://github.com/cypress-io/cypress/commit/a9476ecb3d43f628b689e060294a1952937cb1a7))
7
+ * remove dependency causing semantic-release to fail ([#23142](https://github.com/cypress-io/cypress/issues/23142)) ([20f89bf](https://github.com/cypress-io/cypress/commit/20f89bfa32636baa8922896e719962c703129abd))
8
+
9
+
10
+ ### Features
11
+
12
+ * **npm/vue:** expose Test Utils API ([#22757](https://github.com/cypress-io/cypress/issues/22757)) ([8e07318](https://github.com/cypress-io/cypress/commit/8e07318a9f72c3df012be47d500007571165a87e))
13
+ * update to Vite 3 ([#22915](https://github.com/cypress-io/cypress/issues/22915)) ([6adba46](https://github.com/cypress-io/cypress/commit/6adba462ea6b76dbb96f99aa3837492ca1f17ed3))
14
+
1
15
  # [@cypress/vue-v4.0.0](https://github.com/cypress-io/cypress/compare/@cypress/vue-v3.1.2...@cypress/vue-v4.0.0) (2022-06-13)
2
16
 
3
17
 
package/vue/package.json CHANGED
@@ -15,7 +15,6 @@
15
15
  "watch": "yarn build --watch --watch.exclude ./dist/**/*"
16
16
  },
17
17
  "devDependencies": {
18
- "@cypress/code-coverage": "3.8.1",
19
18
  "@cypress/mount-utils": "0.0.0-development",
20
19
  "@rollup/plugin-commonjs": "^17.1.0",
21
20
  "@rollup/plugin-node-resolve": "^11.1.1",
package/vue2/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [@cypress/vue2-v1.0.2](https://github.com/cypress-io/cypress/compare/@cypress/vue2-v1.0.1...@cypress/vue2-v1.0.2) (2022-08-11)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * remove CT side effects from mount when e2e testing ([#22633](https://github.com/cypress-io/cypress/issues/22633)) ([a9476ec](https://github.com/cypress-io/cypress/commit/a9476ecb3d43f628b689e060294a1952937cb1a7))
7
+
1
8
  # [@cypress/vue2-v1.0.1](https://github.com/cypress-io/cypress/compare/@cypress/vue2-v1.0.0...@cypress/vue2-v1.0.1) (2022-06-13)
2
9
 
3
10