@efaj/pulumi-dynamic-stripe 0.0.2 → 0.1.0-252fa04

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,46 @@
1
+ import { LocalWorkspace } from "@pulumi/pulumi/automation";
2
+ import { describe, expect, it } from "vitest";
3
+ import { Product } from "../src/index";
4
+
5
+ describe("Pulumi Dynamic Provider Serialization", () => {
6
+ it("should successfully serialize the provider closure without crashing", async () => {
7
+ // Define an inline Pulumi program that instantiates one of our dynamic resources
8
+ const program = async () => {
9
+ const product = new Product("test-product", {
10
+ apiKey: "sk_test_123",
11
+ name: "Test Serialization Product",
12
+ });
13
+ return {
14
+ productId: product.productId,
15
+ };
16
+ };
17
+
18
+ // Initialize a LocalWorkspace for the inline program
19
+ const workspace = await LocalWorkspace.create({
20
+ projectSettings: {
21
+ name: "pulumi-dynamic-stripe-test",
22
+ runtime: "nodejs",
23
+ backend: { url: "file://~" }, // Use local state
24
+ },
25
+ envVars: {
26
+ PULUMI_CONFIG_PASSPHRASE: "test", // Required for local backends in non-interactive CI
27
+ },
28
+ program,
29
+ });
30
+
31
+ // Create a temporary stack
32
+ const stack = await workspace.createStack("test-stack");
33
+
34
+ // Run a preview
35
+ // During preview, the dynamic provider closure is serialized and sent to the Pulumi engine.
36
+ // If there is a serialization issue (e.g. TypeScript 7 AST parsing failure),
37
+ // this preview will throw a runtime error.
38
+ try {
39
+ const preview = await stack.preview();
40
+ expect(preview.stdout).toBeDefined();
41
+ } finally {
42
+ // Clean up the temporary stack
43
+ await workspace.removeStack("test-stack");
44
+ }
45
+ }, 30000); // 30 second timeout since Pulumi engine startup can take a few seconds
46
+ });
@@ -0,0 +1,7 @@
1
+ import { defineConfig } from "vitest/config";
2
+
3
+ export default defineConfig({
4
+ test: {
5
+ include: ["tests/**/*.test.ts"],
6
+ },
7
+ });
package/jest.config.js DELETED
@@ -1,5 +0,0 @@
1
- module.exports = {
2
- preset: 'ts-jest',
3
- testEnvironment: 'node',
4
- testMatch: ['**/tests/**/*.test.ts'],
5
- };