Skip to content

Commit

Permalink
tsdoc, small fixups
Browse files Browse the repository at this point in the history
  • Loading branch information
SEAPUNK committed Apr 7, 2024
1 parent 8aae95d commit 3a7e963
Show file tree
Hide file tree
Showing 5 changed files with 308 additions and 79 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ module.exports = {
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
ignorePatterns: ["lib", ".eslintrc.cjs"],
parser: "@typescript-eslint/parser",
plugins: [],
plugins: ["eslint-plugin-tsdoc"],
rules: {
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
"no-constant-condition": ["error", { checkLoops: false }],
"tsdoc/syntax": "error",
},
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"@typescript-eslint/parser": "^7.5.0",
"@vitest/coverage-v8": "^1.4.0",
"eslint": "^8.57.0",
"eslint-plugin-tsdoc": "^0.2.17",
"prettier": "^3.2.5",
"typescript": "^5.4.3",
"vitest": "^1.4.0"
Expand Down
55 changes: 55 additions & 0 deletions pnpm-lock.yaml

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

6 changes: 3 additions & 3 deletions src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import recaller, {
equalJitterBackoff,
decorrelatedJitterBackoff,
} from "./";
import { expect, test } from "vitest";
import { expect, test, assert } from "vitest";

test("function should not be retried if async function is ok", async () => {
expect.assertions(1);

let called = false;

const retval = await recaller(async () => {
if (called) return expect("").toBe("Called multiple times"); // TODO: vitest
if (called) return assert.fail("Called multiple times");
called = true;
return 50;
});
Expand Down Expand Up @@ -54,7 +54,7 @@ test("bailing should work (error provided)", async () => {
let bailed = false;

const result = recaller(async (bail) => {
if (bailed) expect("").toBe("bailed, yet still caught"); // TODO: vitest
if (bailed) assert.fail("bailed, yet still caught");
if (called) {
bailed = true;
bail(new Error("bailing!"));
Expand Down
Loading

0 comments on commit 3a7e963

Please sign in to comment.