Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[BUG] Error when running different projects after each other #20581

Closed
markbrockhoff opened this issue Feb 2, 2023 · 3 comments · Fixed by #20799
Closed

[BUG] Error when running different projects after each other #20581

markbrockhoff opened this issue Feb 2, 2023 · 3 comments · Fixed by #20799
Assignees
Labels

Comments

@markbrockhoff
Copy link

Context:

  • Playwright Version: 1.30.0
  • Operating System: Mac
  • Node.js version: 18.13.0

Code Snippet

projects: [
    {
      name: 'component',
      testDir: './tests/component/',
      use: {
        ...devices['Desktop Chrome'],
      },
    },
    {
      name: 'integration',
      testDir: './tests/integration/',
      use: {
        ...devices['Desktop Chrome'],
      },
    },
  ],

Describe the bug

Hi, I have a playwright component testing setup with two projects. One for component testing and one for integration tests.
When I run one of the projects like so playwright test -c playwright-ct.config.ts --project=component and the other project afterwards: playwright test -c playwright-ct.config.ts --project=integration I get the following error:

TypeError: Cannot read properties of undefined (reading 'fullName')

Everything is good again after I delete the cache under playwright/.cache and run one of the commands again. It looks like the cache should be invalidated due to the changed project which has a different testDir.

@dgozman
Copy link
Contributor

dgozman commented Feb 2, 2023

@markbrockhoff This sounds interesting, but we need more information to act on this issue. Could you please provide a repro that we can run locally?

@markbrockhoff
Copy link
Author

Hi @dgozman sure. I just reused a repo from my last bug report: https://github.com/markbrockhoff/playwright-vite-4-bug

You can simply checkout main and run the prepared npm script "reproduce-issue" to well reproduce the issue :)

@dgozman
Copy link
Contributor

dgozman commented Feb 3, 2023

Thank you, I can repro.


Debugging notes below

Here is the full stack trace:

TypeError: Cannot read properties of undefined (reading 'fullName')

    at checkNewTests (/Users/dgozman/code/pwuse/playwright-vite-4-bug/node_modules/@playwright/test/lib/plugins/vitePlugin.js:183:41)
    at Object.setup (/Users/dgozman/code/pwuse/playwright-vite-4-bug/node_modules/@playwright/test/lib/plugins/vitePlugin.js:74:27)
    at /Users/dgozman/code/pwuse/playwright-vite-4-bug/node_modules/@playwright/test/lib/runner.js:475:9
    at Runner._runAndReportError (/Users/dgozman/code/pwuse/playwright-vite-4-bug/node_modules/@playwright/test/lib/runner.js:501:7)
    at Runner._performGlobalSetup (/Users/dgozman/code/pwuse/playwright-vite-4-bug/node_modules/@playwright/test/lib/runner.js:470:5)
    at Runner._run (/Users/dgozman/code/pwuse/playwright-vite-4-bug/node_modules/@playwright/test/lib/runner.js:380:28)
    at TimeoutRunner.run (/Users/dgozman/code/pwuse/playwright-vite-4-bug/node_modules/playwright-core/lib/utils/timeoutRunner.js:46:14)
    at raceAgainstTimeout (/Users/dgozman/code/pwuse/playwright-vite-4-bug/node_modules/playwright-core/lib/utils/timeoutRunner.js:90:15)
    at Runner.runAllTests (/Users/dgozman/code/pwuse/playwright-vite-4-bug/node_modules/@playwright/test/lib/runner.js:143:20)
    at runTests (/Users/dgozman/code/pwuse/playwright-vite-4-bug/node_modules/@playwright/test/lib/cli.js:165:18)
    at ji.<anonymous> (/Users/dgozman/code/pwuse/playwright-vite-4-bug/node_modules/@playwright/test/lib/cli.js:71:7)

Logging around vitePlugin, we have the following components:

[
  {
    fullName: '...playwright_vite_4_bug_src_App_vue',
    importPath: '...playwright-vite-4-bug/src/App.vue',
    isModuleOrAlias: false
  }
]

... and try to find the following one:

...playwright_vite_4_bug_src_components_HelloWorld_vue

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants