MCPcopy Create free account
hub / github.com/Dart-Code/Dart-Code / writeBrokenDartCodeIntoFileForTest

Function writeBrokenDartCodeIntoFileForTest

src/test/helpers.ts:1188–1197  ·  view source on GitHub ↗
(file: vs.Uri)

Source from the content-addressed store, hash-verified

1186}
1187
1188export async function writeBrokenDartCodeIntoFileForTest(file: vs.Uri): Promise<void> {
1189 const nextAnalysis = privateApi.nextAnalysis();
1190 fs.writeFileSync(fsPath(file), "this is broken dart code");
1191 await nextAnalysis;
1192 // HACK: Sometimes we see analysis the analysis flag toggle quickly and we get an empty error list
1193 // so we need to add a small delay here and then wait for any in progress analysis.
1194 await delay(50);
1195 await privateApi.currentAnalysis();
1196 defer("Remove broken Dart file", () => tryDelete(file));
1197}
1198
1199export function deleteFileIfExists(filePath: string) {
1200 if (fs.existsSync(filePath)) {

Callers 1

dart_cli.test.tsFile · 0.90

Calls 4

fsPathFunction · 0.90
delayFunction · 0.85
deferFunction · 0.85
tryDeleteFunction · 0.85

Tested by

no test coverage detected