Skip to content
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

Playwright test debug fails with error #76

Open
algot opened this issue Aug 13, 2021 · 7 comments
Open

Playwright test debug fails with error #76

algot opened this issue Aug 13, 2021 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@algot
Copy link

algot commented Aug 13, 2021

The simplest playwright test from Getting Started manual fails on debugging

Steps to reproduce the behavior:
Setup the simplest playwright test as described in https://playwright.dev/docs/intro#first-test

  1. Create new folder
  2. Run npm init -y
  3. Run npm i -D @playwright/test
  4. Create file test.spec.ts with following content:
import { test, expect } from "@playwright/test";
test("basic test", async ({ page }) => {
  await page.goto("https://playwright.dev/");
  const name = await page.innerText(".navbar__title");
  expect(name).toBe("Playwright");
});
  1. Press 'Run Test' button in code lens - test passed successfully.
  2. Press 'Debug test' button in code lens - test failed to execute
PS C:\dev\js\js-salesforce-playwright-test-runner-testify>  ${env:PLAYWRIGHT_CHROMIUM_DEBUG_PORT}='9222'; ${env:PWDEBUG}='true'; ${env:NODE_ENV}='test'; ${env:NODE_OPTIONS}='--require "c:/Users/user/AppData/Local/Programs/Microsoft VS Code/resources/app/extensions/ms-vscode.js-debug/src/bootloader.bundle.js" --inspect-publish-uid=http'; ${env:VSCODE_INSPECTOR_OPTIONS}='{"inspectorIpc":"\\\\.\\pipe\\node-cdp.9104-2.sock","deferredMode":false,"waitForDebugger":"","execPath":"C:\\Program Files\\nodejs\\node.exe","onlyEntrypoint":false,"autoAttachMode":"always","fileCallback":"C:\\Users\\user\\AppData\\Local\\Temp\\node-debug-callback-409a480ccf67db31"}'; & 'C:\Program Files\nodejs\node.exe' '.\node_modules\.bin\playwright' 'test' '-g' 'basic test' '' 'test.spec.ts' 
Debugger attached.
Waiting for the debugger to disconnect...
C:\dev\js\js-salesforce-playwright-test-runner-testify\node_modules\.bin\playwright:2  
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
          ^^^^^^^

SyntaxError: missing ) after argument list
    at wrapSafe (internal/modules/cjs/loader.js:988:16)
    at Module._compile (internal/modules/cjs/loader.js:1036:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
    at Module.load (internal/modules/cjs/loader.js:937:32)
    at Function.Module._load (internal/modules/cjs/loader.js:778:12)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
    at internal/main/run_main_module.js:17:47
  • OS: Windows 10
  • Node v14.15.5

Issue is not reproduced on Ubuntu 20.04/Node v14.15.0 configuration

@algot algot added the bug Something isn't working label Aug 13, 2021
@felixjb
Copy link
Owner

felixjb commented Aug 19, 2021

Hey @roggenbrot can you help me with this?

@roggenbrot
Copy link
Contributor

roggenbrot commented Aug 19, 2021 via email

@roggenbrot
Copy link
Contributor

roggenbrot commented Aug 19, 2021 via email

@roggenbrot
Copy link
Contributor

roggenbrot commented Aug 19, 2021 via email

@felixjb
Copy link
Owner

felixjb commented May 28, 2022

@roggenbrot I ended up not looking much into it but now I'm back. The problem is: I don't have a Windows setup to reproduce this bug =/

Also, there is another issue #53 that seems to be related to this one.

Can you help me with this one?

@roggenbrot
Copy link
Contributor

roggenbrot commented May 28, 2022 via email

@matteopic
Copy link

I have the same issue with jest on node 16.14.12.

When I click on "Run Test", following command is invoked

node_modules\.bin\jest App.test.ts --testNamePattern="Binance"

When i click on "Debug Test", following command is invoked

cmd /C "set "NODE_ENV=test" && set "NODE_OPTIONS=--require "c:/Program Files/Microsoft VS Code/resources/app/extensions/ms-vscode.js-debug/src/bootloader.bundle.js" --inspect-publish-uid=http" && set "VSCODE_INSPECTOR_OPTIONS={"inspectorIpc":"\\\\.\\pipe\\node-cdp.17492-6.sock","deferredMode":false,"waitForDebugger":"","execPath":"C:\\Program Files\\nodejs\\node.exe","onlyEntrypoint":false,"autoAttachMode":"always","fileCallback":"C:\\Users\\MATTEO~1.PIC\\AppData\\Local\\Temp\\node-debug-callback-46e3eb920ccac4a0"}" && "C:\Program Files\nodejs\node.exe" .\node_modules\.bin\jest App.test.ts --testNamePattern Binance --runInBand "" "

In the first case launching node_modules\.bin\jest in the console, cause windows to actually start node_modules\.bin\jest.cmd and the process will execute successfully.

In the second case at the end of the command appears this strange combination "C:\Program Files\nodejs\node.exe" .\node_modules\.bin\jest.
.\node_modules\.bin\jest file is passed to nodejs runtime but it is not a javascript file, it is a linux shell script. Nodejs is not able to process that file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants