Skip to content

how to include and run jest tests in AWS serverless lambda function in CD #54

@tachyon83

Description

@tachyon83

hello there,

I am currenty working on letting AWS serverless lambda run the jest test in CD(continuous development) process.
I have many test files named '....test.ts'. I created a handler that will turn into a serverless lambda function.
In the handler, jest.runCLI... or execSync("npm run jest")... will run.
So, the function is not open API, but dedicated to only testing.
AFAIK, serverless only takes the minimal form of transpiled(compiled) js codes.
However, the handler does not have any direct dependencies on the test files.
So, all the test files are not going to be included in the lambda function.

is there any ways to let the lambda function search and include all the jest test files so that I can run all the tests under serverless (by sls invoke ...)

I hope there is a simple way to achieve this just by playing with some options in yml file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions