Skip to content

Commit

Permalink
chore(misc): re-enable convert-to-monorepo test to test without Nx pl…
Browse files Browse the repository at this point in the history
…ugins for now (#21544)
  • Loading branch information
jaysoo committed Feb 2, 2024
1 parent 5a818e3 commit ce82723
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 30 deletions.
49 changes: 49 additions & 0 deletions e2e/nx-misc/src/workspace-legacy.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import {
checkFilesExist,
cleanupProject,
newProject,
runCLI,
runE2ETests,
uniq,
} from '@nx/e2e/utils';

let proj: string;

describe('@nx/workspace:convert-to-monorepo', () => {
beforeEach(() => {
proj = newProject({ packages: ['@nx/react', '@nx/js'] });
});

afterEach(() => cleanupProject());

it('should convert a standalone webpack and jest react project to a monorepo (legacy)', async () => {
const reactApp = uniq('reactapp');
runCLI(
`generate @nx/react:app ${reactApp} --rootProject=true --bundler=webpack --unitTestRunner=jest --e2eTestRunner=cypress --no-interactive`,
{
env: {
NX_ADD_PLUGINS: 'false',
},
}
);

runCLI('generate @nx/workspace:convert-to-monorepo --no-interactive', {
env: {
NX_ADD_PLUGINS: 'false',
},
});

checkFilesExist(
`apps/${reactApp}/src/main.tsx`,
`apps/e2e/cypress.config.ts`
);

expect(() => runCLI(`build ${reactApp}`)).not.toThrow();
expect(() => runCLI(`test ${reactApp}`)).not.toThrow();
expect(() => runCLI(`lint ${reactApp}`)).not.toThrow();
expect(() => runCLI(`lint e2e`)).not.toThrow();
if (runE2ETests()) {
expect(() => runCLI(`e2e e2e`)).not.toThrow();
}
});
});
37 changes: 7 additions & 30 deletions e2e/nx-misc/src/workspace.test.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import {
checkFilesExist,
newProject,
readJson,
cleanupProject,
runCLI,
uniq,
updateFile,
readFile,
exists,
tmpProjPath,
getPackageManagerCommand,
getSelectedPackageManager,
newProject,
readFile,
readJson,
runCLI,
runCommand,
runE2ETests,
tmpProjPath,
uniq,
updateFile,
} from '@nx/e2e/utils';
import { join } from 'path';

Expand All @@ -25,29 +25,6 @@ describe('@nx/workspace:convert-to-monorepo', () => {

afterEach(() => cleanupProject());

// TODO(crystal, @jaysoo): Investigate why this test is failing
xit('should convert a standalone webpack and jest react project to a monorepo', async () => {
const reactApp = uniq('reactapp');
runCLI(
`generate @nx/react:app ${reactApp} --rootProject=true --bundler=webpack --unitTestRunner=jest --e2eTestRunner=cypress --no-interactive`
);

runCLI('generate @nx/workspace:convert-to-monorepo --no-interactive');

checkFilesExist(
`apps/${reactApp}/src/main.tsx`,
`apps/e2e/cypress.config.ts`
);

expect(() => runCLI(`build ${reactApp}`)).not.toThrow();
expect(() => runCLI(`test ${reactApp}`)).not.toThrow();
expect(() => runCLI(`lint ${reactApp}`)).not.toThrow();
expect(() => runCLI(`lint e2e`)).not.toThrow();
if (runE2ETests()) {
expect(() => runCLI(`e2e e2e`)).not.toThrow();
}
});

it('should be convert a standalone vite and playwright react project to a monorepo', async () => {
const reactApp = uniq('reactapp');
runCLI(
Expand Down

0 comments on commit ce82723

Please sign in to comment.