Skip to content

Commit 448fb6c

Browse files
authored
chore: upgrade vitest and switch to v8 coverage (#27)
* chore: upgrade vitest and switch to v8 coverage * test main entry point
1 parent 94561ba commit 448fb6c

File tree

7 files changed

+95
-132
lines changed

7 files changed

+95
-132
lines changed

package-lock.json

Lines changed: 81 additions & 105 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
"@typescript-eslint/eslint-plugin": "^5.48.0",
9090
"@typescript-eslint/parser": "^5.48.0",
9191
"@vitejs/plugin-react": "^4.2.1",
92-
"@vitest/coverage-istanbul": "^1.1.1",
92+
"@vitest/coverage-v8": "^1.4.0",
9393
"chokidar-cli": "^3.0.0",
9494
"eslint": "^8.31.0",
9595
"eslint-config-prettier": "^8.6.0",
@@ -122,7 +122,7 @@
122122
"stylelint-use-logical": "^2.1.0",
123123
"typescript": "4.9.4",
124124
"vite": "^5.0.12",
125-
"vitest": "^1.1.1"
125+
"vitest": "^1.4.0"
126126
},
127127
"//": "ensure that typedoc uses typescript 4.9.4. It prints a warning, but works",
128128
"overrides": {

src/__tests__/__snapshots__/documenter.test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
22

3-
exports[`definition for code-view matches the snapshot > code-view 1`] = `
3+
exports[`definition for code-view matches the snapshot 1`] = `
44
{
55
"events": [],
66
"functions": [],

src/__tests__/base-props-support.test.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
import { render } from "@testing-library/react";
44
import { ReactElement } from "react";
55
import { describe, expect, test } from "vitest";
6+
import * as components from "../../lib/components";
67
import { defaultProps } from "./default-props";
7-
import { requireComponent } from "./utils";
88

9-
describe(`base props support for code-view`, async () => {
10-
const Component = await requireComponent("code-view");
9+
describe(`base props support for code-view`, () => {
10+
const Component = components.CodeView;
1111
const props = defaultProps["code-view" as keyof typeof defaultProps];
1212

1313
function renderComponent(ui: ReactElement) {
@@ -20,11 +20,13 @@ describe(`base props support for code-view`, async () => {
2020
});
2121

2222
test("should not allow id", () => {
23+
// @ts-expect-error id is not supported
2324
const { container } = renderComponent(<Component {...props} id="example" />);
2425
expect(container.querySelector("#example")).toBeNull();
2526
});
2627

2728
test("should not allow className", () => {
29+
// @ts-expect-error className is not supported
2830
const { container } = renderComponent(<Component {...props} className="example" />);
2931
expect(container.querySelector(".example")).toBeNull();
3032
});

src/__tests__/documenter.test.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0
33
import { expect, test } from "vitest";
4-
import { requireComponentDefinition } from "./utils";
4+
// @ts-expect-error no types here
5+
import apiDocs from "../../lib/components/internal/api-docs/components";
56

6-
test(`definition for code-view matches the snapshot`, () => {
7-
const definition = requireComponentDefinition("code-view");
8-
expect(definition).toMatchSnapshot("code-view");
7+
test("definition for code-view matches the snapshot", () => {
8+
const definition = apiDocs["code-view"];
9+
expect(definition).toMatchSnapshot();
910
});

src/__tests__/utils.ts

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)