kiwigrid/gherkin-testcafe

Invalid argument type

Closed this issue · 4 comments

ampc commented

When executing the feature from examples directory I get the following error

gherkin-testcafe firefox tests/cucumber/search/google.js tests/cucumber/search/google.feature                                                          
ERROR TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined
    at assertPath (path.js:39:11)
    at Object.relative (path.js:1167:5)
    at relative (/home/example/antonio.carvalho/repos/automated_tests/QA_Tests/e2e_smart/node_modules/cucumber/src/support_code_library_builder/define_helpers.js:102:18)
    at getDefinitionLineAndUri (/home/example/antonio.carvalho/repos/automated_tests/QA_Tests/e2e_smart/node_modules/cucumber/src/support_code_library_builder/define_helpers.js:66:27)
    at Object.<anonymous> (/home/example/antonio.carvalho/repos/automated_tests/QA_Tests/e2e_smart/tests/cucumber/search/google.js:12:1)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Module._compile (/home/example/antonio.carvalho/.npm-global/lib/node_modules/testcafe/node_modules/source-map-support/source-map-support.js:517:25)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at stepFiles.forEach.stepFile (/home/example/antonio.carvalho/.npm-global/lib/node_modules/gherkin-testcafe/src/compiler.js:98:7)
    at Array.forEach (<anonymous>)
    at GherkinTestcafeCompiler._loadStepDefinitions (/home/example/antonio.carvalho/.npm-global/lib/node_modules/gherkin-testcafe/src/compiler.js:95:20)
    at GherkinTestcafeCompiler.getTests (/home/example/antonio.carvalho/.npm-global/lib/node_modules/gherkin-testcafe/src/compiler.js:36:10)
    at getTests (/home/example/antonio.carvalho/.npm-global/lib/node_modules/testcafe/src/runner/bootstrapper.js:78:47)
    at Generator.next (<anonymous>)
    at step (/home/example/antonio.carvalho/.npm-global/lib/node_modules/testcafe/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
    at /home/example/antonio.carvalho/.npm-global/lib/node_modules/testcafe/node_modules/babel-runtime/helpers/asyncToGenerator.js:28:13

Type "testcafe -h" for help.

Any idea how to solve this? Thank you 👍

Hi @ampc,

I'm sorry, but I cannot reproduce this issue. Did you try it with the latest version of gherkin-testcafe and the latest version of the examples?

ampc commented

Hi, I'm using these packages:

 "dependencies": {
    "@ffmpeg-installer/ffmpeg": "^1.0.17",
    "@percy/agent": "^0.1.14",
    "@percy/puppeteer": "^1.0.5",
    "@types/node": "^10.12.26",
    "cucumber": "4.2.1",
    "faker": "^4.1.0",
    "gherkin-testcafe": "^2.0.0",
    "moment": "^2.24.0",
    "rimraf": "^2.6.3",
    "testcafe": "^1.0.1",
    "testcafe-reporter-html": "^1.4.4",
    "ts-node": "^8.0.2",
    "typescript": "^3.3.3"
  }

I've noticed that I'm using testcafe 1.0.1, is it related to that?

ampc commented

Hmm, I reinstalled all node_modules and it's working now 😄 Thank you.

I am also getting the same error on running 'gherkin-testcafe tests/steps/sampletest2.js tests/feature/*.feature' command

I even tried reinstalling as @ampc mentioned. But it didn't work.

ERROR TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined at assertPath (path.js:39:11) at Object.relative (path.js:497:5) at getDefinitionLineAndUri (C:\Users\mohamedh\Desktop\testcafe2\node_modules\cucumber\lib\support_code_library_builder\build_helpers.js:184:27) at buildStepDefinitionConfig (C:\Users\mohamedh\Desktop\testcafe2\node_modules\cucumber\lib\support_code_library_builder\build_helpers.js:124:7) at SupportCodeLibraryBuilder.defineStep (C:\Users\mohamedh\Desktop\testcafe2\node_modules\cucumber\lib\support_code_library_builder\index.js:51:79) at Object.<anonymous> (C:\Users\mohamedh\Desktop\testcafe2\tests\steps\sampletest2.js:7:1) at Module._compile (internal/modules/cjs/loader.js:688:30) at Module._compile (C:\Users\mohamedh\AppData\Roaming\npm\node_modules\testcafe\node_modules\source-map-support\source-map-support.js:521:25) at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10) at Module.load (internal/modules/cjs/loader.js:598:32) at tryModuleLoad (internal/modules/cjs/loader.js:537:12) at Function.Module._load (internal/modules/cjs/loader.js:529:3) at Module.require (internal/modules/cjs/loader.js:636:17) at require (internal/modules/cjs/helpers.js:20:18) at stepFiles.forEach.stepFile (C:\Users\mohamedh\AppData\Roaming\npm\node_modules\gherkin-testcafe\src\compiler.js:122:7) at Array.forEach (<anonymous>) at GherkinTestcafeCompiler._loadStepDefinitions (C:\Users\mohamedh\AppData\Roaming\npm\node_modules\gherkin-testcafe\src\compiler.js:119:20) at GherkinTestcafeCompiler.getTests (C:\Users\mohamedh\AppData\Roaming\npm\node_modules\gherkin-testcafe\src\compiler.js:61:10) at Bootstrapper._getTests (C:\Users\mohamedh\AppData\Roaming\npm\node_modules\testcafe\src\runner\bootstrapper.js:81:41) at process._tickCallback (internal/process/next_tick.js:68:7)

appreciate if someone could help?