You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First off, thank you very much for this plugin. Makes TS serverless development with Jest very much easier. I may have an interesting corner case to bring up, though hopefully this is something simple I am doing wrong.
This all started with trying to hook a programmatic infrastructure update into the CloudFormation stack update on serverless deploy using a CFN custom resource. Worked great for the initial custom resource creation, but I wanted the update to run on subsequent deploys as well. Which lead me here:
I was able to get the updates running on every serverless deploy, which works well for the continuous development environment we are setting up with this new project. Architecture validated, time to cover with testing!
I setup a Jest test like so:
import jestPlugin from 'serverless-jest-plugin';
import * as mod from '../myCustomResource';
const { lambdaWrapper } = jestPlugin;
const wrapped = lambdaWrapper.wrap(mod, { handler: 'handler' });
...
const response = await wrapped.run({});
However, when running in the serverless-jest-plugin environment, I am getting an error:
● Test suite failed to run
Cannot find module 'uuid/v4'
> 1 | module.exports = () => require('uuid/v4')();
Which seems to be caused by this line in the serverless.yml:
UUID: ${file(./uuid.js)}
This error seems to be isolated to the serverless-jest-plugin environment, since it is working w/o error when running serverless deploy.
Please advise,
-- Tim
The text was updated successfully, but these errors were encountered:
Hello,
First off, thank you very much for this plugin. Makes TS serverless development with Jest very much easier. I may have an interesting corner case to bring up, though hopefully this is something simple I am doing wrong.
This all started with trying to hook a programmatic infrastructure update into the CloudFormation stack update on
serverless deploy
using a CFN custom resource. Worked great for the initial custom resource creation, but I wanted the update to run on subsequent deploys as well. Which lead me here:serverless/serverless#4483
Following the excellent suggestion here:
serverless/serverless#4483 (comment)
Using serverless file variables:
https://www.serverless.com/framework/docs/providers/aws/guide/variables#reference-variables-in-javascript-files
I was able to get the updates running on every
serverless deploy
, which works well for the continuous development environment we are setting up with this new project. Architecture validated, time to cover with testing!I setup a Jest test like so:
However, when running in the
serverless-jest-plugin
environment, I am getting an error:Which seems to be caused by this line in the
serverless.yml
:This error seems to be isolated to the
serverless-jest-plugin
environment, since it is working w/o error when runningserverless deploy
.Please advise,
-- Tim
The text was updated successfully, but these errors were encountered: