id
int64
0
3.78k
code
stringlengths
13
37.9k
declarations
stringlengths
16
64.6k
500
function generateTarget( project: Project, p: FsProject, options: GenerateTargetOptions ) { const { inSrc, inOut, srcExt, targetPackageStyle, packageTypeModule, isIndex, } = options; const outExt = srcExt.replace('ts', 'js').replace('x', ''); let targetIdentifier = `target-${targe...
interface Project { identifier: string; allowJs: boolean; preferSrc: boolean; typeModule: boolean; /** Use TS's new module: `nodenext` option */ useTsNodeNext: boolean; experimentalSpecifierResolutionNode: boolean; skipIgnore: boolean; }
501
function generateTarget( project: Project, p: FsProject, options: GenerateTargetOptions ) { const { inSrc, inOut, srcExt, targetPackageStyle, packageTypeModule, isIndex, } = options; const outExt = srcExt.replace('ts', 'js').replace('x', ''); let targetIdentifier = `target-${targe...
type Project = ReturnType<typeof project>;
502
function generateEntrypoints( project: Project, p: FsProject, targets: Target[] ) { /** Array of entrypoint files to be imported during the test */ let entrypoints: string[] = []; for (const entrypointExt of ['cjs', 'mjs'] as const) { // TODO consider removing this logic; deferring to conditionals in th...
interface Project { identifier: string; allowJs: boolean; preferSrc: boolean; typeModule: boolean; /** Use TS's new module: `nodenext` option */ useTsNodeNext: boolean; experimentalSpecifierResolutionNode: boolean; skipIgnore: boolean; }
503
function generateEntrypoints( project: Project, p: FsProject, targets: Target[] ) { /** Array of entrypoint files to be imported during the test */ let entrypoints: string[] = []; for (const entrypointExt of ['cjs', 'mjs'] as const) { // TODO consider removing this logic; deferring to conditionals in th...
type Project = ReturnType<typeof project>;
504
function generateEntrypoint( project: Project, p: FsProject, targets: Target[], opts: EntrypointPermutation ) { const { entrypointExt, withExt, entrypointLocation, entrypointTargetting } = opts; const entrypointFilename = `entrypoint-${entrypointSeq()}-${entrypointLocation}-to-${entrypointTargetting}${ ...
interface Project { identifier: string; allowJs: boolean; preferSrc: boolean; typeModule: boolean; /** Use TS's new module: `nodenext` option */ useTsNodeNext: boolean; experimentalSpecifierResolutionNode: boolean; skipIgnore: boolean; }
505
function generateEntrypoint( project: Project, p: FsProject, targets: Target[], opts: EntrypointPermutation ) { const { entrypointExt, withExt, entrypointLocation, entrypointTargetting } = opts; const entrypointFilename = `entrypoint-${entrypointSeq()}-${entrypointLocation}-to-${entrypointTargetting}${ ...
type Project = ReturnType<typeof project>;
506
function generateEntrypoint( project: Project, p: FsProject, targets: Target[], opts: EntrypointPermutation ) { const { entrypointExt, withExt, entrypointLocation, entrypointTargetting } = opts; const entrypointFilename = `entrypoint-${entrypointSeq()}-${entrypointLocation}-to-${entrypointTargetting}${ ...
interface EntrypointPermutation { entrypointExt: 'cjs' | 'mjs'; withExt: boolean; entrypointLocation: 'src' | 'out'; entrypointTargetting: 'src' | 'out'; }
507
async function execute(t: T, p: FsProject, entrypoints: Entrypoint[]) { // // Install ts-node and try to import all the index-* files // const service = t.context.tsNodeUnderTest.register({ projectSearchDir: p.cwd, }); process.__test_setloader__(t.context.tsNodeUnderTest.createEsmHooks(service)); fo...
type T = ExecutionContext<ctxTsNode.Ctx>;
508
add(file: File): File
interface File { path: string; content: string; }
509
(dir: DirectoryApi) => void
interface DirectoryApi { add(file: File): File; addFile(...args: Parameters<typeof file>): File; addJsonFile(...args: Parameters<typeof jsonFile>): JsonFile<any>; dir(dirPath: string, cb?: (dir: DirectoryApi) => void): DirectoryApi; }
510
function add(file: File) { file.path = Path.join(dirPath, file.path); files.push(file); return file; }
interface File { path: string; content: string; }
511
function declareTest(test: Test, testParams: TestParams) { const name = `package-json-type=${testParams.packageJsonType} allowJs=${testParams.allowJs} ${testParams.typecheckMode} tsconfig-module=${testParams.tsModuleMode}`; test(name, async (t) => { const proj = writeFixturesToFilesystem(name, testParams); ...
interface TestParams { packageJsonType: PackageJsonType; typecheckMode: typeof typecheckModes[number]; allowJs: boolean; tsModuleMode: 'NodeNext' | 'Node16'; }
512
function declareTest(test: Test, testParams: TestParams) { const name = `package-json-type=${testParams.packageJsonType} allowJs=${testParams.allowJs} ${testParams.typecheckMode} tsconfig-module=${testParams.tsModuleMode}`; test(name, async (t) => { const proj = writeFixturesToFilesystem(name, testParams); ...
type Test = TestInterface<ctxTsNode.Ctx>;
513
function declareTest(test: Test, testParams: TestParams) { const name = `package-json-type=${testParams.packageJsonType} allowJs=${testParams.allowJs} ${testParams.typecheckMode} tsconfig-module=${testParams.tsModuleMode}`; test(name, async (t) => { const proj = writeFixturesToFilesystem(name, testParams); ...
type Test = typeof test;
514
function getExtensionTreatment(ext: Extension, testParams: TestParams) { // JSX and any TS extensions get compiled. Everything is compiled in allowJs mode const isCompiled = testParams.allowJs || !ext.isJs || ext.isJsxExt; const isExecutedAsEsm = ext.forcesEsm || (!ext.forcesCjs && testParams.packageJson...
interface Extension { ext: string; jsEquivalentExt?: string; forcesCjs?: boolean; forcesEsm?: boolean; isJs?: boolean; supportsJsx?: boolean; isJsxExt?: boolean; cjsAllowsOmittingExt?: boolean; }
515
function getExtensionTreatment(ext: Extension, testParams: TestParams) { // JSX and any TS extensions get compiled. Everything is compiled in allowJs mode const isCompiled = testParams.allowJs || !ext.isJs || ext.isJsxExt; const isExecutedAsEsm = ext.forcesEsm || (!ext.forcesCjs && testParams.packageJson...
interface TestParams { packageJsonType: PackageJsonType; typecheckMode: typeof typecheckModes[number]; allowJs: boolean; tsModuleMode: 'NodeNext' | 'Node16'; }
516
function createImporter( proj: ProjectAPI, testParams: TestParams, importerParams: ImporterParams ) { const { importStyle, importerExtension } = importerParams; const name = `${importStyle} from ${importerExtension.ext}`; const importerTreatment = getExtensionTreatment( importerExtension, testParam...
interface ImporterParams { importStyle: typeof importStyles[number]; importerExtension: typeof extensions[number]; }
517
function createImporter( proj: ProjectAPI, testParams: TestParams, importerParams: ImporterParams ) { const { importStyle, importerExtension } = importerParams; const name = `${importStyle} from ${importerExtension.ext}`; const importerTreatment = getExtensionTreatment( importerExtension, testParam...
interface TestParams { packageJsonType: PackageJsonType; typecheckMode: typeof typecheckModes[number]; allowJs: boolean; tsModuleMode: 'NodeNext' | 'Node16'; }
518
function createImporter( proj: ProjectAPI, testParams: TestParams, importerParams: ImporterParams ) { const { importStyle, importerExtension } = importerParams; const name = `${importStyle} from ${importerExtension.ext}`; const importerTreatment = getExtensionTreatment( importerExtension, testParam...
type ProjectAPI = ReturnType<typeof projectInternal>;
519
function createImportee( testParams: TestParams, importeeParams: ImporteeParams ) { const { importeeExtension } = importeeParams; const importee = file(`${importeeExtension.ext}.${importeeExtension.ext}`); const treatment = getExtensionTreatment(importeeExtension, testParams); if (!treatment.isAllowed) retu...
interface TestParams { packageJsonType: PackageJsonType; typecheckMode: typeof typecheckModes[number]; allowJs: boolean; tsModuleMode: 'NodeNext' | 'Node16'; }
520
function createImportee( testParams: TestParams, importeeParams: ImporteeParams ) { const { importeeExtension } = importeeParams; const importee = file(`${importeeExtension.ext}.${importeeExtension.ext}`); const treatment = getExtensionTreatment(importeeExtension, testParams); if (!treatment.isAllowed) retu...
interface ImporteeParams { importeeExtension: typeof extensions[number]; }
521
function createReplViaApi({ registerHooks, createReplOpts, createServiceOpts, }: CreateReplViaApiOptions) { const stdin = new PassThrough(); const stdout = new PassThrough(); const stderr = new PassThrough(); const replService = tsNodeUnderTest.createRepl({ stdin, stdout, ...
interface CreateReplViaApiOptions { registerHooks: boolean; createReplOpts?: Partial<tsNodeTypes.CreateReplOptions>; createServiceOpts?: Partial<tsNodeTypes.CreateOptions>; }
522
async function upstreamTopLevelAwaitTests({ TEST_DIR, tsNodeUnderTest, }: SharedObjects) { const PROMPT = 'await repl > '; const putIn = new REPLStream(); const replService = tsNodeUnderTest.createRepl({ // @ts-ignore stdin: putIn, // @ts-ignore stdout: putIn, // @ts-ignore stderr: pu...
interface SharedObjects extends ctxTsNode.Ctx { TEST_DIR: string; }
523
( options: CreateTranspilerOptions ) => Transpiler
interface CreateTranspilerOptions { // TODO this is confusing because its only a partial Service. Rename? // Careful: must avoid stripInternal breakage by guarding with Extract<> service: Pick< Service, Extract<'config' | 'options' | 'projectLocalResolveHelper', keyof Service> >; /** * If `"transp...
524
function create(createOptions: SwcTranspilerOptions): Transpiler { const { swc, service: { config, projectLocalResolveHelper }, transpilerConfigLocalResolveHelper, nodeModuleEmitKind, } = createOptions; // Load swc compiler let swcInstance: SwcInstance; // Used later in diagnostics; merely ne...
interface SwcTranspilerOptions extends CreateTranspilerOptions { /** * swc compiler to use for compilation * Set to '@swc/wasm' to use swc's WASM compiler * Default: '@swc/core', falling back to '@swc/wasm' */ swc?: string | typeof swcWasm; }
525
function callInChild(state: BootstrapState) { const child = spawn( process.execPath, [ '--require', require.resolve('./child-require.js'), '--loader', // Node on Windows doesn't like `c:\` absolute paths here; must be `file:///c:/` pathToFileURL(require.resolve('../../child-loade...
interface BootstrapState { isInChildProcess: boolean; shouldUseChildProcess: boolean; /** * True if bootstrapping the ts-node CLI process or the direct child necessitated by `--esm`. * false if bootstrapping a subsequently `fork()`ed child. */ isCli: boolean; tsNodeScript: string; parseArgvResult: ...
526
function setFooBar(fooBar: FooBar): void;
type FooBar = Merge<FooInterface, BarType>;
527
function setFooBar(fooBar: FooBar): void;
type FooBar = InvariantOf<{ foo: number; bar: string; }>;
528
function setFooBar(fooBar: FooBar): void;
type FooBar = Spread<Foo, Bar>;
529
function setFooBar(fooBar: FooBar): void;
type FooBar = Simplify<Foo & Bar>;
530
function mergeDeep< Destination, Source, Options extends MergeDeepOptions = {}, >(destination: Destination, source: Source, options?: Options): MergeDeep<Destination, Source, Options>;
type Options = MergeExclusive<ExclusiveVariation1, ExclusiveVariation2>;
531
function mergeDeep< Destination, Source, Options extends MergeDeepOptions = {}, >(destination: Destination, source: Source, options?: Options): MergeDeep<Destination, Source, Options>;
type Options = TupleToUnion<typeof options>;
532
<TProp extends keyof Variation6Config>( config: Variation6Config, prop: TProp, ): config is SetNonNullable<Variation6Config, TProp> => Boolean(config[prop])
type Variation6Config = {a: boolean | null; b: boolean | null};
533
function lastOf<V extends readonly unknown[]>(array: V): LastArrayElement<V>;
interface V { a?: number; }
534
function consumeExtraProps(extraProps: ExtraProps): void;
type ExtraProps = GlobalThis & { readonly GLOBAL_TOKEN: string; };
535
function setConfig(config: JsonObject): void;
type JsonObject = {[Key in string]: JsonValue} & {[Key in string]?: JsonValue | undefined};
536
(_: ValidMessages): void => {}
type ValidMessages = RequireAtLeastOne< SystemMessages, 'macos' | 'linux' | 'windows' >;
537
(_: ValidMessages): void => {}
type ValidMessages = RequireAllOrNone<SystemMessages, 'macos' | 'linux'>;
538
(_: ValidMessages): void => {}
type ValidMessages = RequireExactlyOne<SystemMessages, 'macos' | 'linux'>;
539
move(position: Position): Position
type Position = {top: number; left: number};
540
move(position: Position) { return position; }
type Position = {top: number; left: number};
541
(argument: Type) => Type
type Type = Array<{x: string}> & Array<{z: number; d: {e: string; f: boolean}}>;
542
(distributedUnion: Union) => void
type Union = EmptyObject | {id: number};
543
function getStrippedPath(tryPath: TryPath): string { return tryPath.type === "index" ? dirname(tryPath.path) : tryPath.type === "file" ? tryPath.path : tryPath.type === "extension" ? removeExtension(tryPath.path) : tryPath.type === "package" ? tryPath.path : exhaustiveTypeException(try...
interface TryPath { readonly type: "file" | "extension" | "index" | "package"; readonly path: string; }
544
function configLoader({ cwd, explicitParams, tsConfigLoader = TsConfigLoader2.tsConfigLoader, }: ConfigLoaderParams): ConfigLoaderResult { if (explicitParams) { const absoluteBaseUrl = path.isAbsolute(explicitParams.baseUrl) ? explicitParams.baseUrl : path.join(cwd, explicitParams.baseUrl); ...
interface ConfigLoaderParams { cwd: string; explicitParams?: ExplicitParams; tsConfigLoader?: TsConfigLoader; }
545
function tsConfigLoader({ getEnv, cwd, loadSync = loadSyncDefault, }: TsConfigLoaderParams): TsConfigLoaderResult { const TS_NODE_PROJECT = getEnv("TS_NODE_PROJECT"); const TS_NODE_BASEURL = getEnv("TS_NODE_BASEURL"); // tsconfig.loadSync handles if TS_NODE_PROJECT is a file or directory // and also over...
interface TsConfigLoaderParams { getEnv: (key: string) => string | undefined; cwd: string; loadSync?( cwd: string, filename?: string, baseUrl?: string ): TsConfigLoaderResult; }
546
function register(params?: RegisterParams): () => void { let cwd: string | undefined; let explicitParams: ExplicitParams | undefined; if (params) { cwd = params.cwd; if (params.baseUrl || params.paths) { explicitParams = params; } } else { // eslint-disable-next-line const minimist = r...
interface RegisterParams extends ExplicitParams { /** * Defaults to `--project` CLI flag or `process.cwd()` */ cwd?: string; }
547
public runAsync(callback: StringCallback) { try { this.launchEditorAsync(() => { try { this.readTemporaryFile(); setImmediate(callback, null, this.text); } catch (readError) { setImmediate(callback, readError...
type StringCallback = (err: Error, result: string) => void;
548
public runAsync(callback: StringCallback) { try { this.launchEditorAsync(() => { try { this.readTemporaryFile(); setImmediate(callback, null, this.text); } catch (readError) { setImmediate(callback, readError...
type StringCallback = (err: Error, result: string) => void;
549
private launchEditorAsync(callback: VoidCallback) { try { const editorProcess = spawn( this.editor.bin, this.editor.args.concat([this.tempFile]), {stdio: "inherit"}); editorProcess.on("exit", (code: number) => { this.lastExi...
type VoidCallback = () => void;
550
private launchEditorAsync(callback: VoidCallback) { try { const editorProcess = spawn( this.editor.bin, this.editor.args.concat([this.tempFile]), {stdio: "inherit"}); editorProcess.on("exit", (code: number) => { this.lastExi...
type VoidCallback = () => void;
551
runAsync(callback: StringCallback): void
type StringCallback = (err: Error, result: string) => void;
552
runAsync(callback: StringCallback): void
type StringCallback = (err: Error, result: string) => void;
553
new (settings: Settings) => Provider<T>
class Settings { public readonly absolute: boolean = this._getValue(this._options.absolute, false); public readonly baseNameMatch: boolean = this._getValue(this._options.baseNameMatch, false); public readonly braceExpansion: boolean = this._getValue(this._options.braceExpansion, true); public readonly caseSensitive...
554
(error: ErrnoException) => assert.fail(error)
type ErrnoException = NodeJS.ErrnoException;
555
constructor(private readonly _options: Options = {}) { if (this.onlyDirectories) { this.onlyFiles = false; } if (this.stats) { this.objectMode = true; } }
type Options = OptionsInternal;
556
constructor(private readonly _options: Options = {}) { if (this.onlyDirectories) { this.onlyFiles = false; } if (this.stats) { this.objectMode = true; } }
type Options = { /** * Return the absolute path for entries. * * @default false */ absolute?: boolean; /** * If set to `true`, then patterns without slashes will be matched against * the basename of the path if it contains slashes. * * @default false */ baseNameMatch?: boolean; /** * Enables Ba...
557
public report(reporter: Reporter, result: SuitePackResult): void { reporter.row(result); reporter.display(); }
type SuitePackResult = { name: string; errors: number; entries: number; retries: number; measures: SuitePackMeasures; };
558
public report(reporter: Reporter, result: SuitePackResult): void { reporter.row(result); reporter.display(); }
class Reporter { private readonly _table: Table = new Table(); private readonly _log: logUpdate.LogUpdate = logUpdate.create(process.stdout); public row(result: SuitePackResult): void { this._table.cell('Name', result.name); this._table.cell(`Time, ${result.measures.time.units}`, this._formatMeasureValue(result...
559
public report(_: Reporter, result: SuitePackResult): void { this.results.push(result); }
type SuitePackResult = { name: string; errors: number; entries: number; retries: number; measures: SuitePackMeasures; };
560
public report(_: Reporter, result: SuitePackResult): void { this.results.push(result); }
class Reporter { private readonly _table: Table = new Table(); private readonly _log: logUpdate.LogUpdate = logUpdate.create(process.stdout); public row(result: SuitePackResult): void { this._table.cell('Name', result.name); this._table.cell(`Time, ${result.measures.time.units}`, this._formatMeasureValue(result...
561
public row(result: SuitePackResult): void { this._table.cell('Name', result.name); this._table.cell(`Time, ${result.measures.time.units}`, this._formatMeasureValue(result.measures.time)); this._table.cell('Time stdev, %', this._formatMeasureStdevValue(result.measures.time)); this._table.cell(`Memory, ${result.m...
type SuitePackResult = { name: string; errors: number; entries: number; retries: number; measures: SuitePackMeasures; };
562
private _formatMeasureValue(measure: Measure): string { return this._formatMeasure(measure.average); }
type Measure = { units: string; raw: number[]; average: number; stdev: number; };
563
private _formatMeasureStdevValue(measure: Measure): string { return this._formatMeasure(measure.stdev); }
type Measure = { units: string; raw: number[]; average: number; stdev: number; };
564
function isEnoentCodeError(error: ErrnoException): boolean { return error.code === 'ENOENT'; }
type ErrnoException = NodeJS.ErrnoException;
565
function escape(pattern: Pattern): Pattern { return pattern.replace(UNESCAPED_GLOB_SYMBOLS_RE, '\\$2'); }
type Pattern = string;
566
function isStaticPattern(pattern: Pattern, options: PatternTypeOptions = {}): boolean { return !isDynamicPattern(pattern, options); }
type PatternTypeOptions = { braceExpansion?: boolean; caseSensitiveMatch?: boolean; extglob?: boolean; };
567
function isStaticPattern(pattern: Pattern, options: PatternTypeOptions = {}): boolean { return !isDynamicPattern(pattern, options); }
type Pattern = string;
568
function isDynamicPattern(pattern: Pattern, options: PatternTypeOptions = {}): boolean { /** * A special case with an empty string is necessary for matching patterns that start with a forward slash. * An empty string cannot be a dynamic pattern. * For example, the pattern `/lib/*` will be spread into parts: '', ...
type PatternTypeOptions = { braceExpansion?: boolean; caseSensitiveMatch?: boolean; extglob?: boolean; };
569
function isDynamicPattern(pattern: Pattern, options: PatternTypeOptions = {}): boolean { /** * A special case with an empty string is necessary for matching patterns that start with a forward slash. * An empty string cannot be a dynamic pattern. * For example, the pattern `/lib/*` will be spread into parts: '', ...
type Pattern = string;
570
function convertToPositivePattern(pattern: Pattern): Pattern { return isNegativePattern(pattern) ? pattern.slice(1) : pattern; }
type Pattern = string;
571
function convertToNegativePattern(pattern: Pattern): Pattern { return '!' + pattern; }
type Pattern = string;
572
function isNegativePattern(pattern: Pattern): boolean { return pattern.startsWith('!') && pattern[1] !== '('; }
type Pattern = string;
573
function isPositivePattern(pattern: Pattern): boolean { return !isNegativePattern(pattern); }
type Pattern = string;
574
function isPatternRelatedToParentDirectory(pattern: Pattern): boolean { return pattern.startsWith('..') || pattern.startsWith('./..'); }
type Pattern = string;
575
function getBaseDirectory(pattern: Pattern): string { return globParent(pattern, { flipBackslashes: false }); }
type Pattern = string;
576
function hasGlobStar(pattern: Pattern): boolean { return pattern.includes(GLOBSTAR); }
type Pattern = string;
577
function endsWithSlashGlobStar(pattern: Pattern): boolean { return pattern.endsWith('/' + GLOBSTAR); }
type Pattern = string;
578
function isAffectDepthOfReadingPattern(pattern: Pattern): boolean { const basename = path.basename(pattern); return endsWithSlashGlobStar(pattern) || isStaticPattern(basename); }
type Pattern = string;
579
function expandBraceExpansion(pattern: Pattern): Pattern[] { return micromatch.braces(pattern, { expand: true, nodupes: true }); }
type Pattern = string;
580
function getPatternParts(pattern: Pattern, options: MicromatchOptions): Pattern[] { let { parts } = micromatch.scan(pattern, { ...options, parts: true }); /** * The scan method returns an empty array in some cases. * See micromatch/picomatch#58 for more details. */ if (parts.length === 0) { parts = [pa...
type Pattern = string;
581
function getPatternParts(pattern: Pattern, options: MicromatchOptions): Pattern[] { let { parts } = micromatch.scan(pattern, { ...options, parts: true }); /** * The scan method returns an empty array in some cases. * See micromatch/picomatch#58 for more details. */ if (parts.length === 0) { parts = [pa...
type MicromatchOptions = { dot?: boolean; matchBase?: boolean; nobrace?: boolean; nocase?: boolean; noext?: boolean; noglobstar?: boolean; posix?: boolean; strictSlashes?: boolean; };
582
function makeRe(pattern: Pattern, options: MicromatchOptions): PatternRe { return micromatch.makeRe(pattern, options); }
type Pattern = string;
583
function makeRe(pattern: Pattern, options: MicromatchOptions): PatternRe { return micromatch.makeRe(pattern, options); }
type MicromatchOptions = { dot?: boolean; matchBase?: boolean; nobrace?: boolean; nocase?: boolean; noext?: boolean; noglobstar?: boolean; posix?: boolean; strictSlashes?: boolean; };
584
public pattern(pattern: Pattern): this { this._segment.pattern = pattern; return this; }
type Pattern = string;
585
public build(options: MicromatchOptions = {}): PatternSegment { if (!this._segment.dynamic) { return this._segment; } return { ...this._segment, patternRe: utils.pattern.makeRe(this._segment.pattern, options) }; }
type MicromatchOptions = { dot?: boolean; matchBase?: boolean; nobrace?: boolean; nocase?: boolean; noext?: boolean; noglobstar?: boolean; posix?: boolean; strictSlashes?: boolean; };
586
public positive(pattern: Pattern): this { this._task.patterns.push(pattern); this._task.positive.push(pattern); return this; }
type Pattern = string;
587
public negative(pattern: Pattern): this { this._task.patterns.push(`!${pattern}`); this._task.negative.push(pattern); return this; }
type Pattern = string;
588
function getTestCaseTitle(test: SmokeTest): string { let title = `pattern: '${test.pattern}'`; if (test.ignore !== undefined) { title += `, ignore: '${test.ignore}'`; } if (test.broken !== undefined) { title += ` (broken - ${test.issue})`; } if (test.correct !== undefined) { title += ' (correct)'; } r...
type SmokeTest = { pattern: Pattern; ignore?: Pattern; cwd?: string; globOptions?: glob.IOptions; globFilter?: (entry: string, filepath: string) => boolean; globTransform?: (entry: string) => string; fgOptions?: Options; /** * Allow to run only one test case with debug information. */ debug?: boolean; /**...
589
function getTestCaseMochaDefinition(test: SmokeTest): MochaDefinition { if (test.debug === true) { return it.only; } if (test.condition?.() === false) { return it.skip; } return it; }
type SmokeTest = { pattern: Pattern; ignore?: Pattern; cwd?: string; globOptions?: glob.IOptions; globFilter?: (entry: string, filepath: string) => boolean; globTransform?: (entry: string) => string; fgOptions?: Options; /** * Allow to run only one test case with debug information. */ debug?: boolean; /**...
590
async function testCaseRunner(test: SmokeTest, func: typeof getFastGlobEntriesSync | typeof getFastGlobEntriesAsync): Promise<void> { const expected = getNodeGlobEntries(test); const actual = await func(test.pattern, test.ignore, test.cwd, test.fgOptions); if (test.debug === true) { const report = generateDebugRe...
type SmokeTest = { pattern: Pattern; ignore?: Pattern; cwd?: string; globOptions?: glob.IOptions; globFilter?: (entry: string, filepath: string) => boolean; globTransform?: (entry: string) => string; fgOptions?: Options; /** * Allow to run only one test case with debug information. */ debug?: boolean; /**...
591
function getNodeGlobEntries(options: SmokeTest): string[] { const pattern = options.pattern; const cwd = options.cwd === undefined ? process.cwd() : options.cwd; const ignore = options.ignore === undefined ? [] : [options.ignore]; const globFilter = options.globFilter; const globTransform = options.globTransform; ...
type SmokeTest = { pattern: Pattern; ignore?: Pattern; cwd?: string; globOptions?: glob.IOptions; globFilter?: (entry: string, filepath: string) => boolean; globTransform?: (entry: string) => string; fgOptions?: Options; /** * Allow to run only one test case with debug information. */ debug?: boolean; /**...
592
function getFastGlobEntriesSync(pattern: Pattern, ignore?: Pattern, cwd?: string, options?: Options): string[] { return fg.sync(pattern, getFastGlobOptions(ignore, cwd, options)).sort((a, b) => a.localeCompare(b)); }
type Pattern = string;
593
function getFastGlobEntriesSync(pattern: Pattern, ignore?: Pattern, cwd?: string, options?: Options): string[] { return fg.sync(pattern, getFastGlobOptions(ignore, cwd, options)).sort((a, b) => a.localeCompare(b)); }
type Options = OptionsInternal;
594
function getFastGlobEntriesSync(pattern: Pattern, ignore?: Pattern, cwd?: string, options?: Options): string[] { return fg.sync(pattern, getFastGlobOptions(ignore, cwd, options)).sort((a, b) => a.localeCompare(b)); }
type Options = { /** * Return the absolute path for entries. * * @default false */ absolute?: boolean; /** * If set to `true`, then patterns without slashes will be matched against * the basename of the path if it contains slashes. * * @default false */ baseNameMatch?: boolean; /** * Enables Ba...
595
function getFastGlobEntriesAsync(pattern: Pattern, ignore?: Pattern, cwd?: string, options?: Options): Promise<string[]> { return fg(pattern, getFastGlobOptions(ignore, cwd, options)).then((entries) => { entries.sort((a, b) => a.localeCompare(b)); return entries; }); }
type Pattern = string;
596
function getFastGlobEntriesAsync(pattern: Pattern, ignore?: Pattern, cwd?: string, options?: Options): Promise<string[]> { return fg(pattern, getFastGlobOptions(ignore, cwd, options)).then((entries) => { entries.sort((a, b) => a.localeCompare(b)); return entries; }); }
type Options = OptionsInternal;
597
function getFastGlobEntriesAsync(pattern: Pattern, ignore?: Pattern, cwd?: string, options?: Options): Promise<string[]> { return fg(pattern, getFastGlobOptions(ignore, cwd, options)).then((entries) => { entries.sort((a, b) => a.localeCompare(b)); return entries; }); }
type Options = { /** * Return the absolute path for entries. * * @default false */ absolute?: boolean; /** * If set to `true`, then patterns without slashes will be matched against * the basename of the path if it contains slashes. * * @default false */ baseNameMatch?: boolean; /** * Enables Ba...
598
function getFastGlobEntriesStream(pattern: Pattern, ignore?: Pattern, cwd?: string, options?: Options): Promise<string[]> { const entries: string[] = []; const stream = fg.stream(pattern, getFastGlobOptions(ignore, cwd, options)); return new Promise((resolve, reject) => { stream.on('data', (entry: string) => ent...
type Pattern = string;
599
function getFastGlobEntriesStream(pattern: Pattern, ignore?: Pattern, cwd?: string, options?: Options): Promise<string[]> { const entries: string[] = []; const stream = fg.stream(pattern, getFastGlobOptions(ignore, cwd, options)); return new Promise((resolve, reject) => { stream.on('data', (entry: string) => ent...
type Options = OptionsInternal;