Skip to content

Commit 4867ee8

Browse files
committed
chore: add an integration test powered by integ-test and integ-runner
1 parent 7836abf commit 4867ee8

File tree

27 files changed

+9704
-0
lines changed

27 files changed

+9704
-0
lines changed

Diff for: test/integ.nodejs-build.ts

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { IntegTest } from '@aws-cdk/integ-tests-alpha';
2+
import { Stack, StackProps, App, RemovalPolicy } from 'aws-cdk-lib';
3+
import { BlockPublicAccess, Bucket, BucketEncryption } from 'aws-cdk-lib/aws-s3';
4+
import { Construct } from 'constructs';
5+
import { NodejsBuild } from '../src/nodejs-build';
6+
7+
const app = new App();
8+
9+
class TestStack extends Stack {
10+
constructor(scope: Construct, id: string, props: StackProps = {}) {
11+
super(scope, id, props);
12+
13+
const dstBucket = new Bucket(this, 'Destination', {
14+
autoDeleteObjects: true,
15+
removalPolicy: RemovalPolicy.DESTROY,
16+
blockPublicAccess: BlockPublicAccess.BLOCK_ALL,
17+
encryption: BucketEncryption.S3_MANAGED,
18+
});
19+
const dstPath = '/';
20+
21+
new NodejsBuild(this, 'ExampleBuild', {
22+
assets: [
23+
{
24+
path: '../example/example-app',
25+
exclude: ['dist', 'node_modules'],
26+
},
27+
],
28+
destinationBucket: dstBucket,
29+
destinationKeyPrefix: dstPath,
30+
outputSourceDirectory: 'dist',
31+
buildCommands: ['npm ci', 'npm run build'],
32+
buildEnvironment: {
33+
VITE_SOME_TOKEN: dstBucket.bucketName,
34+
},
35+
});
36+
}
37+
}
38+
39+
const stack = new TestStack(app, 'NodejsBuildIntegTest');
40+
41+
new IntegTest(app, 'Test', {
42+
testCases: [stack],
43+
diffAssets: true,
44+
});

0 commit comments

Comments
 (0)