-
Notifications
You must be signed in to change notification settings - Fork 5k
bun test: report a test file or preload the loader cannot resolve instead of exiting; keep the JUnit report valid UTF-8 #38273
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?
Changes from all commits
494054a
de29575
d6f3bc6
ebc21f6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -141,7 +141,22 @@ mod bun_test { | |
| } | ||
| } | ||
|
|
||
| /// Paths, the hostname and CI env vars are raw OS bytes; the report is declared | ||
| /// UTF-8, so ill-formed sequences become U+FFFD as on the console (`bstr::BStr`). | ||
|
Comment on lines
+144
to
+145
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you need a paragraph-long comment to justify why the workaround is OK, the code is wrong — fix the code |
||
| pub(crate) fn escape_xml(str_: &[u8], writer: &mut impl bun_io::Write) -> crate::Result<()> { | ||
| if strings::is_valid_utf8(str_) { | ||
| return escape_xml_utf8(str_, writer); | ||
| } | ||
| for chunk in str_.utf8_chunks() { | ||
| escape_xml_utf8(chunk.valid().as_bytes(), writer)?; | ||
| if !chunk.invalid().is_empty() { | ||
| writer.write_all("\u{FFFD}".as_bytes())?; | ||
| } | ||
| } | ||
| Ok(()) | ||
| } | ||
|
|
||
| fn escape_xml_utf8(str_: &[u8], writer: &mut impl bun_io::Write) -> crate::Result<()> { | ||
| let mut last: usize = 0; | ||
| let mut i: usize = 0; | ||
| let len = str_.len(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -712,8 +712,8 @@ fn generate_entry_point(_vm: &VirtualMachine, watch: bool, entry_path: &[u8]) -> | |
| /// preload promise if any, else null. | ||
| /// | ||
| /// Error mapping: resolver `Failure` returns the resolver error, | ||
| /// `Pending`/`NotFound` returns `error.ModuleNotFound`, | ||
| /// `JSModuleLoader.import` throwing returns `error.JSError`. | ||
| /// `Pending`/`NotFound` returns `error.ModuleNotFound`, a load the module loader | ||
| /// refuses is a rejected promise, `error.JSError` means VM termination. | ||
|
Comment on lines
+715
to
+716
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you need a paragraph-long comment to justify why the workaround is OK, the code is wrong — fix the code |
||
| /// | ||
| /// # Safety | ||
| /// `vm` is the live per-thread VM. | ||
|
|
||
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.
If you need a paragraph-long comment to justify why the workaround is OK, the code is wrong — fix the code