cypress 10.3.1 → 10.6.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/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/lib/exec/open.js +6 -0
- package/lib/tasks/download.js +4 -3
- package/mount-utils/CHANGELOG.md +7 -1
- package/mount-utils/README.md +7 -0
- package/package.json +16 -5
- package/react/CHANGELOG.md +20 -19
- package/react/README.md +28 -323
- package/react/dist/createMount.d.ts +28 -0
- package/react/dist/cypress-react.cjs.js +627 -98
- package/react/dist/cypress-react.esm-bundler.js +624 -99
- package/react/dist/getDisplayName.d.ts +1 -1
- package/react/dist/index.d.ts +2 -0
- package/react/dist/mount.d.ts +5 -141
- package/react/dist/types.d.ts +44 -0
- package/react/package.json +3 -5
- package/react18/CHANGELOG.md +13 -0
- package/react18/dist/cypress-react.cjs.js +633 -0
- package/react18/dist/cypress-react.esm-bundler.js +605 -0
- package/react18/dist/index.d.ts +5 -0
- package/react18/package.json +59 -0
- package/types/cypress.d.ts +28 -2
- package/types/index.d.ts +1 -1
- package/types/{net-stubbing.ts → net-stubbing.d.ts} +0 -0
- package/vue/CHANGELOG.md +16 -17
- package/vue/README.md +17 -608
- package/vue/dist/@vue/test-utils/baseWrapper.d.ts +3 -1
- package/vue/dist/@vue/test-utils/config.d.ts +4 -2
- package/vue/dist/@vue/test-utils/emit.d.ts +1 -0
- package/vue/dist/@vue/test-utils/index.d.ts +2 -1
- package/vue/dist/@vue/test-utils/interfaces/wrapperLike.d.ts +2 -2
- package/vue/dist/@vue/test-utils/mount.d.ts +2 -0
- package/vue/dist/@vue/test-utils/stubs.d.ts +2 -6
- package/vue/dist/@vue/test-utils/types.d.ts +1 -1
- package/vue/dist/@vue/test-utils/vueWrapper.d.ts +2 -1
- package/vue/dist/cypress-vue.cjs.js +5379 -5090
- package/vue/dist/cypress-vue.esm-bundler.js +5380 -5091
- package/vue/dist/index.d.ts +1 -0
- package/vue/package.json +2 -3
- package/vue2/CHANGELOG.md +7 -0
- package/vue2/README.md +11 -627
- package/vue2/dist/cypress-vue2.browser.js +251 -260
- package/vue2/dist/cypress-vue2.cjs.js +250 -259
- package/vue2/dist/cypress-vue2.esm-bundler.js +248 -257
- package/react/dist/cypress-react.browser.js +0 -512
@@ -12,6 +12,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
12
12
|
var React = require('react');
|
13
13
|
var ReactDOM = require('react-dom');
|
14
14
|
|
15
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
16
|
+
|
15
17
|
function _interopNamespace(e) {
|
16
18
|
if (e && e.__esModule) return e;
|
17
19
|
var n = Object.create(null);
|
@@ -31,7 +33,8 @@ function _interopNamespace(e) {
|
|
31
33
|
}
|
32
34
|
|
33
35
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
34
|
-
var
|
36
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
37
|
+
var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
|
35
38
|
|
36
39
|
/******************************************************************************
|
37
40
|
Copyright (c) Microsoft Corporation.
|
@@ -255,37 +258,22 @@ var injectStyles = function (options) {
|
|
255
258
|
return injectStylesBeforeElement(options, document, el);
|
256
259
|
};
|
257
260
|
};
|
261
|
+
var mountCleanup;
|
258
262
|
/**
|
259
|
-
*
|
260
|
-
*
|
261
|
-
*
|
262
|
-
*
|
263
|
-
*
|
264
|
-
*
|
265
|
-
*
|
266
|
-
* @example
|
267
|
-
```
|
268
|
-
import Hello from './hello.jsx'
|
269
|
-
import { mount } from '@cypress/react'
|
270
|
-
it('works', () => {
|
271
|
-
mount(<Hello onClick={cy.stub()} />)
|
272
|
-
// use Cypress commands
|
273
|
-
cy.contains('Hello').click()
|
274
|
-
})
|
275
|
-
```
|
276
|
-
**/
|
277
|
-
var mount = function (jsx, options) {
|
278
|
-
if (options === void 0) { options = {}; }
|
279
|
-
return _mount('mount', jsx, options);
|
280
|
-
};
|
281
|
-
var lastMountedReactDom;
|
282
|
-
/**
|
283
|
-
* @see `mount`
|
284
|
-
* @param type The type of mount executed
|
285
|
-
* @param rerenderKey If specified, use the provided key rather than generating a new one
|
263
|
+
* Create an `mount` function. Performs all the non-React-version specific
|
264
|
+
* behavior related to mounting. The React-version-specific code
|
265
|
+
* is injected. This helps us to maintain a consistent public API
|
266
|
+
* and handle breaking changes in React's rendering API.
|
267
|
+
*
|
268
|
+
* This is designed to be consumed by `npm/react{16,17,18}`, and other React adapters,
|
269
|
+
* or people writing adapters for third-party, custom adapters.
|
286
270
|
*/
|
287
|
-
var
|
271
|
+
var makeMountFn = function (type, jsx, options, rerenderKey, internalMountOptions) {
|
288
272
|
if (options === void 0) { options = {}; }
|
273
|
+
if (!internalMountOptions) {
|
274
|
+
throw Error('internalMountOptions must be provided with `render` and `reactDom` parameters');
|
275
|
+
}
|
276
|
+
mountCleanup = internalMountOptions.cleanup;
|
289
277
|
// Get the display name property via the component constructor
|
290
278
|
// @ts-ignore FIXME
|
291
279
|
var componentName = getDisplayName(jsx.type, options.alias);
|
@@ -298,8 +286,7 @@ var _mount = function (type, jsx, options, rerenderKey) {
|
|
298
286
|
.then(injectStyles(options))
|
299
287
|
.then(function () {
|
300
288
|
var _a, _b, _c;
|
301
|
-
var reactDomToUse =
|
302
|
-
lastMountedReactDom = reactDomToUse;
|
289
|
+
var reactDomToUse = internalMountOptions.reactDom;
|
303
290
|
var el = getContainerEl();
|
304
291
|
if (!el) {
|
305
292
|
throw new Error([
|
@@ -316,7 +303,7 @@ var _mount = function (type, jsx, options, rerenderKey) {
|
|
316
303
|
// since we always surround the component with a fragment
|
317
304
|
// let's get back the original component
|
318
305
|
var userComponent = reactComponent.props.children;
|
319
|
-
|
306
|
+
internalMountOptions.render(reactComponent, el, reactDomToUse);
|
320
307
|
if (options.log !== false) {
|
321
308
|
Cypress.log({
|
322
309
|
name: type,
|
@@ -341,8 +328,8 @@ var _mount = function (type, jsx, options, rerenderKey) {
|
|
341
328
|
.then(function () {
|
342
329
|
return cy.wrap({
|
343
330
|
component: userComponent,
|
344
|
-
rerender: function (newComponent) { return
|
345
|
-
unmount:
|
331
|
+
rerender: function (newComponent) { return makeMountFn('rerender', newComponent, options, key, internalMountOptions); },
|
332
|
+
unmount: internalMountOptions.unmount,
|
346
333
|
}, { log: false });
|
347
334
|
})
|
348
335
|
// by waiting, we delaying test execution for the next tick of event loop
|
@@ -353,81 +340,45 @@ var _mount = function (type, jsx, options, rerenderKey) {
|
|
353
340
|
});
|
354
341
|
};
|
355
342
|
/**
|
356
|
-
*
|
357
|
-
*
|
358
|
-
*
|
359
|
-
*
|
360
|
-
*
|
361
|
-
```
|
362
|
-
import { mount, unmount } from '@cypress/react'
|
363
|
-
it('works', () => {
|
364
|
-
mount(...)
|
365
|
-
// interact with the component using Cypress commands
|
366
|
-
// whenever you want to unmount
|
367
|
-
unmount()
|
368
|
-
})
|
369
|
-
```
|
343
|
+
* Create an `unmount` function. Performs all the non-React-version specific
|
344
|
+
* behavior related to unmounting.
|
345
|
+
*
|
346
|
+
* This is designed to be consumed by `npm/react{16,17,18}`, and other React adapters,
|
347
|
+
* or people writing adapters for third-party, custom adapters.
|
370
348
|
*/
|
371
|
-
|
372
|
-
var unmount = function (options) {
|
373
|
-
if (options === void 0) { options = { log: true }; }
|
374
|
-
return _unmount(options);
|
375
|
-
};
|
376
|
-
var _unmount = function (options) {
|
349
|
+
var makeUnmountFn = function (options) {
|
377
350
|
return cy.then(function () {
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
});
|
395
|
-
}
|
396
|
-
}
|
397
|
-
});
|
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
|
+
}
|
398
367
|
});
|
399
368
|
};
|
400
369
|
// Cleanup before each run
|
401
370
|
// NOTE: we cannot use unmount here because
|
402
371
|
// we are not in the context of a test
|
403
372
|
var preMountCleanup = function () {
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
}
|
373
|
+
mountCleanup === null || mountCleanup === void 0 ? void 0 : mountCleanup();
|
374
|
+
};
|
375
|
+
var _mount = function (jsx, options) {
|
376
|
+
if (options === void 0) { options = {}; }
|
377
|
+
return makeMountFn('mount', jsx, options);
|
408
378
|
};
|
409
|
-
/**
|
410
|
-
* Creates new instance of `mount` function with default options
|
411
|
-
* @function createMount
|
412
|
-
* @param {MountOptions} [defaultOptions] - defaultOptions for returned `mount` function
|
413
|
-
* @returns new instance of `mount` with assigned options
|
414
|
-
* @example
|
415
|
-
* ```
|
416
|
-
* import Hello from './hello.jsx'
|
417
|
-
* import { createMount } from '@cypress/react'
|
418
|
-
*
|
419
|
-
* const mount = createMount({ strict: true, cssFile: 'path/to/any/css/file.css' })
|
420
|
-
*
|
421
|
-
* it('works', () => {
|
422
|
-
* mount(<Hello />)
|
423
|
-
* // use Cypress commands
|
424
|
-
* cy.get('button').should('have.css', 'color', 'rgb(124, 12, 109)')
|
425
|
-
* })
|
426
|
-
```
|
427
|
-
**/
|
428
379
|
var createMount = function (defaultOptions) {
|
429
380
|
return function (element, options) {
|
430
|
-
return
|
381
|
+
return _mount(element, __assign(__assign({}, defaultOptions), options));
|
431
382
|
};
|
432
383
|
};
|
433
384
|
// Side effects from "import { mount } from '@cypress/<my-framework>'" are annoying, we should avoid doing this
|
@@ -443,6 +394,582 @@ var createMount = function (defaultOptions) {
|
|
443
394
|
// @see npm/react/cypress/component/advanced/set-timeout-example/loading-indicator-spec.js
|
444
395
|
setupHooks(preMountCleanup);
|
445
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
|
+
};
|
950
|
+
function mount(jsx, options, rerenderKey) {
|
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
|
+
}
|
957
|
+
var internalOptions = {
|
958
|
+
reactDom: ReactDOM__default["default"],
|
959
|
+
render: function (reactComponent, el, reactDomToUse) {
|
960
|
+
lastReactDom = (reactDomToUse || ReactDOM__default["default"]);
|
961
|
+
return lastReactDom.render(reactComponent, el);
|
962
|
+
},
|
963
|
+
unmount: unmount,
|
964
|
+
cleanup: cleanup,
|
965
|
+
};
|
966
|
+
return makeMountFn('mount', jsx, __assign({ ReactDom: ReactDOM__default["default"] }, options), rerenderKey, internalOptions);
|
967
|
+
}
|
968
|
+
function unmount(options) {
|
969
|
+
if (options === void 0) { options = { log: true }; }
|
970
|
+
return makeUnmountFn(options);
|
971
|
+
}
|
972
|
+
|
446
973
|
// mounting hooks inside a test component mostly copied from
|
447
974
|
// https://github.com/testing-library/react-hooks-testing-library/blob/master/src/pure.js
|
448
975
|
function resultContainer() {
|
@@ -505,6 +1032,8 @@ var mountHook = function (hookFn) {
|
|
505
1032
|
};
|
506
1033
|
|
507
1034
|
exports.createMount = createMount;
|
1035
|
+
exports.makeMountFn = makeMountFn;
|
1036
|
+
exports.makeUnmountFn = makeUnmountFn;
|
508
1037
|
exports.mount = mount;
|
509
1038
|
exports.mountHook = mountHook;
|
510
1039
|
exports.unmount = unmount;
|