chore(linter): optimize e2e tests (#20718)
This commit is contained in:
parent
43141334a8
commit
5d9f78a848
@ -26,7 +26,9 @@ describe('Linter', () => {
|
||||
let projScope;
|
||||
|
||||
beforeAll(() => {
|
||||
projScope = newProject();
|
||||
projScope = newProject({
|
||||
packages: ['@nx/react', '@nx/js', '@nx/eslint'],
|
||||
});
|
||||
runCLI(`generate @nx/react:app ${myapp} --tags=validtag`);
|
||||
runCLI(`generate @nx/js:lib ${mylib}`);
|
||||
});
|
||||
@ -619,7 +621,11 @@ describe('Linter', () => {
|
||||
});
|
||||
|
||||
describe('Root projects migration', () => {
|
||||
beforeEach(() => newProject());
|
||||
beforeEach(() =>
|
||||
newProject({
|
||||
packages: ['@nx/react', '@nx/js', '@nx/angular', '@nx/node'],
|
||||
})
|
||||
);
|
||||
afterEach(() => cleanupProject());
|
||||
|
||||
function verifySuccessfulStandaloneSetup(myapp: string) {
|
||||
@ -773,6 +779,7 @@ describe('Linter', () => {
|
||||
newProject({
|
||||
name: uniq('eslint'),
|
||||
unsetProjectNameAndRootFormat: false,
|
||||
packages: ['@nx/react'],
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@ -29,7 +29,7 @@ import {
|
||||
RunCmdOpts,
|
||||
runCommand,
|
||||
} from './command-utils';
|
||||
import { output } from '@nx/devkit';
|
||||
import { output, readJsonFile } from '@nx/devkit';
|
||||
import { readFileSync } from 'fs';
|
||||
import { join } from 'path';
|
||||
import { resetWorkspaceContext } from 'nx/src/utils/workspace-context';
|
||||
@ -143,8 +143,16 @@ export function newProject({
|
||||
const projectDirectory = tmpProjPath();
|
||||
copySync(`${tmpBackupProjPath()}`, `${projectDirectory}`);
|
||||
|
||||
// TODO: What is this for?
|
||||
if (packageManager === 'pnpm') {
|
||||
const dependencies = readJsonFile(
|
||||
`${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, {
|
||||
cwd: projectDirectory,
|
||||
stdio: 'pipe',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user