Skip to content
This repository has been archived by the owner on Jul 11, 2024. It is now read-only.

How to resolve TypeScript paths in Playwright tests

License

Notifications You must be signed in to change notification settings

valler/playwright-ts-paths-repro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Playwright TS Paths Repro

The fix has been merged: #27846.

How to resolve TypeScript paths in Playwright tests.

An issue for this already exists the Playwright repo: #27933.

Currently Playwright won't resolve paths in tsconfig.json unless baseURL is set explicitly.

Example:

{
  "compilerOptions": {
    "baseURL": "."
  }
}

This should not be required according to the TypeScript docs on the paths option.

Reproduction

Clone this repro repo and and install the dependencies:

git clone git@github.com:valler/playwright-ts-paths-repro.git
 cd playwright-ts-paths-repro
npm i

Alternatively, start a GitHub Codespace.

Actual

Run the test:

npm t

This fails with an error containing:

Error: Cannot find package '~src'

Expected

Set the baseURL in tests/tsconfig.json to ".". You can uncomment the prepared line.

Run the test:

npm t

The test should pass.

About

How to resolve TypeScript paths in Playwright tests

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published