Skip to content

Commit

Permalink
test: compatibility with vitest v2
Browse files Browse the repository at this point in the history
  • Loading branch information
kuhe committed Jan 7, 2025
1 parent 0410fcd commit 3236ecd
Show file tree
Hide file tree
Showing 6 changed files with 509 additions and 24 deletions.
2 changes: 1 addition & 1 deletion clients/client-s3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"extract:docs": "api-extractor run --local",
"generate:client": "node ../../scripts/generate-clients/single-service --solo s3",
"test": "yarn g:vitest run",
"test:browser": "node ./test/browser-build/esbuild && vitest run -c vitest.config.browser.ts --mode development",
"test:browser": "node ./test/browser-build/esbuild && yarn g:vitest run -c vitest.config.browser.ts --mode development",
"test:browser:watch": "node ./test/browser-build/esbuild && yarn g:vitest watch -c vitest.config.browser.ts",
"test:e2e": "yarn g:vitest run -c vitest.config.e2e.ts --mode development && yarn test:browser",
"test:e2e:watch": "yarn g:vitest watch -c vitest.config.e2e.ts",
Expand Down
5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"fs-extra": "^9.0.0",
"generate-changelog": "^1.7.1",
"glob": "7.1.6",
"happy-dom": "14.12.3",
"happy-dom": "16.3.0",
"husky": "^4.2.3",
"jest": "29.7.0",
"jmespath": "^0.15.0",
Expand All @@ -108,18 +108,15 @@
"turbo": "2.1.2",
"typescript": "~5.2.2",
"verdaccio": "5.25.0",
"vite": "4.5.5",
"vitest": "2.1.8",
"webpack": "5.76.0",
"webpack-cli": "4.10.0",
"yargs": "17.5.1"
},
"overrides": {
"vite": "4.5.5",
"typescript": "~5.2.2"
},
"resolutions": {
"vite": "4.5.5",
"typescript": "~5.2.2"
},
"workspaces": {
Expand Down
10 changes: 5 additions & 5 deletions packages/credential-provider-ini/src/fromIni.integ.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ describe("fromIni region search order", () => {
delete process.env.AWS_PROFILE;
});

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

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

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

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

await sts.getCallerIdentity({});
const credentials = await sts.config.credentials();
expect(credentials).toContain({
expect(credentials).toMatchObject({
accessKeyId: "STS_AR_ACCESS_KEY_ID",
secretAccessKey: "STS_AR_SECRET_ACCESS_KEY",
sessionToken: "STS_AR_SESSION_TOKEN_us-east-1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ describe("bucketHostname", () => {
clientRegion: region,
isCustomEndpoint: false,
})
).toThrow("");
).toThrow();
});

it('should populate endpoint from MRAP ARN with access point name "myendpoint"', () => {
Expand Down
8 changes: 4 additions & 4 deletions packages/s3-presigned-post/src/createPresignedPost.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ describe("createPresignedPost", () => {
Bucket,
Key: "path/to/${filename}",
});
const { conditions } = JSON.parse(mockS3Client.config.utf8Decoder.mock.calls[0]);
const { conditions } = JSON.parse(mockS3Client.config.utf8Decoder.mock.calls[0] as any);
expect(conditions).toContainEqual(["starts-with", "$key", "path/to/"]);
});

Expand All @@ -112,7 +112,7 @@ describe("createPresignedPost", () => {
Bucket,
Key,
});
const policy = JSON.parse(mockS3Client.config.utf8Decoder.mock.calls[0]);
const policy = JSON.parse(mockS3Client.config.utf8Decoder.mock.calls[0] as any);
expect(policy).toMatchObject({
expiration: "2020-10-28T23:56:49Z",
});
Expand All @@ -125,7 +125,7 @@ describe("createPresignedPost", () => {
Key,
Expires: 7200,
});
expect(JSON.parse(mockS3Client.config.utf8Decoder.mock.calls[0])).toMatchObject({
expect(JSON.parse(mockS3Client.config.utf8Decoder.mock.calls[0] as any)).toMatchObject({
expiration: "2020-10-29T00:56:49Z",
});
});
Expand All @@ -139,7 +139,7 @@ describe("createPresignedPost", () => {
Fields: { acl: "public-read" },
});
expect(fields).toMatchObject({ bucket: Bucket, key: Key, acl: "public-read" });
const { conditions } = JSON.parse(mockS3Client.config.utf8Decoder.mock.calls[0]);
const { conditions } = JSON.parse(mockS3Client.config.utf8Decoder.mock.calls[0] as any);
expect(conditions).toContainEqual({ acl: "public-read" });
});
});
Loading

0 comments on commit 3236ecd

Please sign in to comment.