question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] VSCode can't resolve node API if Playwright project exists in subdirectory

See original GitHub issue

Context:

  • Playwright Version: 1.27.0
  • Operating System: Windows 11
  • Node.js version: 18.7
  • Browser: All

Code Snippet

# Init new Playwright project in a subdirectory of the repo
mkdir my-tests
cd my-tests
npm init playwright@latest

# This VSCode instance works fine
code .

# This VSCode instance can't resolve node API
cd ..
code . --new-window

Describe the bug

VSCode can’t resolve node API if the Playwright project is created in a sub directory. However, everything seems to work fine when running the project, so only DX is affected.

Solution to bug

Adding an empty tsconfig.ts to the Playwright project.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
pavelfeldmancommented, Oct 11, 2022

Yup, I can repro, opening VS Code in the outer folder does not resolve Node types. Interestingly, VS Code is smart enough to suggest that I install @types/node. Which I can clearly see installed under the node_modules, which is in the folder containing my config. I.e. it should resolve this dependency when it starts resolving from playwright.config.ts per Node rules. Looks like something VS Code team could look at!

0reactions
yury-scommented, Oct 14, 2022

Closing per the response above, there is no further action planned on playwright end. @Torsteinws please file a bug with VS Code to have them fix it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What could cause an error related to npm not being able to ...
Try the following steps: 1. Make sure you have the latest npm (npm install -g npm). 2. Add an exception to your antivirus...
Read more >
Visual Studio Code Workspace Trust security
The Workspace Trust feature lets you decide whether code in your project folder can be executed by VS Code and extensions without your...
Read more >
VS Code API | Visual Studio Code Extension API
VS Code API is a set of JavaScript APIs that you can invoke in your Visual Studio Code extension. This page lists all...
Read more >
Source Control with Git in Visual Studio Code
Your browser can't play this video. ... Tip: You can open VS Code in a sub-directory of a Git repository. VS Code's Git...
Read more >
User and Workspace Settings - Visual Studio Code
A setting shows up under this filter if its value differs from the default value, or if its value is explicitly set in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found