diff --git a/e2e/workspace-create-npm/jest.config.ts b/e2e/workspace-create-npm/jest.config.ts index 893e2c7c9ff5f1..577af9c54737b5 100644 --- a/e2e/workspace-create-npm/jest.config.ts +++ b/e2e/workspace-create-npm/jest.config.ts @@ -1,11 +1,11 @@ /* eslint-disable */ export default { transform: { - '^.+\\.[tj]sx?$': 'ts-jest', + '^.+\\.[tj]sx?$': ['ts-jest', { tsconfig: '/tsconfig.spec.json' }], }, moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'html'], maxWorkers: 1, - globals: { 'ts-jest': { tsconfig: '/tsconfig.spec.json' } }, + globals: {}, displayName: 'e2e-workspace-create-npm', preset: '../../jest.preset.js', }; diff --git a/e2e/workspace-create-npm/src/create-nx-workspace-npm.test.ts b/e2e/workspace-create-npm/src/create-nx-workspace-npm.test.ts index 1fdcf0f87538d1..2bda0d9fecd001 100644 --- a/e2e/workspace-create-npm/src/create-nx-workspace-npm.test.ts +++ b/e2e/workspace-create-npm/src/create-nx-workspace-npm.test.ts @@ -1,6 +1,8 @@ import { checkFilesExist, cleanupProject, + e2eCwd, + getPackageManagerCommand, getSelectedPackageManager, packageInstall, readJson, @@ -9,23 +11,33 @@ import { runCreateWorkspace, uniq, } from '@nrwl/e2e/utils'; +import { execSync } from 'child_process'; describe('create-nx-workspace --preset=npm', () => { const wsName = uniq('npm'); - const packageManager = getSelectedPackageManager() || 'pnpm'; + let originalVerbose; beforeAll(() => { + originalVerbose = process.env.NX_VERBOSE_LOGGING; + process.env.NX_VERBOSE_LOGGING = 'true'; runCreateWorkspace(wsName, { preset: 'npm', - packageManager, + packageManager: getSelectedPackageManager(), }); }); - beforeEach(() => { - runCommand(`git reset --hard`); + afterEach(() => { + runCommand(`git reset --hard HEAD`); + execSync(`${getPackageManagerCommand().runNx} reset`, { + cwd: `${e2eCwd}/${wsName}`, + stdio: 'pipe', + }); }); - afterAll(() => cleanupProject()); + afterAll(() => { + process.env.NX_VERBOSE_LOGGING = originalVerbose; + cleanupProject({ skipReset: true }); + }); it('should add angular application', () => { packageInstall('@nrwl/angular', wsName); @@ -55,23 +67,6 @@ describe('create-nx-workspace --preset=npm', () => { }); }, 1_000_000); - it('should add workspace library', () => { - packageInstall('@nrwl/workspace', wsName); - - const libName = uniq('lib'); - - expect(() => - runCLI( - `generate @nrwl/workspace:library ${libName} --skipPackageJson --no-interactive` - ) - ).not.toThrowError(); - checkFilesExist('tsconfig.base.json'); - const tsconfig = readJson(`tsconfig.base.json`); - expect(tsconfig.compilerOptions.paths).toEqual({ - [libName]: [`packages/${libName}/src/index.ts`], - }); - }); - it('should add js library', () => { packageInstall('@nrwl/js', wsName);