cypress 10.4.0 → 10.5.0
Sign up to get free protection for your applications and to get access to all the features.
- package/angular/CHANGELOG.md +55 -0
- package/angular/README.md +154 -0
- package/angular/dist/index.d.ts +1 -0
- package/angular/dist/index.js +263 -0
- package/angular/dist/mount.d.ts +111 -0
- package/angular/package.json +70 -0
- package/mount-utils/CHANGELOG.md +7 -0
- package/package.json +10 -4
- package/react/CHANGELOG.md +13 -0
- package/react/dist/createMount.d.ts +2 -4
- package/react/dist/cypress-react.cjs.js +583 -35
- package/react/dist/cypress-react.esm-bundler.js +584 -36
- package/react/dist/mount.d.ts +1 -1
- package/react/dist/types.d.ts +1 -7
- package/react/package.json +2 -0
- package/react18/CHANGELOG.md +6 -0
- package/react18/dist/cypress-react.cjs.js +247 -36
- package/react18/dist/cypress-react.esm-bundler.js +247 -36
- package/react18/dist/index.d.ts +1 -1
- package/types/cypress.d.ts +14 -2
- package/vue/CHANGELOG.md +14 -0
- package/vue/package.json +0 -1
- package/vue2/CHANGELOG.md +7 -0
@@ -33,6 +33,7 @@ function _interopNamespace(e) {
|
|
33
33
|
}
|
34
34
|
|
35
35
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
36
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
36
37
|
var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
|
37
38
|
|
38
39
|
/******************************************************************************
|
@@ -257,7 +258,7 @@ var injectStyles = function (options) {
|
|
257
258
|
return injectStylesBeforeElement(options, document, el);
|
258
259
|
};
|
259
260
|
};
|
260
|
-
|
261
|
+
var mountCleanup;
|
261
262
|
/**
|
262
263
|
* Create an `mount` function. Performs all the non-React-version specific
|
263
264
|
* behavior related to mounting. The React-version-specific code
|
@@ -272,6 +273,7 @@ var makeMountFn = function (type, jsx, options, rerenderKey, internalMountOption
|
|
272
273
|
if (!internalMountOptions) {
|
273
274
|
throw Error('internalMountOptions must be provided with `render` and `reactDom` parameters');
|
274
275
|
}
|
276
|
+
mountCleanup = internalMountOptions.cleanup;
|
275
277
|
// Get the display name property via the component constructor
|
276
278
|
// @ts-ignore FIXME
|
277
279
|
var componentName = getDisplayName(jsx.type, options.alias);
|
@@ -285,7 +287,6 @@ var makeMountFn = function (type, jsx, options, rerenderKey, internalMountOption
|
|
285
287
|
.then(function () {
|
286
288
|
var _a, _b, _c;
|
287
289
|
var reactDomToUse = internalMountOptions.reactDom;
|
288
|
-
exports.lastMountedReactDom = reactDomToUse;
|
289
290
|
var el = getContainerEl();
|
290
291
|
if (!el) {
|
291
292
|
throw new Error([
|
@@ -345,39 +346,31 @@ var makeMountFn = function (type, jsx, options, rerenderKey, internalMountOption
|
|
345
346
|
* This is designed to be consumed by `npm/react{16,17,18}`, and other React adapters,
|
346
347
|
* or people writing adapters for third-party, custom adapters.
|
347
348
|
*/
|
348
|
-
var makeUnmountFn = function (options
|
349
|
+
var makeUnmountFn = function (options) {
|
349
350
|
return cy.then(function () {
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
},
|
367
|
-
});
|
368
|
-
}
|
369
|
-
}
|
370
|
-
});
|
351
|
+
var _a;
|
352
|
+
var wasUnmounted = mountCleanup === null || mountCleanup === void 0 ? void 0 : mountCleanup();
|
353
|
+
if (wasUnmounted && options.log) {
|
354
|
+
Cypress.log({
|
355
|
+
name: 'unmount',
|
356
|
+
type: 'parent',
|
357
|
+
message: [(_a = options.boundComponentMessage) !== null && _a !== void 0 ? _a : 'Unmounted component'],
|
358
|
+
consoleProps: function () {
|
359
|
+
return {
|
360
|
+
description: 'Unmounts React component',
|
361
|
+
parent: getContainerEl().parentNode,
|
362
|
+
home: 'https://github.com/cypress-io/cypress',
|
363
|
+
};
|
364
|
+
},
|
365
|
+
});
|
366
|
+
}
|
371
367
|
});
|
372
368
|
};
|
373
369
|
// Cleanup before each run
|
374
370
|
// NOTE: we cannot use unmount here because
|
375
371
|
// we are not in the context of a test
|
376
372
|
var preMountCleanup = function () {
|
377
|
-
|
378
|
-
if (el && exports.lastMountedReactDom) {
|
379
|
-
exports.lastMountedReactDom.unmountComponentAtNode(el);
|
380
|
-
}
|
373
|
+
mountCleanup === null || mountCleanup === void 0 ? void 0 : mountCleanup();
|
381
374
|
};
|
382
375
|
var _mount = function (jsx, options) {
|
383
376
|
if (options === void 0) { options = {}; }
|
@@ -401,25 +394,580 @@ var createMount = function (defaultOptions) {
|
|
401
394
|
// @see npm/react/cypress/component/advanced/set-timeout-example/loading-indicator-spec.js
|
402
395
|
setupHooks(preMountCleanup);
|
403
396
|
|
397
|
+
const debug = (
|
398
|
+
typeof process === 'object' &&
|
399
|
+
process.env &&
|
400
|
+
process.env.NODE_DEBUG &&
|
401
|
+
/\bsemver\b/i.test(process.env.NODE_DEBUG)
|
402
|
+
) ? (...args) => console.error('SEMVER', ...args)
|
403
|
+
: () => {};
|
404
|
+
|
405
|
+
var debug_1 = debug;
|
406
|
+
|
407
|
+
// Note: this is the semver.org version of the spec that it implements
|
408
|
+
// Not necessarily the package version of this code.
|
409
|
+
const SEMVER_SPEC_VERSION = '2.0.0';
|
410
|
+
|
411
|
+
const MAX_LENGTH$1 = 256;
|
412
|
+
const MAX_SAFE_INTEGER$1 = Number.MAX_SAFE_INTEGER ||
|
413
|
+
/* istanbul ignore next */ 9007199254740991;
|
414
|
+
|
415
|
+
// Max safe segment length for coercion.
|
416
|
+
const MAX_SAFE_COMPONENT_LENGTH = 16;
|
417
|
+
|
418
|
+
var constants = {
|
419
|
+
SEMVER_SPEC_VERSION,
|
420
|
+
MAX_LENGTH: MAX_LENGTH$1,
|
421
|
+
MAX_SAFE_INTEGER: MAX_SAFE_INTEGER$1,
|
422
|
+
MAX_SAFE_COMPONENT_LENGTH,
|
423
|
+
};
|
424
|
+
|
425
|
+
function createCommonjsModule(fn) {
|
426
|
+
var module = { exports: {} };
|
427
|
+
return fn(module, module.exports), module.exports;
|
428
|
+
}
|
429
|
+
|
430
|
+
var re_1 = createCommonjsModule(function (module, exports) {
|
431
|
+
const { MAX_SAFE_COMPONENT_LENGTH } = constants;
|
432
|
+
|
433
|
+
exports = module.exports = {};
|
434
|
+
|
435
|
+
// The actual regexps go on exports.re
|
436
|
+
const re = exports.re = [];
|
437
|
+
const src = exports.src = [];
|
438
|
+
const t = exports.t = {};
|
439
|
+
let R = 0;
|
440
|
+
|
441
|
+
const createToken = (name, value, isGlobal) => {
|
442
|
+
const index = R++;
|
443
|
+
debug_1(name, index, value);
|
444
|
+
t[name] = index;
|
445
|
+
src[index] = value;
|
446
|
+
re[index] = new RegExp(value, isGlobal ? 'g' : undefined);
|
447
|
+
};
|
448
|
+
|
449
|
+
// The following Regular Expressions can be used for tokenizing,
|
450
|
+
// validating, and parsing SemVer version strings.
|
451
|
+
|
452
|
+
// ## Numeric Identifier
|
453
|
+
// A single `0`, or a non-zero digit followed by zero or more digits.
|
454
|
+
|
455
|
+
createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*');
|
456
|
+
createToken('NUMERICIDENTIFIERLOOSE', '[0-9]+');
|
457
|
+
|
458
|
+
// ## Non-numeric Identifier
|
459
|
+
// Zero or more digits, followed by a letter or hyphen, and then zero or
|
460
|
+
// more letters, digits, or hyphens.
|
461
|
+
|
462
|
+
createToken('NONNUMERICIDENTIFIER', '\\d*[a-zA-Z-][a-zA-Z0-9-]*');
|
463
|
+
|
464
|
+
// ## Main Version
|
465
|
+
// Three dot-separated numeric identifiers.
|
466
|
+
|
467
|
+
createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` +
|
468
|
+
`(${src[t.NUMERICIDENTIFIER]})\\.` +
|
469
|
+
`(${src[t.NUMERICIDENTIFIER]})`);
|
470
|
+
|
471
|
+
createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
|
472
|
+
`(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
|
473
|
+
`(${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
474
|
+
|
475
|
+
// ## Pre-release Version Identifier
|
476
|
+
// A numeric identifier, or a non-numeric identifier.
|
477
|
+
|
478
|
+
createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER]
|
479
|
+
}|${src[t.NONNUMERICIDENTIFIER]})`);
|
480
|
+
|
481
|
+
createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE]
|
482
|
+
}|${src[t.NONNUMERICIDENTIFIER]})`);
|
483
|
+
|
484
|
+
// ## Pre-release Version
|
485
|
+
// Hyphen, followed by one or more dot-separated pre-release version
|
486
|
+
// identifiers.
|
487
|
+
|
488
|
+
createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]
|
489
|
+
}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
|
490
|
+
|
491
|
+
createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]
|
492
|
+
}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
|
493
|
+
|
494
|
+
// ## Build Metadata Identifier
|
495
|
+
// Any combination of digits, letters, or hyphens.
|
496
|
+
|
497
|
+
createToken('BUILDIDENTIFIER', '[0-9A-Za-z-]+');
|
498
|
+
|
499
|
+
// ## Build Metadata
|
500
|
+
// Plus sign, followed by one or more period-separated build metadata
|
501
|
+
// identifiers.
|
502
|
+
|
503
|
+
createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER]
|
504
|
+
}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
|
505
|
+
|
506
|
+
// ## Full Version String
|
507
|
+
// A main version, followed optionally by a pre-release version and
|
508
|
+
// build metadata.
|
509
|
+
|
510
|
+
// Note that the only major, minor, patch, and pre-release sections of
|
511
|
+
// the version string are capturing groups. The build metadata is not a
|
512
|
+
// capturing group, because it should not ever be used in version
|
513
|
+
// comparison.
|
514
|
+
|
515
|
+
createToken('FULLPLAIN', `v?${src[t.MAINVERSION]
|
516
|
+
}${src[t.PRERELEASE]}?${
|
517
|
+
src[t.BUILD]}?`);
|
518
|
+
|
519
|
+
createToken('FULL', `^${src[t.FULLPLAIN]}$`);
|
520
|
+
|
521
|
+
// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
|
522
|
+
// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
|
523
|
+
// common in the npm registry.
|
524
|
+
createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE]
|
525
|
+
}${src[t.PRERELEASELOOSE]}?${
|
526
|
+
src[t.BUILD]}?`);
|
527
|
+
|
528
|
+
createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`);
|
529
|
+
|
530
|
+
createToken('GTLT', '((?:<|>)?=?)');
|
531
|
+
|
532
|
+
// Something like "2.*" or "1.2.x".
|
533
|
+
// Note that "x.x" is a valid xRange identifer, meaning "any version"
|
534
|
+
// Only the first item is strictly required.
|
535
|
+
createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
|
536
|
+
createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
|
537
|
+
|
538
|
+
createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` +
|
539
|
+
`(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
|
540
|
+
`(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
|
541
|
+
`(?:${src[t.PRERELEASE]})?${
|
542
|
+
src[t.BUILD]}?` +
|
543
|
+
`)?)?`);
|
544
|
+
|
545
|
+
createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +
|
546
|
+
`(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
|
547
|
+
`(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
|
548
|
+
`(?:${src[t.PRERELEASELOOSE]})?${
|
549
|
+
src[t.BUILD]}?` +
|
550
|
+
`)?)?`);
|
551
|
+
|
552
|
+
createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
|
553
|
+
createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
|
554
|
+
|
555
|
+
// Coercion.
|
556
|
+
// Extract anything that could conceivably be a part of a valid semver
|
557
|
+
createToken('COERCE', `${'(^|[^\\d])' +
|
558
|
+
'(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +
|
559
|
+
`(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
|
560
|
+
`(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
|
561
|
+
`(?:$|[^\\d])`);
|
562
|
+
createToken('COERCERTL', src[t.COERCE], true);
|
563
|
+
|
564
|
+
// Tilde ranges.
|
565
|
+
// Meaning is "reasonably at or greater than"
|
566
|
+
createToken('LONETILDE', '(?:~>?)');
|
567
|
+
|
568
|
+
createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true);
|
569
|
+
exports.tildeTrimReplace = '$1~';
|
570
|
+
|
571
|
+
createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
|
572
|
+
createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
|
573
|
+
|
574
|
+
// Caret ranges.
|
575
|
+
// Meaning is "at least and backwards compatible with"
|
576
|
+
createToken('LONECARET', '(?:\\^)');
|
577
|
+
|
578
|
+
createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true);
|
579
|
+
exports.caretTrimReplace = '$1^';
|
580
|
+
|
581
|
+
createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
|
582
|
+
createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
|
583
|
+
|
584
|
+
// A simple gt/lt/eq thing, or just "" to indicate "any version"
|
585
|
+
createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
|
586
|
+
createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
|
587
|
+
|
588
|
+
// An expression to strip any whitespace between the gtlt and the thing
|
589
|
+
// it modifies, so that `> 1.2.3` ==> `>1.2.3`
|
590
|
+
createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT]
|
591
|
+
}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
|
592
|
+
exports.comparatorTrimReplace = '$1$2$3';
|
593
|
+
|
594
|
+
// Something like `1.2.3 - 1.2.4`
|
595
|
+
// Note that these all use the loose form, because they'll be
|
596
|
+
// checked against either the strict or loose comparator form
|
597
|
+
// later.
|
598
|
+
createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` +
|
599
|
+
`\\s+-\\s+` +
|
600
|
+
`(${src[t.XRANGEPLAIN]})` +
|
601
|
+
`\\s*$`);
|
602
|
+
|
603
|
+
createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` +
|
604
|
+
`\\s+-\\s+` +
|
605
|
+
`(${src[t.XRANGEPLAINLOOSE]})` +
|
606
|
+
`\\s*$`);
|
607
|
+
|
608
|
+
// Star ranges basically just allow anything at all.
|
609
|
+
createToken('STAR', '(<|>)?=?\\s*\\*');
|
610
|
+
// >=0.0.0 is like a star
|
611
|
+
createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$');
|
612
|
+
createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$');
|
613
|
+
});
|
614
|
+
|
615
|
+
// parse out just the options we care about so we always get a consistent
|
616
|
+
// obj with keys in a consistent order.
|
617
|
+
const opts = ['includePrerelease', 'loose', 'rtl'];
|
618
|
+
const parseOptions = options =>
|
619
|
+
!options ? {}
|
620
|
+
: typeof options !== 'object' ? { loose: true }
|
621
|
+
: opts.filter(k => options[k]).reduce((o, k) => {
|
622
|
+
o[k] = true;
|
623
|
+
return o
|
624
|
+
}, {});
|
625
|
+
var parseOptions_1 = parseOptions;
|
626
|
+
|
627
|
+
const numeric = /^[0-9]+$/;
|
628
|
+
const compareIdentifiers$1 = (a, b) => {
|
629
|
+
const anum = numeric.test(a);
|
630
|
+
const bnum = numeric.test(b);
|
631
|
+
|
632
|
+
if (anum && bnum) {
|
633
|
+
a = +a;
|
634
|
+
b = +b;
|
635
|
+
}
|
636
|
+
|
637
|
+
return a === b ? 0
|
638
|
+
: (anum && !bnum) ? -1
|
639
|
+
: (bnum && !anum) ? 1
|
640
|
+
: a < b ? -1
|
641
|
+
: 1
|
642
|
+
};
|
643
|
+
|
644
|
+
const rcompareIdentifiers = (a, b) => compareIdentifiers$1(b, a);
|
645
|
+
|
646
|
+
var identifiers = {
|
647
|
+
compareIdentifiers: compareIdentifiers$1,
|
648
|
+
rcompareIdentifiers,
|
649
|
+
};
|
650
|
+
|
651
|
+
const { MAX_LENGTH, MAX_SAFE_INTEGER } = constants;
|
652
|
+
const { re, t } = re_1;
|
653
|
+
|
654
|
+
|
655
|
+
const { compareIdentifiers } = identifiers;
|
656
|
+
class SemVer {
|
657
|
+
constructor (version, options) {
|
658
|
+
options = parseOptions_1(options);
|
659
|
+
|
660
|
+
if (version instanceof SemVer) {
|
661
|
+
if (version.loose === !!options.loose &&
|
662
|
+
version.includePrerelease === !!options.includePrerelease) {
|
663
|
+
return version
|
664
|
+
} else {
|
665
|
+
version = version.version;
|
666
|
+
}
|
667
|
+
} else if (typeof version !== 'string') {
|
668
|
+
throw new TypeError(`Invalid Version: ${version}`)
|
669
|
+
}
|
670
|
+
|
671
|
+
if (version.length > MAX_LENGTH) {
|
672
|
+
throw new TypeError(
|
673
|
+
`version is longer than ${MAX_LENGTH} characters`
|
674
|
+
)
|
675
|
+
}
|
676
|
+
|
677
|
+
debug_1('SemVer', version, options);
|
678
|
+
this.options = options;
|
679
|
+
this.loose = !!options.loose;
|
680
|
+
// this isn't actually relevant for versions, but keep it so that we
|
681
|
+
// don't run into trouble passing this.options around.
|
682
|
+
this.includePrerelease = !!options.includePrerelease;
|
683
|
+
|
684
|
+
const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
|
685
|
+
|
686
|
+
if (!m) {
|
687
|
+
throw new TypeError(`Invalid Version: ${version}`)
|
688
|
+
}
|
689
|
+
|
690
|
+
this.raw = version;
|
691
|
+
|
692
|
+
// these are actually numbers
|
693
|
+
this.major = +m[1];
|
694
|
+
this.minor = +m[2];
|
695
|
+
this.patch = +m[3];
|
696
|
+
|
697
|
+
if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
|
698
|
+
throw new TypeError('Invalid major version')
|
699
|
+
}
|
700
|
+
|
701
|
+
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
|
702
|
+
throw new TypeError('Invalid minor version')
|
703
|
+
}
|
704
|
+
|
705
|
+
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
|
706
|
+
throw new TypeError('Invalid patch version')
|
707
|
+
}
|
708
|
+
|
709
|
+
// numberify any prerelease numeric ids
|
710
|
+
if (!m[4]) {
|
711
|
+
this.prerelease = [];
|
712
|
+
} else {
|
713
|
+
this.prerelease = m[4].split('.').map((id) => {
|
714
|
+
if (/^[0-9]+$/.test(id)) {
|
715
|
+
const num = +id;
|
716
|
+
if (num >= 0 && num < MAX_SAFE_INTEGER) {
|
717
|
+
return num
|
718
|
+
}
|
719
|
+
}
|
720
|
+
return id
|
721
|
+
});
|
722
|
+
}
|
723
|
+
|
724
|
+
this.build = m[5] ? m[5].split('.') : [];
|
725
|
+
this.format();
|
726
|
+
}
|
727
|
+
|
728
|
+
format () {
|
729
|
+
this.version = `${this.major}.${this.minor}.${this.patch}`;
|
730
|
+
if (this.prerelease.length) {
|
731
|
+
this.version += `-${this.prerelease.join('.')}`;
|
732
|
+
}
|
733
|
+
return this.version
|
734
|
+
}
|
735
|
+
|
736
|
+
toString () {
|
737
|
+
return this.version
|
738
|
+
}
|
739
|
+
|
740
|
+
compare (other) {
|
741
|
+
debug_1('SemVer.compare', this.version, this.options, other);
|
742
|
+
if (!(other instanceof SemVer)) {
|
743
|
+
if (typeof other === 'string' && other === this.version) {
|
744
|
+
return 0
|
745
|
+
}
|
746
|
+
other = new SemVer(other, this.options);
|
747
|
+
}
|
748
|
+
|
749
|
+
if (other.version === this.version) {
|
750
|
+
return 0
|
751
|
+
}
|
752
|
+
|
753
|
+
return this.compareMain(other) || this.comparePre(other)
|
754
|
+
}
|
755
|
+
|
756
|
+
compareMain (other) {
|
757
|
+
if (!(other instanceof SemVer)) {
|
758
|
+
other = new SemVer(other, this.options);
|
759
|
+
}
|
760
|
+
|
761
|
+
return (
|
762
|
+
compareIdentifiers(this.major, other.major) ||
|
763
|
+
compareIdentifiers(this.minor, other.minor) ||
|
764
|
+
compareIdentifiers(this.patch, other.patch)
|
765
|
+
)
|
766
|
+
}
|
767
|
+
|
768
|
+
comparePre (other) {
|
769
|
+
if (!(other instanceof SemVer)) {
|
770
|
+
other = new SemVer(other, this.options);
|
771
|
+
}
|
772
|
+
|
773
|
+
// NOT having a prerelease is > having one
|
774
|
+
if (this.prerelease.length && !other.prerelease.length) {
|
775
|
+
return -1
|
776
|
+
} else if (!this.prerelease.length && other.prerelease.length) {
|
777
|
+
return 1
|
778
|
+
} else if (!this.prerelease.length && !other.prerelease.length) {
|
779
|
+
return 0
|
780
|
+
}
|
781
|
+
|
782
|
+
let i = 0;
|
783
|
+
do {
|
784
|
+
const a = this.prerelease[i];
|
785
|
+
const b = other.prerelease[i];
|
786
|
+
debug_1('prerelease compare', i, a, b);
|
787
|
+
if (a === undefined && b === undefined) {
|
788
|
+
return 0
|
789
|
+
} else if (b === undefined) {
|
790
|
+
return 1
|
791
|
+
} else if (a === undefined) {
|
792
|
+
return -1
|
793
|
+
} else if (a === b) {
|
794
|
+
continue
|
795
|
+
} else {
|
796
|
+
return compareIdentifiers(a, b)
|
797
|
+
}
|
798
|
+
} while (++i)
|
799
|
+
}
|
800
|
+
|
801
|
+
compareBuild (other) {
|
802
|
+
if (!(other instanceof SemVer)) {
|
803
|
+
other = new SemVer(other, this.options);
|
804
|
+
}
|
805
|
+
|
806
|
+
let i = 0;
|
807
|
+
do {
|
808
|
+
const a = this.build[i];
|
809
|
+
const b = other.build[i];
|
810
|
+
debug_1('prerelease compare', i, a, b);
|
811
|
+
if (a === undefined && b === undefined) {
|
812
|
+
return 0
|
813
|
+
} else if (b === undefined) {
|
814
|
+
return 1
|
815
|
+
} else if (a === undefined) {
|
816
|
+
return -1
|
817
|
+
} else if (a === b) {
|
818
|
+
continue
|
819
|
+
} else {
|
820
|
+
return compareIdentifiers(a, b)
|
821
|
+
}
|
822
|
+
} while (++i)
|
823
|
+
}
|
824
|
+
|
825
|
+
// preminor will bump the version up to the next minor release, and immediately
|
826
|
+
// down to pre-release. premajor and prepatch work the same way.
|
827
|
+
inc (release, identifier) {
|
828
|
+
switch (release) {
|
829
|
+
case 'premajor':
|
830
|
+
this.prerelease.length = 0;
|
831
|
+
this.patch = 0;
|
832
|
+
this.minor = 0;
|
833
|
+
this.major++;
|
834
|
+
this.inc('pre', identifier);
|
835
|
+
break
|
836
|
+
case 'preminor':
|
837
|
+
this.prerelease.length = 0;
|
838
|
+
this.patch = 0;
|
839
|
+
this.minor++;
|
840
|
+
this.inc('pre', identifier);
|
841
|
+
break
|
842
|
+
case 'prepatch':
|
843
|
+
// If this is already a prerelease, it will bump to the next version
|
844
|
+
// drop any prereleases that might already exist, since they are not
|
845
|
+
// relevant at this point.
|
846
|
+
this.prerelease.length = 0;
|
847
|
+
this.inc('patch', identifier);
|
848
|
+
this.inc('pre', identifier);
|
849
|
+
break
|
850
|
+
// If the input is a non-prerelease version, this acts the same as
|
851
|
+
// prepatch.
|
852
|
+
case 'prerelease':
|
853
|
+
if (this.prerelease.length === 0) {
|
854
|
+
this.inc('patch', identifier);
|
855
|
+
}
|
856
|
+
this.inc('pre', identifier);
|
857
|
+
break
|
858
|
+
|
859
|
+
case 'major':
|
860
|
+
// If this is a pre-major version, bump up to the same major version.
|
861
|
+
// Otherwise increment major.
|
862
|
+
// 1.0.0-5 bumps to 1.0.0
|
863
|
+
// 1.1.0 bumps to 2.0.0
|
864
|
+
if (
|
865
|
+
this.minor !== 0 ||
|
866
|
+
this.patch !== 0 ||
|
867
|
+
this.prerelease.length === 0
|
868
|
+
) {
|
869
|
+
this.major++;
|
870
|
+
}
|
871
|
+
this.minor = 0;
|
872
|
+
this.patch = 0;
|
873
|
+
this.prerelease = [];
|
874
|
+
break
|
875
|
+
case 'minor':
|
876
|
+
// If this is a pre-minor version, bump up to the same minor version.
|
877
|
+
// Otherwise increment minor.
|
878
|
+
// 1.2.0-5 bumps to 1.2.0
|
879
|
+
// 1.2.1 bumps to 1.3.0
|
880
|
+
if (this.patch !== 0 || this.prerelease.length === 0) {
|
881
|
+
this.minor++;
|
882
|
+
}
|
883
|
+
this.patch = 0;
|
884
|
+
this.prerelease = [];
|
885
|
+
break
|
886
|
+
case 'patch':
|
887
|
+
// If this is not a pre-release version, it will increment the patch.
|
888
|
+
// If it is a pre-release it will bump up to the same patch version.
|
889
|
+
// 1.2.0-5 patches to 1.2.0
|
890
|
+
// 1.2.0 patches to 1.2.1
|
891
|
+
if (this.prerelease.length === 0) {
|
892
|
+
this.patch++;
|
893
|
+
}
|
894
|
+
this.prerelease = [];
|
895
|
+
break
|
896
|
+
// This probably shouldn't be used publicly.
|
897
|
+
// 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
|
898
|
+
case 'pre':
|
899
|
+
if (this.prerelease.length === 0) {
|
900
|
+
this.prerelease = [0];
|
901
|
+
} else {
|
902
|
+
let i = this.prerelease.length;
|
903
|
+
while (--i >= 0) {
|
904
|
+
if (typeof this.prerelease[i] === 'number') {
|
905
|
+
this.prerelease[i]++;
|
906
|
+
i = -2;
|
907
|
+
}
|
908
|
+
}
|
909
|
+
if (i === -1) {
|
910
|
+
// didn't increment anything
|
911
|
+
this.prerelease.push(0);
|
912
|
+
}
|
913
|
+
}
|
914
|
+
if (identifier) {
|
915
|
+
// 1.2.0-beta.1 bumps to 1.2.0-beta.2,
|
916
|
+
// 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
|
917
|
+
if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
|
918
|
+
if (isNaN(this.prerelease[1])) {
|
919
|
+
this.prerelease = [identifier, 0];
|
920
|
+
}
|
921
|
+
} else {
|
922
|
+
this.prerelease = [identifier, 0];
|
923
|
+
}
|
924
|
+
}
|
925
|
+
break
|
926
|
+
|
927
|
+
default:
|
928
|
+
throw new Error(`invalid increment argument: ${release}`)
|
929
|
+
}
|
930
|
+
this.format();
|
931
|
+
this.raw = this.version;
|
932
|
+
return this
|
933
|
+
}
|
934
|
+
}
|
935
|
+
|
936
|
+
var semver = SemVer;
|
937
|
+
|
938
|
+
const major = (a, loose) => new semver(a, loose).major;
|
939
|
+
var major_1 = major;
|
940
|
+
|
941
|
+
var lastReactDom;
|
942
|
+
var cleanup = function () {
|
943
|
+
if (lastReactDom) {
|
944
|
+
var root = getContainerEl();
|
945
|
+
lastReactDom.unmountComponentAtNode(root);
|
946
|
+
return true;
|
947
|
+
}
|
948
|
+
return false;
|
949
|
+
};
|
404
950
|
function mount(jsx, options, rerenderKey) {
|
405
951
|
if (options === void 0) { options = {}; }
|
952
|
+
if (major_1(React__default["default"].version) === 18) {
|
953
|
+
var message = '[cypress/react]: You are using `cypress/react`, which is designed for React <= 17. Consider changing to `cypress/react18`, which is designed for React 18.';
|
954
|
+
console.error(message);
|
955
|
+
Cypress.log({ name: 'warning', message: message });
|
956
|
+
}
|
406
957
|
var internalOptions = {
|
407
958
|
reactDom: ReactDOM__default["default"],
|
408
959
|
render: function (reactComponent, el, reactDomToUse) {
|
409
|
-
|
960
|
+
lastReactDom = (reactDomToUse || ReactDOM__default["default"]);
|
961
|
+
return lastReactDom.render(reactComponent, el);
|
410
962
|
},
|
411
963
|
unmount: unmount,
|
964
|
+
cleanup: cleanup,
|
412
965
|
};
|
413
966
|
return makeMountFn('mount', jsx, __assign({ ReactDom: ReactDOM__default["default"] }, options), rerenderKey, internalOptions);
|
414
967
|
}
|
415
968
|
function unmount(options) {
|
416
969
|
if (options === void 0) { options = { log: true }; }
|
417
|
-
|
418
|
-
unmount: function (el) {
|
419
|
-
return (exports.lastMountedReactDom || ReactDOM__default["default"]).unmountComponentAtNode(el);
|
420
|
-
},
|
421
|
-
};
|
422
|
-
return makeUnmountFn(options, internalOptions);
|
970
|
+
return makeUnmountFn(options);
|
423
971
|
}
|
424
972
|
|
425
973
|
// mounting hooks inside a test component mostly copied from
|