-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow ignoring consoles on a case by case basis #36
Comments
Ah, How about a part of the require("console-fail-test").cft({
console: {
warn: {
allow: [/I know what I'm doing/],
},
},
}); |
@all-contributors please add @mackenco for ideas.
|
I've put up a pull request to add @mackenco! 🎉 I couldn't determine any contributions to add, did you specify any contributions? |
Adds @mackenco as a contributor for ideas. This was requested by JoshuaKGoldberg [in this comment](#36 (comment)) --------- Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
in my case manually mocking the implementation helps to both check that it("should return error if no known errors were passed", () => {
const error = new CustomError();
const callback = () => {
throw error;
};
const consoleSpy = vi
.spyOn(console, "error")
.mockImplementationOnce(() => {});
expect(catchError(callback)).toEqual([error]);
expect(consoleSpy, "should log error to console").toBeCalledWith(error);
}); |
There can be cases where we're
console.error
ing on purpose (e.g. my component tries to fetch some data -> if that fails, I'd like to log it). These will still warn in our tests though. Would be nice to have some ignore syntax, perhaps like eslint:The text was updated successfully, but these errors were encountered: