testify icon indicating copy to clipboard operation
testify copied to clipboard

Playwright test debug fails with error

Open algot opened this issue 4 years ago • 7 comments

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 avatar Aug 13 '21 13:08 algot

Hey @roggenbrot can you help me with this?

felixjb avatar Aug 19 '21 17:08 felixjb

I'm currently on vacation with no access to a windows system for another week

roggenbrot avatar Aug 19 '21 18:08 roggenbrot

It seems that on windows the executables are not located in node_modules.bin\ . Can you check if a symlink to the real location of playwright solves the issue?

roggenbrot avatar Aug 19 '21 18:08 roggenbrot

https://github.com/facebook/jest/issues/3750

roggenbrot avatar Aug 19 '21 18:08 roggenbrot

@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?

felixjb avatar May 28 '22 18:05 felixjb

I have also no windows installation 😊

roggenbrot avatar May 28 '22 18:05 roggenbrot

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.

matteopic avatar Oct 25 '22 16:10 matteopic