Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Replace jest linting with vitest linting #3735

Merged
merged 1 commit into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions editor.planx.uk/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
"react-hooks",
"simple-import-sort",
"jsx-a11y",
"testing-library"
"testing-library",
"@vitest"
],
"extends": [
"eslint:recommended",
"plugin:jsx-a11y/recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
"prettier",
"plugin:@vitest/legacy-recommended"
],
"rules": {
"react-hooks/rules-of-hooks": "error",
Expand Down
2 changes: 2 additions & 0 deletions editor.planx.uk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
"@types/uuid": "^9.0.7",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.58.0",
"@vitest/eslint-plugin": "^1.1.4",
"autoprefixer": "^10.4.16",
"css-loader": "^6.10.0",
"esbuild": "^0.21.3",
Expand Down Expand Up @@ -176,6 +177,7 @@
"storybook": "storybook dev -p 6006",
"build-storybook": "mkdir -p build && storybook build --quiet --output-dir ./build/storybook",
"lint": "eslint 'src/**/*.{js,jsx,ts,tsx}' && prettier -c ./src",
"lint:error": "eslint --quiet 'src/**/*.{js,jsx,ts,tsx}' && prettier -c ./src",
"lint:fix": "eslint --fix 'src/**/*.{js,jsx,ts,tsx}' && prettier -w ./src",
"check": "tsc --noEmit && pnpm lint",
"prepare": "cd .. && husky install editor.planx.uk/.husky"
Expand Down
49 changes: 37 additions & 12 deletions editor.planx.uk/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 12 additions & 12 deletions editor.planx.uk/src/components/Header.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,11 @@ for (const route of ["/published", "/preview", "/draft", "/pay", "/invite"]) {
expect(screen.getByText("test flow")).toBeInTheDocument();
});

// it("should not have any accessibility violations", async () => {
// const { container } = setup(<Header />);
// const results = await axe(container);
// expect(results).toHaveNoViolations();
// });
it("should not have any accessibility violations", async () => {
const { container } = setup(<Header />);
const results = await axe(container);
expect(results).toHaveNoViolations();
});
});
}

Expand Down Expand Up @@ -224,13 +224,13 @@ describe("Section navigation bar", () => {
expect(screen.getByText("First section")).toBeInTheDocument();
});

// it("should not have any accessibility violations", async () => {
// act(() => setState({ flow: flowWithThreeSections }));
// act(() => getState().initNavigationStore());
// const { container } = setup(<Header />);
it("should not have any accessibility violations", async () => {
act(() => setState({ flow: flowWithThreeSections }));
act(() => getState().initNavigationStore());
const { container } = setup(<Header />);

// const results = await axe(container);
// expect(results).toHaveNoViolations();
// });
const results = await axe(container);
expect(results).toHaveNoViolations();
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,14 @@ describe("A team with a subdomain has an offline, published service.", () => {
setupServiceSettingsScreen();
});

// eslint-disable-next-line @vitest/expect-expect
it("has a public link with the subdomain url in a <p> tag", async () => {
const { flowSlug, teamDomain } = getState();

await inactiveLinkCheck(`https://${teamDomain}/${flowSlug}`);
});

// eslint-disable-next-line @vitest/expect-expect
it("has a disabled copy button", disabledCopyCheck);
});

Expand All @@ -79,12 +81,14 @@ describe("A team with a subdomain has an online, unpublished service.", () => {
setupServiceSettingsScreen();
});

// eslint-disable-next-line @vitest/expect-expect
it("has a public link with the subdomain url in a <p> tag", async () => {
const { flowSlug, teamDomain } = getState();

await inactiveLinkCheck(`https://${teamDomain}/${flowSlug}`);
});

// eslint-disable-next-line @vitest/expect-expect
it("has a disabled copy button", disabledCopyCheck);
});

Expand All @@ -102,6 +106,7 @@ describe("A team with a subdomain has an online, published service.", () => {
);
});

// eslint-disable-next-line @vitest/expect-expect
it("has a public link with the subdomain url in an <a> tag", async () => {
// render the <ServiceSettings/> comp
const { flowSlug, teamDomain } = getState();
Expand All @@ -110,6 +115,7 @@ describe("A team with a subdomain has an online, published service.", () => {
await activeLinkCheck(`https://${teamDomain}/${flowSlug}`);
});

// eslint-disable-next-line @vitest/expect-expect
it("has an enabled copy button", async () => {
// render the <ServiceSettings/> comp
await setupServiceSettingsScreen();
Expand Down Expand Up @@ -145,12 +151,14 @@ describe("A team with a subdomain has an offline, unpublished service.", () => {
setupServiceSettingsScreen();
});

// eslint-disable-next-line @vitest/expect-expect
it("has a public link with the subdomain url in a <p> tag", async () => {
const { flowSlug, teamDomain } = getState();

await inactiveLinkCheck(`https://${teamDomain}/${flowSlug}`);
});

// eslint-disable-next-line @vitest/expect-expect
it("has a disabled copy button", disabledCopyCheck);
});

Expand All @@ -172,10 +180,12 @@ describe("A team without a subdomain has an offline, published service.", () =>
setupServiceSettingsScreen();
});

// eslint-disable-next-line @vitest/expect-expect
it("has a public link with the url in a <p> tag", async () => {
await inactiveLinkCheck(publishedUrl);
});

// eslint-disable-next-line @vitest/expect-expect
it("has a disabled copy button", disabledCopyCheck);
});

Expand All @@ -197,10 +207,12 @@ describe("A team without a subdomain has an online, unpublished service.", () =>
setupServiceSettingsScreen();
});

// eslint-disable-next-line @vitest/expect-expect
it("has a public link with the url in a <p> tag", async () => {
await inactiveLinkCheck(publishedUrl);
});

// eslint-disable-next-line @vitest/expect-expect
it("has a disabled copy button", disabledCopyCheck);
});

Expand All @@ -223,12 +235,14 @@ describe("A team without a subdomain has an online, published service.", () => {
);
});

// eslint-disable-next-line @vitest/expect-expect
it("has a public link with the subdomain url in an <a> tag", async () => {
// render the <ServiceSettings/> comp
setupServiceSettingsScreen();
await activeLinkCheck(publishedUrl);
});

// eslint-disable-next-line @vitest/expect-expect
it("has an enabled copy button", () => {
// render the <ServiceSettings/> comp
setupServiceSettingsScreen();
Expand Down Expand Up @@ -265,9 +279,11 @@ describe("A team without a subdomain has an offline, unpublished service.", () =
setupServiceSettingsScreen();
});

// eslint-disable-next-line @vitest/expect-expect
it("has a public link with the url in a <p> tag", async () => {
await inactiveLinkCheck(publishedUrl);
});

// eslint-disable-next-line @vitest/expect-expect
it("has a disabled copy button", disabledCopyCheck);
});
Loading