cdktf-vitest
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

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.

Package Sidebar

Install

npm i cdktf-vitest

Weekly Downloads

34

Version

0.1.2

License

MIT

Unpacked Size

15.7 kB

Total Files

7

Last publish

Collaborators

  • duniul