TypeError:Path必须是字符串。收到undefined

时间:2018-02-08 16:27:45

标签: node.js amazon-dynamodb jestjs serverless-framework serverless-plugins

serverless框架与serverless-offlinejest单元测试模块一起使用时,我遇到了持续性错误。

我正在尝试使用serverless-jest-plugin来测试我的无服务器功能(lambda),jest应该在serverless上集成jest。以下是我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 配置:

sls invoke test

我有一个lambda函数,它使用dynamoDB获取一些数据等。

每当我使用$ 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. 时,我都有以下内容:

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" } }

filter

干杯。

0 个答案:

没有答案