serverless-jest-plugin
serverless-jest-plugin copied to clipboard
"TypeError: serverless.classes.Variables is not a constructor" when invoking a test
When using the following versions:
"serverless": "^3.19.0",
"serverless-jest-plugin": "^0.4.0",
and executing npx sls invoke test
the following error is reported:
Error:
TypeError: serverless.classes.Variables is not a constructor
at /home/franco/repos/palm-serverless/node_modules/serverless-jest-plugin/lib/run-tests.js:13:18
at Promise._execute (/home/franco/repos/palm-serverless/node_modules/bluebird/js/release/debuggability.js:384:9)
at Promise._resolveFromExecutor (/home/franco/repos/palm-serverless/node_modules/bluebird/js/release/promise.js:518:18)
at new Promise (/home/franco/repos/palm-serverless/node_modules/bluebird/js/release/promise.js:103:10)
at runTests (/home/franco/repos/palm-serverless/node_modules/serverless-jest-plugin/lib/run-tests.js:8:3)
at ServerlessJestPlugin.<anonymous> (/home/franco/repos/palm-serverless/node_modules/serverless-jest-plugin/index.js:97:23)
at ServerlessJestPlugin.tryCatcher (/home/franco/repos/palm-serverless/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/home/franco/repos/palm-serverless/node_modules/bluebird/js/release/promise.js:547:31)
at Promise._settlePromise (/home/franco/repos/palm-serverless/node_modules/bluebird/js/release/promise.js:604:18)
at Promise._settlePromiseCtx (/home/franco/repos/palm-serverless/node_modules/bluebird/js/release/promise.js:641:10)
at _drainQueueStep (/home/franco/repos/palm-serverless/node_modules/bluebird/js/release/async.js:97:12)
at _drainQueue (/home/franco/repos/palm-serverless/node_modules/bluebird/js/release/async.js:86:9)
at Async._drainQueues (/home/franco/repos/palm-serverless/node_modules/bluebird/js/release/async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (/home/franco/repos/palm-serverless/node_modules/bluebird/js/release/async.js:15:14)
at processImmediate (node:internal/timers:466:21)
at process.topLevelDomainCallback (node:domain:152:15)
at process.callbackTrampoline (node:internal/async_hooks:128:24)
It seems that on file run-tests.js, the lines 13 and 14 are not needed with the latest version of serverless.
+1 I have exactly the same problem.
+1 same problem. Can I create a PR just deleting those lines?
encountering the same problem +1
@bdelamotte can you create pull request to fix this issue ?
+1
+1
+1 Jest version: ~29.3.1 serverless-jest-plugin version: ~0.4.0
Error: TypeError: Class extends value #<Object> is not a constructor or null
Same problem.
"jest": "^29.5.0"
"serverless-jest-plugin": "^0.4.0"
`TypeError: serverless.classes.Variables is not a constructor`
It should be noted that the in the serverless
library, the last reference to Serverless.classes.Variables
is established in version 2.72.3.
This library does not appear to be updated for v3 of serverless, despite it's been out for more than a year now.