@efaj/pulumi-dynamic-stripe 0.1.0-06c6e41 → 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.
- package/Makefile +7 -1
- package/package.json +4 -2
- package/tests/integration.test.ts +46 -0
package/Makefile
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@efaj/pulumi-dynamic-stripe",
|
|
3
|
-
"version": "0.1.0-
|
|
3
|
+
"version": "0.1.0-252fa04",
|
|
4
4
|
"description": "A Pulumi Dynamic Provider for Stripe, supporting modern features like Payment Links.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pulumi",
|
|
@@ -22,8 +22,10 @@
|
|
|
22
22
|
"scripts": {
|
|
23
23
|
"build": "tsc",
|
|
24
24
|
"prepare": "tsc",
|
|
25
|
-
"test": "vitest run",
|
|
25
|
+
"test": "vitest run tests/index.test.ts",
|
|
26
|
+
"test:integration": "vitest run tests/integration.test.ts",
|
|
26
27
|
"lint": "biome check .",
|
|
28
|
+
"lint:fix": "biome check --write .",
|
|
27
29
|
"format": "biome format --write ."
|
|
28
30
|
},
|
|
29
31
|
"dependencies": {
|
|
@@ -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
|
+
});
|