@babel/helper-fixtures
Version:
Helper function to support fixtures
66 lines (63 loc) • 2.01 kB
TypeScript
import { InputOptions } from '@babel/core';
import { EncodedSourceMap } from '@jridgewell/gen-mapping';
interface TestIO {
loc: string | undefined;
code: string | undefined;
}
interface TestFile extends TestIO {
filename: string | undefined;
}
interface Test {
taskDir: string;
title: string;
disabled: boolean | string;
options: TaskOptions;
optionsDir: string | undefined;
doNotSetSourceType: boolean;
externalHelpers: boolean;
ignoreOutput: boolean;
stdout: TestIO;
stderr: TestIO;
exec: TestFile;
actual: TestFile;
expect: TestFile;
inputSourceMap?: EncodedSourceMap;
sourceMap: object | undefined;
sourceMapFile: TestFile;
sourceMapVisual: TestFile;
validateSourceMapVisual: boolean;
validateLogs: boolean;
}
interface TaskOptions extends InputOptions {
BABEL_8_BREAKING?: boolean;
DO_NOT_SET_SOURCE_TYPE?: boolean;
SKIP_ON_PUBLISH?: boolean;
externalHelpers?: boolean;
ignoreOutput?: boolean;
minNodeVersion?: string;
minNodeVersionTransform?: string;
sourceMap?: boolean;
os?: string | string[];
validateLogs?: boolean;
throws?: boolean | string;
SKIP_babel7plugins_babel8core?: string;
}
type Suite = {
options: TaskOptions;
tests: Test[];
title: string;
filename: string;
};
/**
* Resolve plugins/presets defined in options.json
*
* @export
* @param {{}} options the imported options.json
* @param {string} optionsDir the directory where options.json is placed
* @returns {any} options whose plugins/presets are resolved
*/
declare function resolveOptionPluginOrPreset(options: any, optionsDir: string): any;
declare function get(entryLoc: string | URL): Suite[];
declare function multiple(entryLoc: string | URL, ignore?: string[]): Record<string, Suite[]>;
declare function readFile(filename: string | undefined): string;
export { type TaskOptions, type Test, type TestFile, get as default, multiple, readFile, resolveOptionPluginOrPreset };