mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 18:38:55 +00:00
* 1st revision of new util.inspect impl. (not done)
* fix util.types.isArrayBuffer
* fix some utl tests and bugs
* fix node:tty missing primordials
* fix utl stackoverflow handling & some tests
* narrow down diff. context test
* util.inspect indirect circulars optimization
* temp workaround for buggy is...Function checks
* impl. Map/Set/Iterator entries inspection
* fix bigint & symbol objects inspection
* error inspection fixes
* misc util tests stuff
* inline getExternalValue stub
* leftovers
* util.inspect promise internals
* run bun fmt
* commit make js changes
* cut out unnecessary utl files
* reorganize utl folder structure
* remove browserify buffer check
* Try to revert git messing up uws somehow
This reverts commit 2c27e16e7d.
* commit src/js/out files again
* redo this edit too
* refresh js/out files
* Removed uws submodule
* tidy up
* unused primordials
* run fmt
---------
Co-authored-by: dave caruso <me@paperdave.net>
28 lines
1.0 KiB
JavaScript
28 lines
1.0 KiB
JavaScript
import util from "util";
|
|
// Test that huge objects don't crash due to exceeding the maximum heap size.
|
|
|
|
// Create a difficult to stringify object. Without the artificial limitation
|
|
// this would crash or throw an maximum string size error.
|
|
|
|
//! This test currently relies on a non-standard extension to util.inspect
|
|
// It optimizes the output of circular objects. If that extension ends up
|
|
// being removed, this test will likely hang for a pretty long time.
|
|
// We are missing some kind of optimization Node does to pass this test near instantly even without the extension.
|
|
|
|
test("should not take longer than 2 seconds", () => {
|
|
let last = {};
|
|
const obj = last;
|
|
|
|
for (let i = 0; i < 500; i++) {
|
|
// original value: 1000 (reduced to 500 to let tests run faster)
|
|
last.next = { circular: obj, last, obj: { a: i, b: 2, c: true } };
|
|
last = last.next;
|
|
obj[i] = last;
|
|
}
|
|
|
|
const str = util.inspect(obj, { depth: Infinity, colors: false });
|
|
void str;
|
|
//console.log(str);
|
|
//console.log(str.length);
|
|
});
|