Skip to content

Commit

Permalink
test: test with node 20
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Feb 20, 2024
1 parent 930fe7b commit a33a2e1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/autofix.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: autofix.ci # needed to securely identify the workflow
name: autofix.ci # needed to securely identify the workflow

on:
pull_request:
push:
branches: [ "main" ]
branches: ["main"]

permissions:
contents: read
Expand All @@ -16,11 +16,11 @@ jobs:
- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
cache: "pnpm"
- run: pnpm install
- name: Fix lint issues
run: pnpm run lint:fix
- uses: autofix-ci/action@ea32e3a12414e6d3183163c3424a7d7a8631ad84
with:
commit-message: 'chore: apply automated lint fixes'
commit-message: "chore: apply automated lint fixes"
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
cache: "pnpm"
- run: pnpm install
- run: pnpm lint
Expand Down
18 changes: 10 additions & 8 deletions test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,20 +143,22 @@ describe("destr", () => {
}
});

it("throws an error if it's a invalid JSON texts with safeDestr", () => {
describe("throws an error if it's a invalid JSON texts with safeDestr", () => {
const testCases = [
{ input: "{ ", output: "Unexpected end of JSON input" },
{ input: "{ ", output: "Expected property name or" },
{ input: "[ ", output: "Unexpected end of JSON input" },
{ input: '" ', output: "Unexpected end of JSON input" },
{ input: "[1,2,3]?", output: "Unexpected token" },
{ input: '" ', output: "Unterminated string in JSON at position" },
{ input: "[1,2,3]?", output: "Unexpected non-whitespace character" },
{ input: "invalid JSON text", output: "Invalid JSON" },
{ input: ' "Invalid', output: "Unexpected end of JSON input" },
{ input: ' "Invalid', output: "Unterminated string in JSON at position" },
];

for (const testCase of testCases) {
expect(() => safeDestr(testCase.input)).toThrowError(
testCase.output || "",
);
it(testCase.input, () => {
expect(() => safeDestr(testCase.input)).toThrowError(
testCase.output || "",
);
});
}
});

Expand Down

0 comments on commit a33a2e1

Please sign in to comment.