Skip to content

Commit

Permalink
test: use vitest as test runner for eslint-plugin-supa-mdx too
Browse files Browse the repository at this point in the history
  • Loading branch information
charislam committed Nov 1, 2024
1 parent ba3d6fc commit dceb33a
Show file tree
Hide file tree
Showing 5 changed files with 122 additions and 101 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,6 @@ jobs:
- name: js lint
run: npm run lint
- name: js tests
# Temporarily not running tests for eslint-plugin-supa-mdx until we
# figure out why the process never exits in CI only
# Temporarily ignore tests for eslint-plugin-supa-mdx until we figure
# out why the test runner never exits in CI only
run: npm run test -w supa-mdx-lint
148 changes: 79 additions & 69 deletions package-lock.json

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

5 changes: 3 additions & 2 deletions packages/eslint-supa-mdx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
"scripts": {
"format": "prettier --write .",
"format:check": "prettier --check .",
"test": "node tests/rule*.js",
"test": "vitest",
"lint": "eslint ."
},
"devDependencies": {
"@supa-mdx-lint/eslint-config": "*",
"eslint": "^9.13.0",
"prettier": "^3.3.3"
"prettier": "^3.3.3",
"vitest": "^2.1.4"
},
"dependencies": {
"supa-mdx-lint": "*",
Expand Down
28 changes: 0 additions & 28 deletions packages/eslint-supa-mdx/tests/rule001_heading_case.js

This file was deleted.

38 changes: 38 additions & 0 deletions packages/eslint-supa-mdx/tests/rule001_heading_case.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { describe, expect, it } from "vitest";

import { ruleTester } from "./utils.js";
import rule001 from "../rules/rule001_heading_case.js";

describe("Rule001HeadingCase", () => {
it("should enforce sentence case headings", () => {
const test = () => {
ruleTester.run("Rule001HeadingCase", rule001, {
valid: [
{
code: "# Sentence case heading",
},
],
invalid: [
{
code: "# all lowercase heading",
errors: [
{
message: "Heading should be sentence case",
},
],
},
{
code: "# Title Case Heading",
errors: [
{
message: "Heading should be sentence case",
},
],
},
],
});
};

expect(test).not.toThrow();
});
});

0 comments on commit dceb33a

Please sign in to comment.