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

TypeError: Path must be a string. Received undefined #18

Open
soufi opened this issue Feb 9, 2018 · 0 comments
Open

TypeError: Path must be a string. Received undefined #18

soufi opened this issue Feb 9, 2018 · 0 comments

Comments

@soufi
Copy link

soufi commented Feb 9, 2018

I a persistent error while using serverless framework with serverless-offline and jest unit testing module.

I am trying to test my serverless function (lambda) using serverless-jest-plugin which is supposed to integrate jest on serverless. Following is my jest configuration in my serverless.yml:

custom:
 default:
  stage: dev
 table:
  dictionary: Dictionary
  rules: Rules
 jest:
  verbose: true
  testResultsProcessor: jest-junit
  modulePaths: ["<rootDir>/node_modules", "<rootDir>/lib"]
  roots: ["<rootDir>/tests"]
  testEnvironment: node
plugins:
   - serverless-jest-plugin
   - serverless-dynamodb-local
   - serverless-offline

I have a lambda function which uses dynamoDB to get some data etc.

Whenever I use sls invoke test I have the following:

$ sls invoke test
 FAIL  tests/file.test.js
  ● Test suite failed to run

TypeError: Path must be a string. Received undefined
  
  at assertPath (path.js:7:11)
  at Object.relative (path.js:1226:5)
  at process._tickDomainCallback (internal/process/next_tick.js:135:7)
Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        0.386s
Ran all test suites.

I'm running the following package.json:

{
  "dependencies": {
    "ajv": "^6.1.1",
    "async": "^2.6.0",
    "aws-sdk": "^2.188.0",
    "notevil": "^1.1.0"
  },
  "devDependencies": {
    "jest": "^22.2.1",
    "jest-junit": "^3.5.0",
    "serverless-dynamodb-local": "^0.2.27",
    "serverless-jest-plugin": "^0.1.6",
    "serverless-offline": "^3.16.0"
  }
}

Cheers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant