chore(linter): optimize e2e tests (#20718)
This commit is contained in:
parent
43141334a8
commit
5d9f78a848
@ -26,7 +26,9 @@ describe('Linter', () => {
|
|||||||
let projScope;
|
let projScope;
|
||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
projScope = newProject();
|
projScope = newProject({
|
||||||
|
packages: ['@nx/react', '@nx/js', '@nx/eslint'],
|
||||||
|
});
|
||||||
runCLI(`generate @nx/react:app ${myapp} --tags=validtag`);
|
runCLI(`generate @nx/react:app ${myapp} --tags=validtag`);
|
||||||
runCLI(`generate @nx/js:lib ${mylib}`);
|
runCLI(`generate @nx/js:lib ${mylib}`);
|
||||||
});
|
});
|
||||||
@ -619,7 +621,11 @@ describe('Linter', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('Root projects migration', () => {
|
describe('Root projects migration', () => {
|
||||||
beforeEach(() => newProject());
|
beforeEach(() =>
|
||||||
|
newProject({
|
||||||
|
packages: ['@nx/react', '@nx/js', '@nx/angular', '@nx/node'],
|
||||||
|
})
|
||||||
|
);
|
||||||
afterEach(() => cleanupProject());
|
afterEach(() => cleanupProject());
|
||||||
|
|
||||||
function verifySuccessfulStandaloneSetup(myapp: string) {
|
function verifySuccessfulStandaloneSetup(myapp: string) {
|
||||||
@ -773,6 +779,7 @@ describe('Linter', () => {
|
|||||||
newProject({
|
newProject({
|
||||||
name: uniq('eslint'),
|
name: uniq('eslint'),
|
||||||
unsetProjectNameAndRootFormat: false,
|
unsetProjectNameAndRootFormat: false,
|
||||||
|
packages: ['@nx/react'],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -29,7 +29,7 @@ import {
|
|||||||
RunCmdOpts,
|
RunCmdOpts,
|
||||||
runCommand,
|
runCommand,
|
||||||
} from './command-utils';
|
} from './command-utils';
|
||||||
import { output } from '@nx/devkit';
|
import { output, readJsonFile } from '@nx/devkit';
|
||||||
import { readFileSync } from 'fs';
|
import { readFileSync } from 'fs';
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
import { resetWorkspaceContext } from 'nx/src/utils/workspace-context';
|
import { resetWorkspaceContext } from 'nx/src/utils/workspace-context';
|
||||||
@ -143,8 +143,16 @@ export function newProject({
|
|||||||
const projectDirectory = tmpProjPath();
|
const projectDirectory = tmpProjPath();
|
||||||
copySync(`${tmpBackupProjPath()}`, `${projectDirectory}`);
|
copySync(`${tmpBackupProjPath()}`, `${projectDirectory}`);
|
||||||
|
|
||||||
// TODO: What is this for?
|
const dependencies = readJsonFile(
|
||||||
if (packageManager === 'pnpm') {
|
`${projectDirectory}/package.json`
|
||||||
|
).devDependencies;
|
||||||
|
const missingPackages = (packages || []).filter((p) => !dependencies[p]);
|
||||||
|
|
||||||
|
if (missingPackages.length > 0) {
|
||||||
|
packageInstall(missingPackages.join(` `), projName);
|
||||||
|
} else if (packageManager === 'pnpm') {
|
||||||
|
// pnpm creates sym links to the pnpm store,
|
||||||
|
// we need to run the install again after copying the temp folder
|
||||||
execSync(getPackageManagerCommand().install, {
|
execSync(getPackageManagerCommand().install, {
|
||||||
cwd: projectDirectory,
|
cwd: projectDirectory,
|
||||||
stdio: 'pipe',
|
stdio: 'pipe',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user