📢 Test with Config
We are launching sst load-config
— a CLI command to autoload secrets and config in your SST tests:
-
Lambda function uses
Config
:import { Config } from "@serverless-stack/node/config"; export const main = async () => { return Config.MY_TABLE_NAME; }
-
Write tests as usual
test("MY_TABLE_NAME is loaded", async () => { expect(await main()).toBe("dev-app-my-table"); });
-
Run tests
npx sst load-config -- vitest run
Learn more https://docs.sst.dev/advanced/testing
Changes
- #1981
39a67838d
- Addload-config
cli command to help loading config for running tests - #1987
82cf416fb
- Config: use aws sdk v3 in client library
Update using:
$ npx sst update v1.9.0
$ yarn sst update v1.9.0