0.1.2 โ€ข Published 9 months ago

cdktf-vitest v0.1.2

Weekly downloads
-
License
MIT
Repository
-
Last release
9 months ago

cdktf-vitest

npm

๐Ÿงช Terraform CDK's assertions for Vitest.

Installation

npm install cdktf-vitest --save-dev

cdktf-vitest has peer dependencies on both cdktf and vitest, so remember to install those too!

Usage

  1. Import and call setupCdktfVitest in a a setup file:

    // vitest.setup.ts or similar
    import { setupCdktfVitest } from 'cdktf-vitest';
    
    setupCdktfVitest();
  2. Add cdktf-vitest to types in your tsconfig.json:

    // tsconfig.json
    {
      "compilerOptions": {
        "types": ["cdktf-vitest"]
      }
    }

    โ—๏ธ If you don't set types, you'll need to add import 'cdktf-vitest' to the top of each test file.

  3. Done! ๐ŸŽ‰ The assertions should now be available from theexpect function, like:

    import { expect } from 'vitest';
    
    expect(stack).toHaveResouce(resource);

    The assertions work exactly like Terraform CDK's official assertions for Jest. For information on how to use them, see their documentation on unit testing with Jest.

0.1.2

9 months ago

0.1.1

9 months ago

0.1.0

12 months ago