Skip to content

Expose Test Reset Function #21

@svozza

Description

@svozza

Our library can run both inside and outisde the InvokeStore async context. As such, I have suites of concurrency tests to verify theconcurrency behiours I expect to see. After the change in v0.2.x to change the instantiation logic, ie., the introduction of getInstanceAsync this has made testing much more difficult.

This is because the new _testing field is only added if the AWS_LAMBDA_BENCHMARK_MODE is set to 1 at the very first time the module is imported. This means that if InvokeStore is imported at the top level anywhere before your test, i.e., in application code, then the _testing.reset function will not be there. Using vi.strubEnv in a before block will not work because it is too late, the module has long been imported before then.

I propose that this reset function should always be available without the need for AWS_LAMBDA_BENCHMARK_MODE to allow for ease of testing for codebases that need to support both environments where InvokeStore needs to be use to manage async contexts and where it does not

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