fix(nx-plugin): e2e utils should work (#15397)

This commit is contained in:
Craigory Coppola 2023-03-02 16:20:45 -05:00 committed by GitHub
parent 76fcf7a319
commit a4a9c27637
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 10 deletions

View File

@ -73,14 +73,12 @@ describe('Nx Plugin', () => {
// doesn't use the collection we are building
// we should change it to point to the right collection using relative path
// TODO: Re-enable this to work with pnpm
xit(`should run the plugin's e2e tests`, async () => {
if (isNotWindows()) {
const plugin = uniq('plugin-name');
runCLI(`generate @nrwl/nx-plugin:plugin ${plugin} --linter=eslint`);
const e2eResults = runCLI(`e2e ${plugin}-e2e`);
expect(e2eResults).toContain('Successfully ran target e2e');
expect(await killPorts()).toBeTruthy();
}
it(`should run the plugin's e2e tests`, async () => {
const plugin = uniq('plugin-name');
runCLI(`generate @nrwl/nx-plugin:plugin ${plugin} --linter=eslint`);
const e2eResults = runCLI(`e2e ${plugin}-e2e`);
expect(e2eResults).toContain('Successfully ran target e2e');
expect(await killPorts()).toBeTruthy();
}, 250000);
it('should be able to generate a migration', async () => {

View File

@ -43,7 +43,7 @@ export function runNxCommandAsync(
silenceError: false,
}
): Promise<{ stdout: string; stderr: string }> {
if (fileExists('package.json')) {
if (fileExists(tmpProjPath('package.json'))) {
const pmc = getPackageManagerCommand();
return runCommandAsync(`${pmc.exec} nx ${command}`, opts);
} else if (process.platform === 'win32') {

View File

@ -21,7 +21,7 @@ export function runNxCommand(
cwd: tmpProjPath(),
env: { ...process.env, ...opts.env },
};
if (fileExists('package.json')) {
if (fileExists(tmpProjPath('package.json'))) {
const pmc = getPackageManagerCommand();
return execSync(`${pmc.exec} nx ${command}`, execSyncOptions);
} else if (process.platform === 'win32') {