Skip to content

Commit 963418d

Browse files
authored
test(client-cloudwatch): add query compatibility test for error shape ambiguity (#7163)
1 parent 630f3e2 commit 963418d

File tree

6 files changed

+49
-3
lines changed

6 files changed

+49
-3
lines changed

clients/client-cloudwatch/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
"build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",
1212
"clean": "rimraf ./dist-* && rimraf *.tsbuildinfo",
1313
"extract:docs": "api-extractor run --local",
14-
"generate:client": "node ../../scripts/generate-clients/single-service --solo cloudwatch"
14+
"generate:client": "node ../../scripts/generate-clients/single-service --solo cloudwatch",
15+
"test:e2e": "yarn g:vitest run -c vitest.config.e2e.ts",
16+
"test:e2e:watch": "yarn g:vitest watch -c vitest.config.e2e.ts"
1517
},
1618
"main": "./dist-cjs/index.js",
1719
"types": "./dist-types/index.d.ts",
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { CloudWatchClient, GetDashboardCommand } from "@aws-sdk/client-cloudwatch";
2+
import { beforeAll, describe, expect, test as it } from "vitest";
3+
4+
describe("CloudWatch Query Compatibility E2E", () => {
5+
let client: CloudWatchClient;
6+
7+
beforeAll(async () => {
8+
client = new CloudWatchClient({
9+
region: "us-west-2",
10+
});
11+
});
12+
13+
it("AmbiguousErrorResolution", async () => {
14+
const command = new GetDashboardCommand({
15+
DashboardName: "foo",
16+
});
17+
18+
try {
19+
await client.send(command);
20+
fail("Expected ResourceNotFound error");
21+
} catch (error: any) {
22+
expect(error.name).toBe("ResourceNotFound");
23+
}
24+
});
25+
});

clients/client-cloudwatch/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
"rootDir": "src",
1010
"useUnknownInCatchVariables": false
1111
},
12-
"exclude": ["test/"]
12+
"exclude": ["test/", "vitest.*.ts"]
1313
}

clients/client-cloudwatch/tsconfig.types.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
"declarationDir": "dist-types",
77
"emitDeclarationOnly": true
88
},
9-
"exclude": ["test/**/*", "dist-types/**/*"]
9+
"exclude": ["test/**/*", "dist-types/**/*", "vitest.*.ts"]
1010
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { defineConfig } from "vitest/config";
2+
3+
export default defineConfig({
4+
test: {
5+
exclude: ["**/*.browser.e2e.spec.ts"],
6+
include: ["**/*.e2e.spec.ts"],
7+
environment: "node",
8+
},
9+
mode: "development",
10+
});
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { defineConfig } from "vitest/config";
2+
3+
export default defineConfig({
4+
test: {
5+
exclude: ["**/*.{integ,e2e,browser}.spec.ts"],
6+
include: ["**/*.spec.ts"],
7+
environment: "node",
8+
},
9+
});

0 commit comments

Comments
 (0)