cleanup(misc): add packages option to e2e newProject function (#20713)
This commit is contained in:
parent
5b4305819b
commit
7c1645e8e1
@ -13,6 +13,7 @@ describe('Nuxt Plugin', () => {
|
|||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
proj = newProject({
|
proj = newProject({
|
||||||
|
packages: ['@nx/nuxt', '@nx/storybook'],
|
||||||
unsetProjectNameAndRootFormat: false,
|
unsetProjectNameAndRootFormat: false,
|
||||||
});
|
});
|
||||||
runCLI(`generate @nx/nuxt:app ${app} --unitTestRunner=vitest`);
|
runCLI(`generate @nx/nuxt:app ${app} --unitTestRunner=vitest`);
|
||||||
|
|||||||
@ -17,7 +17,9 @@ describe('Storybook generators and executors for monorepos', () => {
|
|||||||
const reactStorybookApp = uniq('react-app');
|
const reactStorybookApp = uniq('react-app');
|
||||||
let proj;
|
let proj;
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
proj = newProject();
|
proj = newProject({
|
||||||
|
packages: ['@nx/react', '@nx/storybook'],
|
||||||
|
});
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nx/react:app ${reactStorybookApp} --bundler=webpack --project-name-and-root-format=as-provided --no-interactive`
|
`generate @nx/react:app ${reactStorybookApp} --bundler=webpack --project-name-and-root-format=as-provided --no-interactive`
|
||||||
);
|
);
|
||||||
|
|||||||
@ -11,7 +11,12 @@ import {
|
|||||||
// This test ensures that when CJS is gone from the published `vite` package, Nx will continue to work.
|
// This test ensures that when CJS is gone from the published `vite` package, Nx will continue to work.
|
||||||
|
|
||||||
describe('Vite ESM tests', () => {
|
describe('Vite ESM tests', () => {
|
||||||
beforeAll(() => newProject({ unsetProjectNameAndRootFormat: false }));
|
beforeAll(() =>
|
||||||
|
newProject({
|
||||||
|
unsetProjectNameAndRootFormat: false,
|
||||||
|
packages: ['@nx/react'],
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
it('should build with Vite when it is ESM-only', async () => {
|
it('should build with Vite when it is ESM-only', async () => {
|
||||||
const appName = uniq('viteapp');
|
const appName = uniq('viteapp');
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import { cleanupProject, newProject, runCLI, uniq } from '@nx/e2e/utils';
|
import { cleanupProject, newProject, runCLI, uniq } from '@nx/e2e/utils';
|
||||||
|
|
||||||
const myApp = uniq('my-app');
|
const myApp = uniq('my-app');
|
||||||
|
const myVueApp = uniq('my-vue-app');
|
||||||
|
|
||||||
describe('@nx/vite/plugin', () => {
|
describe('@nx/vite/plugin', () => {
|
||||||
let proj: string;
|
let proj: string;
|
||||||
@ -9,22 +10,21 @@ describe('@nx/vite/plugin', () => {
|
|||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
originalEnv = process.env.NX_PCV3;
|
originalEnv = process.env.NX_PCV3;
|
||||||
process.env.NX_PCV3 = 'true';
|
process.env.NX_PCV3 = 'true';
|
||||||
|
proj = newProject({
|
||||||
|
packages: ['@nx/react', '@nx/vue'],
|
||||||
|
});
|
||||||
|
runCLI(
|
||||||
|
`generate @nx/react:app ${myApp} --bundler=vite --unitTestRunner=vitest`
|
||||||
|
);
|
||||||
|
runCLI(`generate @nx/vue:app ${myVueApp} --unitTestRunner=vitest`);
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(() => {
|
afterAll(() => {
|
||||||
process.env.NODE_ENV = originalEnv;
|
process.env.NODE_ENV = originalEnv;
|
||||||
|
cleanupProject();
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('build and test React Vite app', () => {
|
describe('build and test React app', () => {
|
||||||
beforeAll(() => {
|
|
||||||
proj = newProject();
|
|
||||||
runCLI(
|
|
||||||
`generate @nx/react:app ${myApp} --bundler=vite --unitTestRunner=vitest`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
afterAll(() => cleanupProject());
|
|
||||||
|
|
||||||
it('should build application', () => {
|
it('should build application', () => {
|
||||||
const result = runCLI(`build ${myApp}`);
|
const result = runCLI(`build ${myApp}`);
|
||||||
expect(result).toContain('Successfully ran target build');
|
expect(result).toContain('Successfully ran target build');
|
||||||
@ -35,24 +35,14 @@ describe('@nx/vite/plugin', () => {
|
|||||||
expect(result).toContain('Successfully ran target test');
|
expect(result).toContain('Successfully ran target test');
|
||||||
}, 200_000);
|
}, 200_000);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('build and test Vue app', () => {
|
describe('build and test Vue app', () => {
|
||||||
beforeAll(() => {
|
|
||||||
proj = newProject();
|
|
||||||
runCLI(`generate @nx/vue:app ${myApp} --unitTestRunner=vitest`);
|
|
||||||
});
|
|
||||||
|
|
||||||
afterAll(() => {
|
|
||||||
cleanupProject();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should build application', () => {
|
it('should build application', () => {
|
||||||
const result = runCLI(`build ${myApp}`);
|
const result = runCLI(`build ${myVueApp}`);
|
||||||
expect(result).toContain('Successfully ran target build');
|
expect(result).toContain('Successfully ran target build');
|
||||||
}, 200_000);
|
}, 200_000);
|
||||||
|
|
||||||
it('should test application', () => {
|
it('should test application', () => {
|
||||||
const result = runCLI(`test ${myApp}`);
|
const result = runCLI(`test ${myVueApp}`);
|
||||||
expect(result).toContain('Successfully ran target test');
|
expect(result).toContain('Successfully ran target test');
|
||||||
}, 200_000);
|
}, 200_000);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -31,7 +31,9 @@ describe('Vite Plugin', () => {
|
|||||||
describe('Vite on React apps', () => {
|
describe('Vite on React apps', () => {
|
||||||
describe('set up new React app with --bundler=vite option', () => {
|
describe('set up new React app with --bundler=vite option', () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
proj = newProject();
|
proj = newProject({
|
||||||
|
packages: ['@nx/react'],
|
||||||
|
});
|
||||||
runCLI(`generate @nx/react:app ${myApp} --bundler=vite`);
|
runCLI(`generate @nx/react:app ${myApp} --bundler=vite`);
|
||||||
createFile(`apps/${myApp}/public/hello.md`, `# Hello World`);
|
createFile(`apps/${myApp}/public/hello.md`, `# Hello World`);
|
||||||
});
|
});
|
||||||
@ -49,7 +51,9 @@ describe('Vite Plugin', () => {
|
|||||||
describe('Vite on Web apps', () => {
|
describe('Vite on Web apps', () => {
|
||||||
describe('set up new @nx/web app with --bundler=vite option', () => {
|
describe('set up new @nx/web app with --bundler=vite option', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
proj = newProject();
|
proj = newProject({
|
||||||
|
packages: ['@nx/web'],
|
||||||
|
});
|
||||||
runCLI(`generate @nx/web:app ${myApp} --bundler=vite`);
|
runCLI(`generate @nx/web:app ${myApp} --bundler=vite`);
|
||||||
});
|
});
|
||||||
afterEach(() => cleanupProject());
|
afterEach(() => cleanupProject());
|
||||||
@ -122,7 +126,10 @@ describe('Vite Plugin', () => {
|
|||||||
const app = uniq('demo');
|
const app = uniq('demo');
|
||||||
const lib = uniq('my-lib');
|
const lib = uniq('my-lib');
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
proj = newProject({ name: uniq('vite-incr-build') });
|
proj = newProject({
|
||||||
|
name: uniq('vite-incr-build'),
|
||||||
|
packages: ['@nx/react'],
|
||||||
|
});
|
||||||
runCLI(`generate @nx/react:app ${app} --bundler=vite --no-interactive`);
|
runCLI(`generate @nx/react:app ${app} --bundler=vite --no-interactive`);
|
||||||
|
|
||||||
// only this project will be directly used from dist
|
// only this project will be directly used from dist
|
||||||
@ -206,7 +213,7 @@ export default App;
|
|||||||
describe('should be able to create libs that use vitest', () => {
|
describe('should be able to create libs that use vitest', () => {
|
||||||
const lib = uniq('my-lib');
|
const lib = uniq('my-lib');
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
proj = newProject({ name: uniq('vite-proj') });
|
proj = newProject({ name: uniq('vite-proj'), packages: ['@nx/react'] });
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should be able to run tests', async () => {
|
it('should be able to run tests', async () => {
|
||||||
@ -359,7 +366,10 @@ export default defineConfig({
|
|||||||
|
|
||||||
describe('ESM-only apps', () => {
|
describe('ESM-only apps', () => {
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
newProject({ unsetProjectNameAndRootFormat: false });
|
newProject({
|
||||||
|
unsetProjectNameAndRootFormat: false,
|
||||||
|
packages: ['@nx/react'],
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should support ESM-only plugins in vite.config.ts for root apps (#NXP-168)', () => {
|
it('should support ESM-only plugins in vite.config.ts for root apps (#NXP-168)', () => {
|
||||||
|
|||||||
@ -12,7 +12,9 @@ describe('Storybook generators and executors for Vue projects', () => {
|
|||||||
const vueStorybookApp = uniq('vue-app');
|
const vueStorybookApp = uniq('vue-app');
|
||||||
let proj;
|
let proj;
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
proj = newProject();
|
proj = newProject({
|
||||||
|
packages: ['@nx/vue', '@nx/storybook'],
|
||||||
|
});
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nx/vue:app ${vueStorybookApp} --project-name-and-root-format=as-provided --no-interactive`
|
`generate @nx/vue:app ${vueStorybookApp} --project-name-and-root-format=as-provided --no-interactive`
|
||||||
);
|
);
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import {
|
|||||||
|
|
||||||
describe('vue tailwind support', () => {
|
describe('vue tailwind support', () => {
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
newProject({ unsetProjectNameAndRootFormat: false });
|
newProject({ unsetProjectNameAndRootFormat: false, packages: ['@nx/vue'] });
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(() => {
|
afterAll(() => {
|
||||||
|
|||||||
@ -12,6 +12,7 @@ describe('Vue Plugin', () => {
|
|||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
proj = newProject({
|
proj = newProject({
|
||||||
|
packages: ['@nx/vue'],
|
||||||
unsetProjectNameAndRootFormat: false,
|
unsetProjectNameAndRootFormat: false,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user