serverless-jest-plugin icon indicating copy to clipboard operation
serverless-jest-plugin copied to clipboard

Running `sls invoke test` results in: `the "path" argument must be of type string`

Open ldgarcia opened this issue 7 years ago • 6 comments

I am currently using "serverless-jest-plugin": "^0.1.6" and "jest": "^22.2.2".

This is my config in serverless.yml:

custom:
  jest:
     roots:
      - '<rootDir>/tests'   

Running either sls invoke test or sls invoke test --path tests it outputs:

 FAIL  tests/customMessage.test.js
  ● Test suite failed to run

    TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string
      
      at assertPath (path.js:28:11)
      at Object.relative (path.js:1259:5)

 FAIL  tests/postConfirmation.test.js
  ● Test suite failed to run

    TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string
      
      at assertPath (path.js:28:11)
      at Object.relative (path.js:1259:5)

Test Suites: 2 failed, 2 total
Tests:       0 total
Snapshots:   0 total
Time:        0.483s
Ran all test suites.

ldgarcia avatar Feb 11 '18 17:02 ldgarcia

+1

TakaGoto avatar Mar 19 '18 21:03 TakaGoto

Also running into this issue

BWoodfork avatar Mar 19 '18 21:03 BWoodfork

Any fix for this?

hmshoaib avatar Jul 27 '18 05:07 hmshoaib

Hi Any update on this?

abhishek-nair avatar Oct 08 '18 11:10 abhishek-nair

This seems to be a problem in jest that was solved in version 21.x (see this). I forked the repo and tried updating the jest version but then some of the tests failed with obscure errors. Tried bumping to version 23 and still didn't work.

brafdlog avatar Nov 09 '18 14:11 brafdlog

This should be fixed now that Jest v23 is supported (I had been running into the same issues previously).

dhm116 avatar Nov 15 '18 14:11 dhm116