This ESLint plugin checks that arrange
, act
, and assert
comments are present in test files.
test("sample test", () => {
// arrange
setupSomething();
// act
const actual = testFunction();
// assert
expect(actual).toBe(expected);
});
npm i -D @mkizka/eslint-plugin-aaa
// eslint.config.js
import { arrangeActAssert } from "@mkizka/eslint-plugin-aaa";
export default [arrangeActAssert];
or
// eslint.config.js
import { arrangeActAssertPlugin } from "@mkizka/eslint-plugin-aaa";
export default [
{
plugins: {
aaa: arrangeActAssertPlugin,
},
rules: {
"aaa/arrange-act-assert": "warn",
},
},
];