mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
polyfills: fix FileBlob.exists() + more tests
This commit is contained in:
@@ -16,7 +16,7 @@ if (typeof process === 'object' && process !== null) {
|
||||
process.versions.c_ares = '0e7a5dee0fbb04080750cf6eabbe89d8bae87faa' satisfies Process['versions'][string];
|
||||
process.versions.zig = '0.12.0-dev.1604+caae40c21' satisfies Process['versions'][string];
|
||||
process.versions.bun = '1.0.13' satisfies Process['versions'][string];
|
||||
Reflect.set(process, 'revision', 'db7cb6fa98c68d0a7ca513623538d7f008189f0f' satisfies Process['revision']);
|
||||
Reflect.set(process, 'revision', 'b55994b0596f082ed90862f2f76539cd339478b6' satisfies Process['revision']);
|
||||
/** @end_generated_code */
|
||||
|
||||
// Doesn't work on Windows sadly
|
||||
|
||||
@@ -48,7 +48,7 @@ export const main = path.resolve(process.cwd(), process.argv[1] ?? 'repl') satis
|
||||
|
||||
//? These are automatically updated on build by tools/updateversions.ts, do not edit manually.
|
||||
export const version = '1.0.13' satisfies typeof Bun.version;
|
||||
export const revision = 'db7cb6fa98c68d0a7ca513623538d7f008189f0f' satisfies typeof Bun.revision;
|
||||
export const revision = 'b55994b0596f082ed90862f2f76539cd339478b6' satisfies typeof Bun.revision;
|
||||
|
||||
export const gc = (
|
||||
globalThis.gc
|
||||
|
||||
@@ -172,10 +172,9 @@ export class FileBlob extends Blob implements BunFileBlob {
|
||||
}
|
||||
|
||||
async exists(): Promise<boolean> {
|
||||
if (typeof this.#fdOrPath !== 'number') return fs.existsSync(this.#fdOrPath);
|
||||
try {
|
||||
fs.fstatSync(this.#fdOrPath);
|
||||
return true;
|
||||
if (typeof this.#fdOrPath !== 'number') return fs.statSync(this.#fdOrPath).isFile();
|
||||
return fs.fstatSync(this.#fdOrPath).isFile();
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -15,9 +15,27 @@ await import('../../../test/js/bun/spawn/exit-code.test.ts');
|
||||
//await import('../../../test/js/bun/spawn/spawn-streaming-stdout.test.ts');
|
||||
await import('../../../test/js/bun/spawn/spawn.test.ts');
|
||||
await import('../../../test/js/bun/sqlite/sqlite.test.ts');
|
||||
// stream
|
||||
// test
|
||||
// util
|
||||
// stream: N/A
|
||||
// test: N/A
|
||||
await import('../../../test/js/bun/util/arraybuffersink.test.ts');
|
||||
await import('../../../test/js/bun/util/bun-file-exists.test.js');
|
||||
await import('../../../test/js/bun/util/bun-isMainThread.test.js');
|
||||
await import('../../../test/js/bun/util/concat.test.js');
|
||||
// Another slow test, and not really needed for the polyfills.
|
||||
//await import('../../../test/js/bun/util/error-gc-test.test.js');
|
||||
await import('../../../test/js/bun/util/escapeHTML.test.js');
|
||||
await import('../../../test/js/bun/util/file-type.test.ts');
|
||||
// Test below currently hangs, needs investigation.
|
||||
//await import('../../../test/js/bun/util/filesink.test.ts');
|
||||
await import('../../../test/js/bun/util/fileUrl.test.js');
|
||||
await import('../../../test/js/bun/util/hash.test.js');
|
||||
await import('../../../test/js/bun/util/index-of-line.test.ts');
|
||||
// Can't run because of JSX :(
|
||||
//await import('../../../test/js/bun/util/inspect.test.js');
|
||||
await import('../../../test/js/bun/util/mmap.test.js');
|
||||
// Test below currently hangs, needs investigation.
|
||||
//await import('../../../test/js/bun/util/password.test.ts');
|
||||
await import('../../../test/js/bun/util/peek.test.ts');
|
||||
// websocket
|
||||
// globals
|
||||
|
||||
|
||||
Reference in New Issue
Block a user