fix(core): add cleanup on e2e tests (#12093)

This commit is contained in:
Miroslav Jonaš 2022-09-19 21:13:17 +02:00 committed by GitHub
parent 27d654a08d
commit 635b2a61a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 14 additions and 5 deletions

View File

@ -1,4 +1,5 @@
import {
cleanupProject,
createNonNxProjectDirectory,
getPackageManagerCommand,
getSelectedPackageManager,
@ -13,6 +14,8 @@ describe('nx init', () => {
packageManager: getSelectedPackageManager(),
}).runUninstalledPackage;
afterEach(() => cleanupProject());
it('should work', () => {
createNonNxProjectDirectory();
updateFile(

View File

@ -8,9 +8,8 @@ import {
} from '@nrwl/e2e/utils';
describe('project graph creation', () => {
let proj;
beforeEach(() => newProject());
afterEach(() => cleanupProject());
it('should correctly build the nxdeps.json containing files for the project', () => {

View File

@ -19,6 +19,8 @@ describe('Nx Commands', () => {
let proj: string;
beforeAll(() => (proj = newProject()));
afterAll(() => cleanupProject());
describe('report and list', () => {
it(`should report package versions`, async () => {
const reportOutput = runCLI('report');
@ -79,6 +81,7 @@ describe('Nx Commands', () => {
);
}, 120000);
});
describe('format', () => {
const myapp = uniq('myapp');
const mylib = uniq('mylib');
@ -88,8 +91,6 @@ describe('Nx Commands', () => {
runCLI(`generate @nrwl/js:lib ${mylib}`);
});
afterAll(() => cleanupProject());
beforeEach(() => {
updateFile(
`apps/${myapp}/src/main.ts`,

View File

@ -14,7 +14,7 @@ import {
describe('cache', () => {
beforeEach(() => newProject());
afterAll(() => cleanupProject());
afterEach(() => cleanupProject());
it('should cache command execution', async () => {
const myapp1 = uniq('myapp1');

View File

@ -5,11 +5,14 @@ import {
runCLI,
uniq,
runCreatePlugin,
cleanupProject,
} from '@nrwl/e2e/utils';
describe('create-nx-plugin', () => {
const packageManager = getSelectedPackageManager() || 'pnpm';
afterEach(() => cleanupProject());
it('should be able to create a plugin repo and run plugin e2e', () => {
const wsName = uniq('ws-plugin');
const pluginName = uniq('plugin');

View File

@ -1,6 +1,7 @@
import {
checkFilesDoNotExist,
checkFilesExist,
cleanupProject,
e2eCwd,
expectNoAngularDevkit,
expectNoTsJestInJestConfig,
@ -20,6 +21,8 @@ import { execSync } from 'child_process';
describe('create-nx-workspace', () => {
const packageManager = getSelectedPackageManager() || 'pnpm';
afterEach(() => cleanupProject());
it('should be able to create an empty workspace built for apps', () => {
const wsName = uniq('apps');
runCreateWorkspace(wsName, {