testcafe: Enable debug mode makes test path wrong

What is your Test Scenario?

Any test scenario. I have a test file located at C:\Users\userName\Documents\Code\MyProject\tests\administration\ActivatedInsertion.ts. I’m in the folder C:\Users\userName\Documents\Code\MyProject

What is the Current behavior?

When running testcafe chrome .\tests\administration\ActivatedInsertion.ts, everything is OK. But when I’m running testcafe chrome .\tests\administration\ActivatedInsertion.ts --debug-mode then I’ve got this error :

Error: ENOENT: no such file or directory, open 'C:\Users\userName\Documents\Code\tests\administration\ActivatedInsertion.ts'

I don’t expect testcafe to go one directory upper. It’s like is doing a ../ on the path I give. It’s also happened with the runner.

What is the Expected behavior?

What is your web application and your TestCafe test code?

Your website URL (or attach your complete example):

Your complete test code (or attach your test files):
 
Your complete configuration file (if any):

Your complete test report: not_ok ok

Screenshots:

Steps to Reproduce:

  1. Go to my website …
  2. Execute this command…
  3. See the error…

Your Environment details:

  • testcafe version: 1.3.2
  • node.js version: 10.15.3
  • command-line arguments: testcafe chrome .\test\administration\ActivatedInsertion.ts --debug-mode
  • browser name and version:
  • platform and version: W10
  • other:

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 27 (7 by maintainers)

Most upvoted comments

Thank you for the provided information. Stack traces indicates that this issue can be similar to https://github.com/inikulin/callsite-record/issues/2 and https://github.com/tj/callsite/issues/3, but we still need additional information. If you don’t mind, I will create a new debug build and ask you to install it and share its output. I will post a message with a link to the debug build when I make the required changes. Thank you for your patience and support.

Guys

We’ve fixed a very similar problem in this https://github.com/DevExpress/testcafe/commit/fc6c05b0aab0e7cb224e4a9bc1cf3c25ebef17e0.

Try to run your tests with testcafe@1.5.0 and feel free to reopen this issue if the problem persists.

Hi @Farfurix , using bash and the new build I got this:

 npx testcafe chrome  tests/specs/example/example.spec.ts
!log-error-2!
 Running tests in:
 - Chrome 74.0.3729 / Linux 0.0.0

 Getting Started
!!! wrapTestFunction
err = { Error: ENOENT: no such file or directory, open '/home/ceiia.com/antonio.carvalho/repos/automated_tests/example_error/e2e_test_example/tests/specs/tests/specs/example/example.spec.ts'
    at Object.openSync (fs.js:443:3)
    at Object.readFileSync (fs.js:343:35)
    at CallsiteRecord.renderSync (/home/ceiia.com/antonio.carvalho/repos/automated_tests/example_error/e2e_test_example/node_modules/callsite-record/lib/index.js:218:26)
    at Object.showBreakpoint (/home/ceiia.com/antonio.carvalho/repos/automated_tests/example_error/e2e_test_example/node_modules/testcafe/src/notifications/debug-logger.js:66:52)
    at TestRun._enqueueSetBreakpointCommand (/home/ceiia.com/antonio.carvalho/repos/automated_tests/example_error/e2e_test_example/node_modules/testcafe/src/test-run/index.js:447:21)
    at TestRun.executeCommand (/home/ceiia.com/antonio.carvalho/repos/automated_tests/example_error/e2e_test_example/node_modules/testcafe/src/test-run/index.js:637:31)
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path:
   '/home/ceiia.com/antonio.carvalho/repos/automated_tests/example_error/e2e_test_example/tests/specs/tests/specs/example/example.spec.ts' }
err.message = ENOENT: no such file or directory, open '/home/ceiia.com/antonio.carvalho/repos/automated_tests/example_error/e2e_test_example/tests/specs/tests/specs/example/example.spec.ts'
err.stack = Error: ENOENT: no such file or directory, open '/home/ceiia.com/antonio.carvalho/repos/automated_tests/example_error/e2e_test_example/tests/specs/tests/specs/example/example.spec.ts'
    at Object.openSync (fs.js:443:3)
    at Object.readFileSync (fs.js:343:35)
    at CallsiteRecord.renderSync (/home/ceiia.com/antonio.carvalho/repos/automated_tests/example_error/e2e_test_example/node_modules/callsite-record/lib/index.js:218:26)
    at Object.showBreakpoint (/home/ceiia.com/antonio.carvalho/repos/automated_tests/example_error/e2e_test_example/node_modules/testcafe/src/notifications/debug-logger.js:66:52)
    at TestRun._enqueueSetBreakpointCommand (/home/ceiia.com/antonio.carvalho/repos/automated_tests/example_error/e2e_test_example/node_modules/testcafe/src/test-run/index.js:447:21)
    at TestRun.executeCommand (/home/ceiia.com/antonio.carvalho/repos/automated_tests/example_error/e2e_test_example/node_modules/testcafe/src/test-run/index.js:637:31)
!!! _executeTestFn
err = TestCafeErrorList {
  items:
   [ UncaughtErrorInTestCode {
       code: 'E2',
       isTestCafeError: true,
       callsite: [CallsiteRecord],
       errMsg:
        'Error: ENOENT: no such file or directory, open \'/home/ceiia.com/antonio.carvalho/repos/automated_tests/example_error/e2e_test_example/tests/specs/tests/specs/example/example.spec.ts\'',
       originError: [Error] } ] }
err.message = undefined
err.stack = undefined
 ✖ My first test (screenshots: /home/ceiia.com/antonio.carvalho/repos/automated_tests/example_error/e2e_test_example/reports/screenshots/Getting Started/My first
 test/Chrome_74.0.3729_Linux_0.0.0/2019-08-21_14-05-58/errors/1.png)

   1) Error: ENOENT: no such file or directory, open '/home/ceiia.com/antonio.carvalho/repos/automated_tests/example_error/e2e_test_example/tests/specs/tests/specs/example/example.spec.ts'

      Browser: Chrome 74.0.3729 / Linux 0.0.0
      Screenshot: /home/ceiia.com/antonio.carvalho/repos/automated_tests/example_error/e2e_test_example/reports/screenshots/Getting Started/My first
      test/Chrome_74.0.3729_Linux_0.0.0/2019-08-21_14-05-58/errors/1.png



 1/1 failed (4s)