{"record":{"id":"527073fc307484d2","repo":"microsoft/TypeScript","slug":"verifyfilecontent-in-file-filename-failed-n","errorCode":null,"errorMessage":"verifyFileContent in file '${fileName}' failed:\\n${showTextDiff(text, actual)}","messagePattern":"verifyFileContent in file '(.+?)' failed:\\\\n(.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/harness/fourslashImpl.ts","lineNumber":3049,"sourceCode":"            this.raiseError(`verifyIndentationAtPosition failed at ${lineCol} - expected: ${numberOfSpaces}, actual: ${actual}`);\r\n        }\r\n    }\r\n\r\n    public verifyCurrentLineContent(text: string): void {\r\n        const actual = this.getCurrentLineContent();\r\n        if (actual !== text) {\r\n            throw new Error(\"verifyCurrentLineContent\\n\" + displayExpectedAndActualString(text, actual, /*quoted*/ true));\r\n        }\r\n    }\r\n\r\n    public verifyCurrentFileContent(text: string): void {\r\n        this.verifyFileContent(this.activeFile.fileName, text);\r\n    }\r\n\r\n    private verifyFileContent(fileName: string, text: string) {\r\n        const actual = this.getFileContent(fileName);\r\n        if (actual !== text) {\r\n            throw new Error(`verifyFileContent in file '${fileName}' failed:\\n${showTextDiff(text, actual)}`);\r\n        }\r\n    }\r\n\r\n    public verifyFormatDocumentChangesNothing(): void {\r\n        const { fileName } = this.activeFile;\r\n        const before = this.getFileContent(fileName);\r\n        this.formatDocument();\r\n        this.verifyFileContent(fileName, before);\r\n    }\r\n\r\n    public verifyTextAtCaretIs(text: string): void {\r\n        const actual = this.getFileContent(this.activeFile.fileName).substring(this.currentCaretPosition, this.currentCaretPosition + text.length);\r\n        if (actual !== text) {\r\n            throw new Error(\"verifyTextAtCaretIs\\n\" + displayExpectedAndActualString(text, actual, /*quoted*/ true));\r\n        }\r\n    }\r\n\r\n    public verifyCurrentNameOrDottedNameSpanText(text: string): undefined {\r","sourceCodeStart":3031,"sourceCodeEnd":3067,"githubUrl":"https://github.com/microsoft/TypeScript/blob/b465fdbfe175304d9b977da137b2c178ae1091d3/src/harness/fourslashImpl.ts#L3031-L3067","documentation":"Assertion failure in the Fourslash harness. `verifyFileContent(fileName, text)` (reached via `verifyCurrentFileContent`) compares the full on-disk-in-memory content of `fileName` against `text`; on mismatch it throws an `Error` whose message runs both texts through `showTextDiff`. Like 38, this is test-only.","triggerScenarios":"A Fourslash test where the expected file content diverges from what the language service/compiler produced after edits, completions, refactors, or formatting. Triggered by `verifyCurrentFileContent`/`verifyFileContent` calls in the test body.","commonSituations":"Updating refactors/completions/formatting and forgetting to refresh Fourslash baselines; marker or `goTo.*` drift that lands the action in the wrong place; expected text with wrong line endings or trailing whitespace.","solutions":["Apply the diff from the failure message to the expected string.","Re-check that previous marker positioning put the action on the intended location.","Match line endings and trailing newline exactly (`showTextDiff` is whitespace-sensitive).","If the new output is the intended behavior, update the baseline; otherwise fix the feature."],"exampleFix":"// before\nfourshaft.verifyCurrentFileContent(\"const a = 1;\");\n// after (copy from the failure's actual block)\nfourshaft.verifyCurrentFileContent(\"const a = 1;\\nconst b = 2;\\n\");","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Refresh Fourslash baselines from the reported `actual` block.","Watch for line-ending/trailing-newline mismatches when copying expected text.","After behavioral changes, run the full Fourslash suite and triage every `verifyFileContent` failure."],"tags":["test-harness","fourslash","assertion","baseline"],"backgroundTag":null,"analyzedSha":"b465fdbfe175304d9b977da137b2c178ae1091d3","analyzedAt":"2026-08-12T05:38:42.698Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}