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

[Feature]: Run tests directly without spinning up a test server, in an Angular and Jest. #12450

Closed
zmpo opened this issue May 16, 2024 · 3 comments

Comments

@zmpo
Copy link

zmpo commented May 16, 2024

Feature description

Run E2E tests in angular ,
ng e2e
This command invariably necessitates running ng serve beforehand, which typically consumes around 2 minutes.

It would be highly convenient for developers if tests could be run directly against an already running service.

@zmpo zmpo added the feature label May 16, 2024
@zmpo zmpo closed this as not planned Won't fix, can't repro, duplicate, stale May 16, 2024
@zmpo
Copy link
Author

zmpo commented May 16, 2024

This seems to be an issue pertaining to Angular.

@zmpo zmpo reopened this May 17, 2024
@zmpo
Copy link
Author

zmpo commented May 17, 2024

This issue is related to @puppeteer/ng-schematics:puppeteer

async function executeE2ETest(
  options: PuppeteerBuilderOptions,
  context: BuilderContext
): Promise<BuilderOutput> {
  let server: BuilderRun | null = null;
  try {
    message('\n Building tests 🛠️ ... \n', context);
    await executeCommand(context, [`tsc`, '-p', 'e2e/tsconfig.json']);

    server = await startServer(options, context); // This is not developer friendly
    const result = await server.result;

    message('\n Running tests 🧪 ... \n', context);
    const testRunnerCommand = getCommandForRunner(options.testRunner);
    await executeCommand(context, testRunnerCommand, {
      baseUrl: result['baseUrl'],
    });

    message('\n 🚀 Test ran successfully! 🚀 ', context, 'success');
    return {success: true};
  } catch (error) {
    message('\n 🛑 Test failed! 🛑 ', context, 'error');
    if (error instanceof Error) {
      return {success: false, error: error.message};
    }
    return {success: false, error: error as string};
  } finally {
    if (server) {
      await server.stop();
    }
  }
}

ng e2e must start a server, this is a waste of time.

If ng e2e can test a exist server, that would be great.

@pfeileon
Copy link

Imho this is a duplicate of #12222.

@zmpo zmpo closed this as completed May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants