Getting Started

To work with ProTI you require an installation of NodeJS with NPM. ProTI is developed with and supports NodeJS 18 LTS.

Using ProTI

  1. Set up Jest in the project. Using NPM and ts-jest for the transpilation, you can run these commands in the project directory:
    npm install --save-dev jest ts-jest
    
  2. Install @proti-iac/runner and @proti-iac/test-runner:
    npm install --save-dev @proti-iac/runner @proti-iac/test-runner
    
  3. Configure Jest to invoke ProTI. The easiest way to do so is to inherit the ProTI configuration preset from @proti-iac/test-runner. You can configure Jest by creating a jest.config.js file in the root of your project with this content:
    /**
     * For a detailed explanation regarding each configuration property, visit:
     * https://jestjs.io/docs/configuration
     */
    /** @type {import('jest').Config} */
    const config = {
     preset: "@proti-iac/test-runner",
    };
    module.exports = config;
    

    Add further configuration to the file to augment Jest’s, ts-jest’s, and ProTI’s default configuration. The default configuration configures a simple empty state test generator and an oracle that only checks URN uniqueness across all resources, which are implemented in @proti-iac/core. Most likely, you want to configure more sophisticated generator and generator plugins. Configuring ProTI describes how. Concretely, @proti-iac/pulumi-packages-schema’s README describes how to install and configure our first type-based plugins.

  4. Run ProTI by running Jest on the project:
    npx jest
    

Using ProTI’s Inline Specifications

To use ProTI’s inline specification syntax, additionally, install the @proti-iac/spec package as a dependency (not only as a development dependency):

npm install --save @proti-iac/spec

Simply import the package in your IaC program’s code and use the syntax it exports:

import * as ps from "@proti-iac/spec";

As an example of its use, you can have a look at the correct random word website example with ProTI inline specifications.

Detailed Reporting

For detailed reporting in CSV format, additionally install the @proti-iac/reporter package, and configure it as Jest reporter.

Developing ProTI Plugins

ProTI is extended through generator and oracle plugins. Implementing either is simple and demonstrated in @proti-iac/plugins-demo. This package serves as a blueprint for new plugins. Please refer to its code and documentation for further details.