GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — TypeScriptToLua/test/setup.ts at master · TypeScriptToLua/TypeScriptToLua Expand file tree/ Copy pathsetup.tsMore file actions 48 lines (41 loc) · 1.72 KB / Copy pathsetup.tsFile metadata and controls48 lines (41 loc) · 1.72 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 import * as assert from "assert"; import * as ts from "typescript"; import * as tstl from "../src"; declare global { namespace jest { // eslint-disable-next-line @typescript-eslint/naming-convention interface Matchers<R, T> { toHaveDiagnostics(expected?: number[]): R; } } } expect.extend({ toHaveDiagnostics(diagnostics: ts.Diagnostic[], expected?: number[]): jest.CustomMatcherResult { assert.ok(Array.isArray(diagnostics)); // @ts-ignore const matcherHint = this.utils.matcherHint("toHaveDiagnostics", undefined, "", this); const diagnosticMessages = ts.formatDiagnosticsWithColorAndContext( diagnostics.map(tstl.prepareDiagnosticForFormatting), { getCurrentDirectory: () => "", getCanonicalFileName: fileName => fileName, getNewLine: () => "\n" } ); if (this.isNot && expected !== undefined) { throw new Error("expect(actual).not.toHaveDiagnostics(expected) is not supported"); } return { pass: expected ? diagnostics.length === expected.length && diagnostics.every((diag, index) => diag.code === expected[index]) : diagnostics.length > 0, message: () => { const message = this.isNot ? diagnosticMessages : expected ? `Expected:\n${expected.join("\n")}\nReceived:\n${diagnostics .map(diag => diag.code) .join("\n")}\n\n${diagnosticMessages}\n` : `Received: ${this.utils.printReceived([])}\n`; return matcherHint + "\n\n" + message; }, }; }, }); |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |