good-first-issue-finder icon indicating copy to clipboard operation
good-first-issue-finder copied to clipboard

Playwright tests cannot be run due to an unknown file extension ".ts"

Open ISanjeevKumar opened this issue 3 years ago • 5 comments

Description

I am getting the following error when running the playwright test scripts for playwright.config.ts file.

Error: TypeError: Unknown file extension ".ts" for /good-first-issue-finder/playwright.config.ts. at new NodeError (node:internal/errors:370:5) at Loader.defaultGetFormat [as _getFormat] (node:internal/modules/esm/get_format:71:15) at Loader.getFormat (node:internal/modules/esm/loader:105:42) at Loader.getModuleJob (node:internal/modules/esm/loader:243:31) at Loader.import (node:internal/modules/esm/loader:177:17) at importModuleDynamicallyWrapper (node:internal/vm/module:437:15)

Screenshots

No response

Additional information

No response

ISanjeevKumar avatar Sep 20 '22 07:09 ISanjeevKumar

Could you confirm what platform you are on and what version of nodejs you are using? Also can you share the steps you took to get here? For example...

  1. cloned repo
  2. ran the command npm install
  3. ...

eddiejaoude avatar Sep 20 '22 07:09 eddiejaoude

Test-files need to have the extension .spec.ts to get picked up by playwright.

Could you please describe the reproduction steps Eddie mentioned above.

Cahllagerfeld avatar Sep 20 '22 07:09 Cahllagerfeld

OS - macOS Nodejs version - v16.5.0

Steps followed:

  1. Fork the project
  2. Clone the repo on my local machine
  3. Run npm install then npx playwright install --with-deps
  4. Then, when I tried running the test using npm run test, I got the aforementioned error.

Note - test file type is already have extension .spec.ts

ISanjeevKumar avatar Sep 20 '22 07:09 ISanjeevKumar

It appears that the issue is in the package.json file. Would it be okay if I send the PR for the fix? @eddiejaoude

ISanjeevKumar avatar Sep 20 '22 07:09 ISanjeevKumar

Sure 👍 It is easier to see the changes and discuss when there is a PR 👍

BTW @Cahllagerfeld is the project lead on this project.

eddiejaoude avatar Sep 20 '22 07:09 eddiejaoude