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

Jest CI issues #3106

Closed
nihalgonsalves opened this issue Apr 23, 2021 · 3 comments
Closed

Jest CI issues #3106

nihalgonsalves opened this issue Apr 23, 2021 · 3 comments
Labels

Comments

@nihalgonsalves
Copy link
Member

Creating this to keep track of the problems.

Prior related PRs: #3056, #3096, #3097, #3098

I still get an error sometimes, while running yarn test (i.e. in concurrent mode). This doesn't fail with yarn test-serve --runInBand or yarn test-build --runInBand

The root cause still seems to be that the teardown is initiated before ssr-vue.spec.ts runs.

I wonder if a better strategy would be to use one page per test suite, as described here: https://playwright.dev/docs/test-runners#jest--jasmine

However, when changing the setup to match that, many tests fail (on assertions), possibly because they rely on the page being changed by previous tests in the same test suite (spec file).

 FAIL  packages/playground/ssr-vue/__tests__/ssr-vue.spec.ts (26.31 s)
  ● client navigation

    page.click: Execution context was destroyed, most likely because of a navigation.
    =========================== logs ===========================
    waiting for selector "a[href="/about"]"
      selector resolved to visible <a class="" href="/about">About</a>
    attempting click action
      waiting for element to be visible, enabled and stable
    ============================================================
    Note: use DEBUG=pw:api environment variable to capture Playwright logs.page.click: Execution context was destroyed, most likely because of a navigation.
    =========================== logs ===========================
    waiting for selector "a[href="/about"]"
      selector resolved to visible <a class="" href="/about">About</a>
    attempting click action
      waiting for element to be visible, enabled and stable
    ============================================================
    Note: use DEBUG=pw:api environment variable to capture Playwright logs.

      111 | test('client navigation', async () => {
      112 |   await untilUpdated(() => page.textContent('a[href="/about"]'), 'About')
    > 113 |   await page.click('a[href="/about"]')
          |              ^
      114 |   await untilUpdated(() => page.textContent('h1'), 'About')
      115 |   editFile('src/pages/About.vue', (code) => code.replace('About', 'changed'))
      116 |   await untilUpdated(() => page.textContent('h1'), 'changed')
@brillout
Copy link
Contributor

I wonder if a better strategy would be to use one page per test suite

Why would that be better? Do you know if there are performance implications?

@nihalgonsalves
Copy link
Member Author

Just something to try out, because it's incredibly hard to isolate why the teardown seems to happen before the test finishes running. I don't think opening a new window per spec file has much of a performance penalty, but we'd have to check.

You could help with the debugging by running:

DEBUG=pw:api PW_DEBUG=1 VITE_DEBUG_SERVE=1 yarn test-serve

You can also enable slowMo: 1000 here:

https://github.com/vitejs/vite/blob/ffa03ad/scripts/jestGlobalSetup.js#L9-L14

@sodatea
Copy link
Member

sodatea commented May 16, 2022

Closing as we've migrated to Vitest #8076

@sodatea sodatea closed this as completed May 16, 2022
@github-actions github-actions bot locked and limited conversation to collaborators May 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants