|
1 | 1 | import { fileURLToPath, $ as Shell } from "bun"; |
2 | 2 | import { afterAll, beforeAll, describe, expect, test } from "bun:test"; |
3 | | -import { existsSync, readFileSync } from "node:fs"; |
| 3 | +import { readFileSync } from "node:fs"; |
4 | 4 | import { cp, mkdtemp, rm } from "node:fs/promises"; |
5 | 5 | import { tmpdir } from "node:os"; |
6 | 6 | import { dirname, join, relative } from "node:path"; |
@@ -113,23 +113,22 @@ async function diagnose( |
113 | 113 | const host: ts.LanguageServiceHost = { |
114 | 114 | getScriptFileNames: () => files, |
115 | 115 | getScriptVersion: () => "0", |
116 | | - getScriptSnapshot: fileName => { |
| 116 | + getScriptSnapshot: absolutePath => { |
117 | 117 | if (extraFiles) { |
118 | | - const relativePath = relative(fixtureDir, fileName); |
| 118 | + const relativePath = relative(fixtureDir, absolutePath); |
119 | 119 | if (relativePath in extraFiles) { |
120 | 120 | return ts.ScriptSnapshot.fromString(extraFiles[relativePath]); |
121 | 121 | } |
122 | 122 | } |
123 | 123 |
|
124 | | - if (!existsSync(fileName)) { |
125 | | - return undefined; |
126 | | - } |
127 | | - |
128 | | - return ts.ScriptSnapshot.fromString(readFileSync(fileName).toString()); |
| 124 | + return ts.ScriptSnapshot.fromString(readFileSync(absolutePath).toString()); |
129 | 125 | }, |
130 | 126 | getCurrentDirectory: () => fixtureDir, |
131 | 127 | getCompilationSettings: () => options, |
132 | | - getDefaultLibFileName: options => ts.getDefaultLibFilePath(options), |
| 128 | + getDefaultLibFileName: options => { |
| 129 | + const defaultLibFileName = ts.getDefaultLibFileName(options); |
| 130 | + return join(fixtureDir, "node_modules", "typescript", "lib", defaultLibFileName); |
| 131 | + }, |
133 | 132 | fileExists: ts.sys.fileExists, |
134 | 133 | readFile: ts.sys.readFile, |
135 | 134 | readDirectory: ts.sys.readDirectory, |
@@ -360,32 +359,32 @@ describe("@types/bun integration test", () => { |
360 | 359 | code: 2339, |
361 | 360 | }, |
362 | 361 | { |
363 | | - line: "streams.ts:16:3", |
| 362 | + line: "streams.ts:18:3", |
364 | 363 | message: "No overload matches this call.", |
365 | 364 | code: 2769, |
366 | 365 | }, |
367 | 366 | { |
368 | | - line: "streams.ts:18:16", |
| 367 | + line: "streams.ts:20:16", |
369 | 368 | message: "Property 'write' does not exist on type 'ReadableByteStreamController'.", |
370 | 369 | code: 2339, |
371 | 370 | }, |
372 | 371 | { |
373 | | - line: "streams.ts:44:19", |
| 372 | + line: "streams.ts:46:19", |
374 | 373 | message: "Property 'json' does not exist on type 'ReadableStream<Uint8Array<ArrayBufferLike>>'.", |
375 | 374 | code: 2339, |
376 | 375 | }, |
377 | 376 | { |
378 | | - line: "streams.ts:45:19", |
| 377 | + line: "streams.ts:47:19", |
379 | 378 | message: "Property 'bytes' does not exist on type 'ReadableStream<Uint8Array<ArrayBufferLike>>'.", |
380 | 379 | code: 2339, |
381 | 380 | }, |
382 | 381 | { |
383 | | - line: "streams.ts:46:19", |
| 382 | + line: "streams.ts:48:19", |
384 | 383 | message: "Property 'text' does not exist on type 'ReadableStream<Uint8Array<ArrayBufferLike>>'.", |
385 | 384 | code: 2339, |
386 | 385 | }, |
387 | 386 | { |
388 | | - line: "streams.ts:47:19", |
| 387 | + line: "streams.ts:49:19", |
389 | 388 | message: "Property 'blob' does not exist on type 'ReadableStream<Uint8Array<ArrayBufferLike>>'.", |
390 | 389 | code: 2339, |
391 | 390 | }, |
|
0 commit comments