UNPKG

ts-snippet

Version:

A TypeScript snippet testing library for any test framework

14 lines (13 loc) 525 B
import { Compiler } from "./compiler"; import { snippet } from "./snippet"; export function expecter(factory, compilerOrOptions, rootDirectory) { if (factory === void 0) { factory = function (code) { return code; }; } var compiler = compilerOrOptions instanceof Compiler ? compilerOrOptions : new Compiler(compilerOrOptions, rootDirectory); return function (code) { return snippet({ "snippet.ts": factory(code), }, compiler).expect("snippet.ts"); }; }