Skip to content

Commit 3236ecd

Browse files
committed
test: compatibility with vitest v2
1 parent 0410fcd commit 3236ecd

File tree

6 files changed

+509
-24
lines changed

6 files changed

+509
-24
lines changed

clients/client-s3/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"extract:docs": "api-extractor run --local",
1414
"generate:client": "node ../../scripts/generate-clients/single-service --solo s3",
1515
"test": "yarn g:vitest run",
16-
"test:browser": "node ./test/browser-build/esbuild && vitest run -c vitest.config.browser.ts --mode development",
16+
"test:browser": "node ./test/browser-build/esbuild && yarn g:vitest run -c vitest.config.browser.ts --mode development",
1717
"test:browser:watch": "node ./test/browser-build/esbuild && yarn g:vitest watch -c vitest.config.browser.ts",
1818
"test:e2e": "yarn g:vitest run -c vitest.config.e2e.ts --mode development && yarn test:browser",
1919
"test:e2e:watch": "yarn g:vitest watch -c vitest.config.e2e.ts",

package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
"fs-extra": "^9.0.0",
9393
"generate-changelog": "^1.7.1",
9494
"glob": "7.1.6",
95-
"happy-dom": "14.12.3",
95+
"happy-dom": "16.3.0",
9696
"husky": "^4.2.3",
9797
"jest": "29.7.0",
9898
"jmespath": "^0.15.0",
@@ -108,18 +108,15 @@
108108
"turbo": "2.1.2",
109109
"typescript": "~5.2.2",
110110
"verdaccio": "5.25.0",
111-
"vite": "4.5.5",
112111
"vitest": "2.1.8",
113112
"webpack": "5.76.0",
114113
"webpack-cli": "4.10.0",
115114
"yargs": "17.5.1"
116115
},
117116
"overrides": {
118-
"vite": "4.5.5",
119117
"typescript": "~5.2.2"
120118
},
121119
"resolutions": {
122-
"vite": "4.5.5",
123120
"typescript": "~5.2.2"
124121
},
125122
"workspaces": {

packages/credential-provider-ini/src/fromIni.integ.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ describe("fromIni region search order", () => {
158158
delete process.env.AWS_PROFILE;
159159
});
160160

161-
it("should use 1st priority for the clientConfig given to the provider factory", async () => {
161+
it.only("should use 1st priority for the clientConfig given to the provider factory", async () => {
162162
const sts = new STS({
163163
requestHandler: new MockNodeHttpHandler(),
164164
region: "ap-northeast-2",
@@ -172,7 +172,7 @@ describe("fromIni region search order", () => {
172172

173173
await sts.getCallerIdentity({});
174174
const credentials = await sts.config.credentials();
175-
expect(credentials).toContain({
175+
expect(credentials).toMatchObject({
176176
accessKeyId: "STS_AR_ACCESS_KEY_ID",
177177
secretAccessKey: "STS_AR_SECRET_ACCESS_KEY",
178178
sessionToken: "STS_AR_SESSION_TOKEN_ap-northeast-1",
@@ -192,7 +192,7 @@ describe("fromIni region search order", () => {
192192

193193
await sts.getCallerIdentity({});
194194
const credentials = await sts.config.credentials();
195-
expect(credentials).toContain({
195+
expect(credentials).toMatchObject({
196196
accessKeyId: "STS_AR_ACCESS_KEY_ID",
197197
secretAccessKey: "STS_AR_SECRET_ACCESS_KEY",
198198
sessionToken: "STS_AR_SESSION_TOKEN_us-stsar-1",
@@ -214,7 +214,7 @@ describe("fromIni region search order", () => {
214214

215215
await sts.getCallerIdentity({});
216216
const credentials = await sts.config.credentials();
217-
expect(credentials).toContain({
217+
expect(credentials).toMatchObject({
218218
accessKeyId: "STS_AR_ACCESS_KEY_ID",
219219
secretAccessKey: "STS_AR_SECRET_ACCESS_KEY",
220220
sessionToken: "STS_AR_SESSION_TOKEN_ap-northeast-2",
@@ -238,7 +238,7 @@ describe("fromIni region search order", () => {
238238

239239
await sts.getCallerIdentity({});
240240
const credentials = await sts.config.credentials();
241-
expect(credentials).toContain({
241+
expect(credentials).toMatchObject({
242242
accessKeyId: "STS_AR_ACCESS_KEY_ID",
243243
secretAccessKey: "STS_AR_SECRET_ACCESS_KEY",
244244
sessionToken: "STS_AR_SESSION_TOKEN_us-east-1",

packages/middleware-bucket-endpoint/src/bucketHostname.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ describe("bucketHostname", () => {
566566
clientRegion: region,
567567
isCustomEndpoint: false,
568568
})
569-
).toThrow("");
569+
).toThrow();
570570
});
571571

572572
it('should populate endpoint from MRAP ARN with access point name "myendpoint"', () => {

packages/s3-presigned-post/src/createPresignedPost.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ describe("createPresignedPost", () => {
102102
Bucket,
103103
Key: "path/to/${filename}",
104104
});
105-
const { conditions } = JSON.parse(mockS3Client.config.utf8Decoder.mock.calls[0]);
105+
const { conditions } = JSON.parse(mockS3Client.config.utf8Decoder.mock.calls[0] as any);
106106
expect(conditions).toContainEqual(["starts-with", "$key", "path/to/"]);
107107
});
108108

@@ -112,7 +112,7 @@ describe("createPresignedPost", () => {
112112
Bucket,
113113
Key,
114114
});
115-
const policy = JSON.parse(mockS3Client.config.utf8Decoder.mock.calls[0]);
115+
const policy = JSON.parse(mockS3Client.config.utf8Decoder.mock.calls[0] as any);
116116
expect(policy).toMatchObject({
117117
expiration: "2020-10-28T23:56:49Z",
118118
});
@@ -125,7 +125,7 @@ describe("createPresignedPost", () => {
125125
Key,
126126
Expires: 7200,
127127
});
128-
expect(JSON.parse(mockS3Client.config.utf8Decoder.mock.calls[0])).toMatchObject({
128+
expect(JSON.parse(mockS3Client.config.utf8Decoder.mock.calls[0] as any)).toMatchObject({
129129
expiration: "2020-10-29T00:56:49Z",
130130
});
131131
});
@@ -139,7 +139,7 @@ describe("createPresignedPost", () => {
139139
Fields: { acl: "public-read" },
140140
});
141141
expect(fields).toMatchObject({ bucket: Bucket, key: Key, acl: "public-read" });
142-
const { conditions } = JSON.parse(mockS3Client.config.utf8Decoder.mock.calls[0]);
142+
const { conditions } = JSON.parse(mockS3Client.config.utf8Decoder.mock.calls[0] as any);
143143
expect(conditions).toContainEqual({ acl: "public-read" });
144144
});
145145
});

0 commit comments

Comments
 (0)