Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(react): extensions - vite e2e test #21530

Merged
merged 1 commit into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 3 additions & 13 deletions e2e/react-extensions/src/react-vite.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,15 @@ import {
checkFilesExist,
cleanupProject,
newProject,
readJson,
runCLI,
runCLIAsync,
uniq,
} from '@nx/e2e/utils';

describe('Build React applications and libraries with Vite', () => {
let proj: string;

beforeAll(() => {
proj = newProject({
packages: ['@nx/react', '@nx/vite'],
newProject({
packages: ['@nx/react'],
});
});

Expand Down Expand Up @@ -124,23 +121,16 @@ describe('Build React applications and libraries with Vite', () => {
);
}, 300_000);

// TODO(crystal, @mandarini): investigate why this test fails
xit('should support bundling with Vite', async () => {
it('should support bundling with Vite', async () => {
const viteLib = uniq('vitelib');

runCLI(
`generate @nx/react:lib ${viteLib} --bundler=vite --no-interactive --unit-test-runner=none`
);

const packageJson = readJson('package.json');

// Vite does not need this library to work.
expect(packageJson.dependencies['core-js']).toBeUndefined();

await runCLIAsync(`build ${viteLib}`);

checkFilesExist(
`dist/libs/${viteLib}/package.json`,
`dist/libs/${viteLib}/index.d.ts`,
`dist/libs/${viteLib}/index.js`,
`dist/libs/${viteLib}/index.mjs`
Expand Down
4 changes: 4 additions & 0 deletions packages/vite/src/utils/generator-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,10 @@ async function handleUnsupportedUserProvidedTargetsErrors(
}

export async function handleUnknownExecutors(projectName: string) {
if (process.env.NX_INTERACTIVE === 'false') {
return;
}

logger.warn(
`
We could not find any targets in project ${projectName} that use executors which
Expand Down