Skip to content

Commit 833dc9e

Browse files
committed
test(client-cloudwatch): add query compatibility test for error shape ambiguity
1 parent 5d25600 commit 833dc9e

File tree

6 files changed

+54
-3
lines changed

6 files changed

+54
-3
lines changed

clients/client-cloudwatch/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
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": "yarn g:vitest run -c vitest.config.e2e.ts",
16+
"test:e2e": "yarn g:vitest run -c vitest.config.e2e.ts",
17+
"test:e2e:watch": "yarn g:vitest watch -c vitest.config.e2e.ts"
1518
},
1619
"main": "./dist-cjs/index.js",
1720
"types": "./dist-types/index.d.ts",
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { CloudWatchClient, GetDashboardCommand } from "@aws-sdk/client-cloudwatch";
2+
import { afterAll, beforeAll, describe, expect, test as it } from "vitest";
3+
4+
describe("CloudWatch Query Compatibility E2E", () => {
5+
let client: CloudWatchClient;
6+
7+
beforeAll(() => {
8+
client = new CloudWatchClient({
9+
region: "us-west-2",
10+
});
11+
});
12+
13+
afterAll(() => {
14+
client.destroy();
15+
});
16+
17+
it("AmbiguousErrorResolution", async () => {
18+
const command = new GetDashboardCommand({
19+
DashboardName: "foo",
20+
});
21+
22+
try {
23+
await client.send(command);
24+
fail("Expected ResourceNotFound error");
25+
} catch (error: any) {
26+
expect(error.name).toBe("ResourceNotFound");
27+
}
28+
});
29+
});

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)