-
Notifications
You must be signed in to change notification settings - Fork 364
print error in tests when reading project fails #12377
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
base: main
Are you sure you want to change the base?
Conversation
when the project is invalid in a playwright test, the actual error is not printed, and it doesn't seem that this error makes it into the playwright report either.
Ok I'll have a look in that. Thanks |
@@ -52,6 +52,7 @@ export function findProjectOutputDir(projectdir: string | undefined) { | |||
// deno-lint-ignore no-explicit-any | |||
type = ((yaml as any).project as any).type; | |||
} catch (error) { | |||
console.error(error); | |||
throw new Error("Failed to read quarto project YAML", error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right this is not correct
It should be this, right ?
throw new Error("Failed to read quarto project YAML", error); | |
throw new Error("Failed to read quarto project YAML\n" + error); |
This would show the error wouldn't it ? No need for a previous console.log ?
Or are you saying we need because playwright hide the error ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at this more carefully, it looks like what happens is the documents still render properly and tests succeed, but then it dies in a cleanup task, only printing the stack trace but not the error.
Because we're not in Playwright at this point (I think?) the error doesn't go into the Playwright logs.
It might be better to improve the error as you say, and then catch it somewhere further up the call stack and print it there.
cc @cderv
When the project is invalid in a playwright test, the actual error is not printed. It just prints
It doesn't seem that the actual error makes it into the playwright report either.
I'm not sure if the second parameter to
new Error()
is valid; according to MDN it should be{cause: error}
.I tried this but still I could not find the actual error, so I suggest printing it instead.
What do you think?
(Background: I am new to Quarto projects, and
quarto render
will succeed if the project does not haveproject.type
, but tests will fail. I think it would be good if the error messages indicate the actual problem.)