feat(testing): update cypress version (#21961)
This commit is contained in:
parent
776367e882
commit
dd2c7d2601
@ -47,6 +47,12 @@
|
||||
"version": "16.8.0-beta.4",
|
||||
"description": "Update to Cypress v13. Most noteable change is video recording is off by default. This migration will only update if the workspace is already on Cypress v12. https://docs.cypress.io/guides/references/migration-guide#Migrating-to-Cypress-130",
|
||||
"implementation": "./src/migrations/update-16-8-0/cypress-13"
|
||||
},
|
||||
"update-cypress-version-13-6-6": {
|
||||
"cli": "nx",
|
||||
"version": "18.1.0-beta.3",
|
||||
"description": "Update to Cypress ^13.6.6 if the workspace is using Cypress v13 to ensure workspaces don't use v13.6.5 which has an issue when verifying Cypress.",
|
||||
"implementation": "./src/migrations/update-18-1-0/update-cypress-version-13-6-6"
|
||||
}
|
||||
},
|
||||
"packageJsonUpdates": {
|
||||
|
||||
@ -0,0 +1,42 @@
|
||||
import { readJson, updateJson, type Tree } from '@nx/devkit';
|
||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
||||
import * as cypressVersionUtils from '../../utils/cypress-version';
|
||||
import migration from './update-cypress-version-13-6-6';
|
||||
|
||||
describe('update-cypress-version migration', () => {
|
||||
let tree: Tree;
|
||||
|
||||
function setCypressVersion(version: string) {
|
||||
updateJson(tree, 'package.json', (json) => {
|
||||
json.devDependencies ??= {};
|
||||
json.devDependencies.cypress = version;
|
||||
return json;
|
||||
});
|
||||
const major = parseInt(version.split('.')[0].replace('^', ''), 10);
|
||||
jest
|
||||
.spyOn(cypressVersionUtils, 'installedCypressVersion')
|
||||
.mockReturnValue(major);
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
tree = createTreeWithEmptyWorkspace();
|
||||
});
|
||||
|
||||
it('should bump cypress version to ^13.6.6', async () => {
|
||||
setCypressVersion('^13.0.0');
|
||||
|
||||
await migration(tree);
|
||||
|
||||
const { devDependencies } = readJson(tree, 'package.json');
|
||||
expect(devDependencies.cypress).toBe('^13.6.6');
|
||||
});
|
||||
|
||||
it('should not update cypress version if it is not >= 13', async () => {
|
||||
setCypressVersion('^12.0.0');
|
||||
|
||||
await migration(tree);
|
||||
|
||||
const { devDependencies } = readJson(tree, 'package.json');
|
||||
expect(devDependencies.cypress).toBe('^12.0.0');
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,16 @@
|
||||
import {
|
||||
addDependenciesToPackageJson,
|
||||
formatFiles,
|
||||
type Tree,
|
||||
} from '@nx/devkit';
|
||||
import { installedCypressVersion } from '../../utils/cypress-version';
|
||||
|
||||
export default async function (tree: Tree) {
|
||||
if (installedCypressVersion() < 13) {
|
||||
return;
|
||||
}
|
||||
|
||||
addDependenciesToPackageJson(tree, {}, { cypress: '^13.6.6' });
|
||||
|
||||
await formatFiles(tree);
|
||||
}
|
||||
@ -2,7 +2,7 @@ export const nxVersion = require('../../package.json').version;
|
||||
export const eslintPluginCypressVersion = '^2.13.4';
|
||||
export const typesNodeVersion = '18.16.9';
|
||||
export const cypressViteDevServerVersion = '^2.2.1';
|
||||
export const cypressVersion = '13.6.4';
|
||||
export const cypressVersion = '^13.6.6';
|
||||
export const cypressWebpackVersion = '^2.0.0';
|
||||
export const webpackHttpPluginVersion = '^5.5.0';
|
||||
export const viteVersion = '~5.0.0';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user