chore(vite): undo test logs and re-enable tests (#17573)

This commit is contained in:
Katerina Skroumpelou 2023-06-13 18:48:49 +03:00 committed by GitHub
parent 7abcb816b5
commit 0374db54fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 35 deletions

View File

@ -42,31 +42,23 @@ export function newProject({
name = uniq('proj'), name = uniq('proj'),
packageManager = getSelectedPackageManager(), packageManager = getSelectedPackageManager(),
} = {}): string { } = {}): string {
console.log('Testing_B 1');
console.log('Testing_B packageManager', packageManager);
try { try {
const projScope = 'proj'; const projScope = 'proj';
console.log('Testing_B 2');
if (!directoryExists(tmpBackupProjPath())) { if (!directoryExists(tmpBackupProjPath())) {
console.log('Testing_B 3');
runCreateWorkspace(projScope, { runCreateWorkspace(projScope, {
preset: 'empty', preset: 'empty',
packageManager, packageManager,
}); });
console.log('Testing_B 4');
// Temporary hack to prevent installing with `--frozen-lockfile` // Temporary hack to prevent installing with `--frozen-lockfile`
if (isCI && packageManager === 'pnpm') { if (isCI && packageManager === 'pnpm') {
console.log('Testing_B 5');
updateFile( updateFile(
'.npmrc', '.npmrc',
'prefer-frozen-lockfile=false\nstrict-peer-dependencies=false\nauto-install-peers=true' 'prefer-frozen-lockfile=false\nstrict-peer-dependencies=false\nauto-install-peers=true'
); );
} }
console.log('Testing_B 6');
// TODO(jack): we should tag the projects (e.g. tags: ['package']) and filter from that rather than hard-code packages. // TODO(jack): we should tag the projects (e.g. tags: ['package']) and filter from that rather than hard-code packages.
const packages = [ const packages = [
`@nx/angular`, `@nx/angular`,
@ -90,32 +82,22 @@ export function newProject({
`@nx/expo`, `@nx/expo`,
]; ];
packageInstall(packages.join(` `), projScope); packageInstall(packages.join(` `), projScope);
console.log('Testing_B 7');
// stop the daemon // stop the daemon
execSync(`${getPackageManagerCommand().runNx} reset`, { execSync(`${getPackageManagerCommand().runNx} reset`, {
cwd: `${e2eCwd}/proj`, cwd: `${e2eCwd}/proj`,
stdio: isVerbose() ? 'inherit' : 'pipe', stdio: isVerbose() ? 'inherit' : 'pipe',
}); });
console.log('Testing_B 8');
moveSync(`${e2eCwd}/proj`, `${tmpBackupProjPath()}`); moveSync(`${e2eCwd}/proj`, `${tmpBackupProjPath()}`);
console.log('Testing_B 9');
} }
projName = name; projName = name;
console.log('Testing_B 10');
copySync(`${tmpBackupProjPath()}`, `${tmpProjPath()}`); copySync(`${tmpBackupProjPath()}`, `${tmpProjPath()}`);
console.log('Testing_B 11');
if (isVerbose()) { if (isVerbose()) {
console.log('Testing_B 12');
logInfo(`NX`, `E2E created a project: ${tmpProjPath()}`); logInfo(`NX`, `E2E created a project: ${tmpProjPath()}`);
} }
console.log('Testing_B 13');
if (packageManager === 'pnpm') { if (packageManager === 'pnpm') {
console.log('Testing_B 14');
execSync(getPackageManagerCommand().install, { execSync(getPackageManagerCommand().install, {
cwd: tmpProjPath(), cwd: tmpProjPath(),
stdio: 'pipe', stdio: 'pipe',
@ -123,10 +105,8 @@ export function newProject({
encoding: 'utf-8', encoding: 'utf-8',
}); });
} }
console.log('Testing_B 15');
return projScope; return projScope;
} catch (e) { } catch (e) {
console.log('Testing_B 16');
logError(`Failed to set up project for e2e tests.`, e.message); logError(`Failed to set up project for e2e tests.`, e.message);
throw e; throw e;
} }

View File

@ -28,29 +28,17 @@ describe('Vite Plugin', () => {
describe('Vite on React apps', () => { describe('Vite on React apps', () => {
describe('convert React webpack app to vite using the vite:configuration generator', () => { describe('convert React webpack app to vite using the vite:configuration generator', () => {
beforeEach(() => { beforeEach(() => {
console.log('Testing_A 1');
proj = newProject(); proj = newProject();
console.log('Testing_A proj', proj);
console.log('Testing_A 2');
runCLI(`generate @nx/react:app ${myApp} --bundler=webpack`); runCLI(`generate @nx/react:app ${myApp} --bundler=webpack`);
console.log('Testing_A 3');
runCLI(`generate @nx/vite:configuration ${myApp}`); runCLI(`generate @nx/vite:configuration ${myApp}`);
console.log('Testing_A 4');
}); });
afterEach(() => cleanupProject()); afterEach(() => cleanupProject());
it('should serve application in dev mode with custom options', async () => { it('should serve application in dev mode with custom options', async () => {
console.log('Testing_A 5');
const port = 4212; const port = 4212;
console.log('Testing_A 6');
const p = await runCommandUntil( const p = await runCommandUntil(
`run ${myApp}:serve --port=${port} --https=true`, `run ${myApp}:serve --port=${port} --https=true`,
(output) => { (output) => {
console.log('Testing_A 7');
return ( return (
output.includes('Local:') && output.includes('Local:') &&
output.includes(`:${port}`) && output.includes(`:${port}`) &&
@ -59,12 +47,9 @@ describe('Vite Plugin', () => {
} }
); );
try { try {
console.log('Testing_A 8');
await promisifiedTreeKill(p.pid, 'SIGKILL'); await promisifiedTreeKill(p.pid, 'SIGKILL');
await killPorts(port); await killPorts(port);
} catch (e) { } catch (e) {
console.log('Testing_A 9');
console.log('Testing_A e', e);
// ignore // ignore
} }
}, 200_000); }, 200_000);