Skip to content

Commit

Permalink
chore(deps): update dependency vitest to v1 (#87)
Browse files Browse the repository at this point in the history
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
  • Loading branch information
renovate[bot] committed Dec 11, 2023
1 parent 9a6ec2e commit 4502a6f
Show file tree
Hide file tree
Showing 3 changed files with 403 additions and 314 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@
"devDependencies": {
"@napi-rs/cli": "^2.17.0",
"rollup": "^4.7.0",
"vitest": "^0.34.6"
"vitest": "^1.0.4"
}
}
10 changes: 5 additions & 5 deletions test/error-handling.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ test("throws useful error message when callback cleanup fails", () => {
plugin.buildEnd();

expect(() => plugin.buildEnd()).toThrowErrorMatchingInlineSnapshot(
'"Failed to cleanup callback. Unexpected Rollup lifecycle order."'
`[Error: Failed to cleanup callback. Unexpected Rollup lifecycle order.]`
);
});

test("throws useful error message when callback is missing", () => {
expect(() => localImport()).toThrowErrorMatchingInlineSnapshot(
'"Failed to reference callback. Did you pass function to `localImport(callback)`?"'
`[Error: Failed to reference callback. Did you pass function to \`localImport(callback)\`?]`
);
});

test("throws useful error message when callback is not function", () => {
expect(() => localImport(123)).toThrowErrorMatchingInlineSnapshot(
'"Failed to reference callback. Did you pass function to `localImport(callback)`?"'
`[Error: Failed to reference callback. Did you pass function to \`localImport(callback)\`?]`
);
});

Expand All @@ -39,7 +39,7 @@ test("throws useful error message when callback throws", () => {

expect(() =>
plugin.transform('import A from "./some-file";', "file.js")
).toThrowErrorMatchingInlineSnapshot('"Run into 1 error(s): [\\"Callback threw error \\\\\\"Error: Throwing some error from callback\\\\\\" when called with \\\\\\"./some-file\\\\\\"\\"]."');
).toThrowErrorMatchingInlineSnapshot(`[Error: Run into 1 error(s): ["Callback threw error \\"Error: Throwing some error from callback\\" when called with \\"./some-file\\""].]`);
});

test("includes all errors thrown by callback in error message", () => {
Expand All @@ -59,5 +59,5 @@ test("includes all errors thrown by callback in error message", () => {
`,
"file.js"
)
).toThrowErrorMatchingInlineSnapshot('"Run into 5 error(s): [\\"Callback threw error \\\\\\"Error: Throwing some error from callback\\\\\\" when called with \\\\\\"./local-file-1\\\\\\",Callback threw error \\\\\\"Error: Throwing some error from callback\\\\\\" when called with \\\\\\"./local-file-2\\\\\\",Callback threw error \\\\\\"Error: Throwing some error from callback\\\\\\" when called with \\\\\\"./local-file-3\\\\\\",Callback threw error \\\\\\"Error: Throwing some error from callback\\\\\\" when called with \\\\\\"./local-file-4\\\\\\",Callback threw error \\\\\\"Error: Throwing some error from callback\\\\\\" when called with \\\\\\"./local-file-5\\\\\\"\\"]."');
).toThrowErrorMatchingInlineSnapshot(`[Error: Run into 5 error(s): ["Callback threw error \\"Error: Throwing some error from callback\\" when called with \\"./local-file-1\\",Callback threw error \\"Error: Throwing some error from callback\\" when called with \\"./local-file-2\\",Callback threw error \\"Error: Throwing some error from callback\\" when called with \\"./local-file-3\\",Callback threw error \\"Error: Throwing some error from callback\\" when called with \\"./local-file-4\\",Callback threw error \\"Error: Throwing some error from callback\\" when called with \\"./local-file-5\\""].]`);
});
Loading

0 comments on commit 4502a6f

Please sign in to comment.