-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
[Bug]: VSCode extension not reloading test code in text editor and showing false errors #33671
Comments
Having same issue and its a buzzkill |
+1 Having the same issue |
Code snippet that causes trouble as well: const USERNAME_TEST = process.env.USERNAME_TEST;
if (!USERNAME_TEST) {
throw new Error("'USERNAME_TEST' is not set"); // <<< Throwing Error `USERNAME_TEST` not defined. Deactivating extension fixes issue.
} |
Could you confirm if the problems stay around after saving the file? For me when saving they disappear since it reloads the tests. |
@mxschmitt For me the issue is the extension:
The reproduction is actually fast and simple. I had this extension turned off since this issue and just copy pasted my snippet then turned on extension and a few seconds later 💥 |
Do you have dotenv configured in your config? How do you set this env normally? |
Hey, I didn't have it configured. So IMO this should be unrelated to each other. What if I like to set environment variables in my shell? Runtime and compiletime are beeing mixed here IMO. I gave it a try. Indeed installing dotenv and But this isn't intuitive or IMO not well documented and the error message if variables are missing is not helping either. Also red underlining the error message of my own error constructor is misleading. I'm experienced enough to handle this on runtime on my own. For me personally not intuitive at all. But now I understand it and I can handle that for the future. IMO this "feature" requires improvement especially in the error message or best case should be disabled. It confused me much more than it helped. Finally I tried to reproduce the initial reporters issue and can't confirm that behaviour on my machine. Adding and removing incorrect code doesn't cause this kind of behaviour for me following your instructions. |
@mxschmitt maybe important information is As @Makoehle pointed out - extension is the problem here. It is also somehow connected with installation of Playwright (when you change version) - just try to change it. Before installation I had struggle to reproduce on fresh Playwright project. At the end remember that this issue was reproduced by @pavelfeldman here #33531 (comment) If you need dedicated virtual machine for it I can prepare but let's try what your team already have. |
I have the same issue. VS Code extension “Playwright Test for VSCode” v1.1.12 erroneously marks code with errors. |
Version
1.49.0
Steps to reproduce
Start new project on Windows 11 machine with:
npm init playwright@latest --yes '--' '--quiet' '--browser=chromium'
Make sure that you have Playwright Extension installed (tested on Playwright Test for VSCode v1.1.12)
Make changes to test script to make VSCode show some red underlines indicating that are problems with code.
![Image](https://private-user-images.githubusercontent.com/72373858/387631358-f0a4f0f2-f741-43f4-9420-ba823a46b471.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk5MTY5OTMsIm5iZiI6MTczOTkxNjY5MywicGF0aCI6Ii83MjM3Mzg1OC8zODc2MzEzNTgtZjBhNGYwZjItZjc0MS00M2Y0LTk0MjAtYmE4MjNhNDZiNDcxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE4VDIyMTEzM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWU2ZWE4OGRmMmFlOGNhZjg2OWY2ZjYyNDM5ZDQ2Y2VlZWI3NTllNTVjYTZjNjc2ZjAxODJhOGVlODU1ZmRkZTUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.JEGsu2OsXLow57pOnCjfW9U0paDsn43_ry-btUp1GDY)
Use Ctr (Cmd) + Z to udo some actions if bug output will not appear.
This is correct error - added
const
in line 4:If incorrect code removed error persist:
![Image](https://private-user-images.githubusercontent.com/72373858/387631518-0f30b59e-7538-4767-b280-b23ae84825cb.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk5MTY5OTMsIm5iZiI6MTczOT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RlYTg4MzFjODVhMjczNTMyZjFiYTY0MWQ5NWQzNzllM2I1YWZiZjVhNzIzOGI0OTA0ZTk1YzMwZWRkYTk2NWQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.bXkkKecmApgV7eG8Iub8RwRpHPQH5KGx3PEMEL_jPxM)
With hoover on error:
The problem disappears when navigating to Testing | TEST EXPLORER | Refresh Tests
This issue was observed with already fixed one: #33531
Expected behavior
No errors displayed in code editor
Actual behavior
False error displayed, manual action required.
Additional context
All plugins except the Playwright Extension were turned off. All updates have been applied.
Sometimes several actions on the code need to be executed to trigger this error. It occurs on multiple machines, both Windows and macOS.
This bug appeared in previous extension releases, but recently it has been occurring frequently.
Use of W11 virtual machine can be needed: #33531 (comment)
Reproduction may include executing installation of any Playwright version and browsers since this is somehow connected. In my case issue appeared after fresh Playwright installation. After some time was not reproducible and after triggering latest installation it appeared again.
Environment
The text was updated successfully, but these errors were encountered: