{"version":3,"file":"types.cjs","sources":["../src/types.ts"],"sourcesContent":["import type { prepareEnvironment } from '@gmrchk/cli-testing-library';\nimport type { Mock, SuiteCollector, TestOptions } from 'vitest';\nimport type { UserConfig } from 'vitest/config';\n\nexport type Define<T> = Exclude<T, undefined>;\n\nexport type Plugin = Exclude<\n  Define<UserConfig['plugins']>[number],\n  Promise<any> | null | undefined | false | Array<any>\n>;\n\nexport type Nomit<T, K extends keyof T> = Omit<T, K>;\n\nexport type Partialize<T, K extends keyof T> = Nomit<T, K> &\n  Partial<Pick<T, K>>;\n\nexport type ArgTests = {\n  pathTsd: string;\n  index?: number;\n  name?: string;\n  timeout?: number;\n};\n\nexport type Fn = (...args: any) => any;\n\nexport type PickBy<T, U> = {\n  [P in keyof T as T[P] extends U ? P : never]: T[P];\n};\n\nexport type NotPickBy<T, U> = {\n  [P in keyof T as T[P] extends U ? never : P]: T[P];\n};\n\nexport type PickKeysBy<T, U> = keyof PickBy<T, U>;\nexport type NotPickKeysBy<T, U> = keyof NotPickBy<T, U>;\n\nexport type PickByFn<T> = PickBy<T, (...args: any) => any>;\nexport type PickByFnKeys<T> = keyof PickByFn<T>;\n\nexport type Env = Awaited<ReturnType<typeof prepareEnvironment>>;\n\n// #region type MockFsKeys\nexport type MockFsKeys =\n  | 'writeFile'\n  | 'readFile'\n  | 'mkdir'\n  | 'rm'\n  | 'readdir'\n  | 'existsSync';\n// #endregion\n\nexport type Args = Env & {\n  mockFs: (...envs: MockFsKeys[]) => boolean;\n};\n\ntype DefFns = PickByFnKeys<Env>;\ntype Def<K extends DefFns> = [Parameters<Env[K]>, ReturnType<Env[K]>];\n\nexport type Defs = {\n  [K in DefFns]: Def<K>;\n};\n\nexport type ConfigDefs = Pick<\n  Env,\n  'readFile' | 'writeFile' | 'makeDir' | 'removeDir' | 'ls' | 'exists'\n>;\n\nexport type BuildMockFn = Mock<\n  [config: ConfigDefs, ...envs: MockFsKeys[]],\n  void\n>;\n\nexport type MockFn = (args: Args) => void;\nexport type FnString = (...args: any) => string;\n\n// #region types ReturnRunIf\nexport type DescribeFnOptional = (\n  invite: string | FnString,\n  fn?: MockFn,\n  options?: number | TestOptions | undefined,\n) => SuiteCollector;\n\nexport type DescribeFnOptionalParams = Parameters<DescribeFnOptional>;\n\nexport type DescribeFn = (\n  invite: string | FnString,\n  fn: MockFn,\n  options?: number | TestOptions | undefined,\n) => SuiteCollector;\n\nexport type DescribeFnParams = Parameters<DescribeFn>;\n\n// #region const KEYS\nexport const SIMPLE_TRUE_KEYS = [\n  'only',\n  'concurrent',\n  'sequential',\n  'shuffle',\n] as const;\nexport type SimpleFnTrueKeys = (typeof SIMPLE_TRUE_KEYS)[number];\nexport function isSimpleTrueFnKey(\n  value: unknown,\n): value is SimpleFnTrueKeys {\n  return SIMPLE_TRUE_KEYS.includes(value as any);\n}\n\nexport const SIMPLE_FALSE_KEYS = ['todo', 'skip'] as const;\nexport type SimpleFnFalseKeys = (typeof SIMPLE_FALSE_KEYS)[number];\nexport function isSimpleFalseFnKey(\n  value: unknown,\n): value is SimpleFnFalseKeys {\n  return SIMPLE_FALSE_KEYS.includes(value as any);\n}\n\nexport const SIMPLE_SIDE_EFFECT_KEYS = ['only'] as const;\nexport type SimpleFnSideEffectKeys =\n  (typeof SIMPLE_SIDE_EFFECT_KEYS)[number];\nexport function isSideEffectFnKey(\n  value: unknown,\n): value is SimpleFnSideEffectKeys {\n  return SIMPLE_SIDE_EFFECT_KEYS.includes(value as any);\n}\n\nexport const SIMPLE_NO_SIDE_EFFECT_KEYS = [\n  'sequential',\n  'shuffle',\n  'concurrent',\n  'todo',\n  'skip',\n] as const;\nexport type SimpleFnNoSideEffectKeys =\n  (typeof SIMPLE_NO_SIDE_EFFECT_KEYS)[number];\nexport function isNotSideEffectFnKey(\n  value: _SimpleFnKeys,\n): value is SimpleFnNoSideEffectKeys {\n  return SIMPLE_NO_SIDE_EFFECT_KEYS.includes(value as any);\n}\n\nexport const SIMPLE_INSIDE_EFFECT_KEYS = [\n  'shuffle',\n  'concurrent',\n] as const;\nexport type SimpleFnInsideEffectKeys =\n  (typeof SIMPLE_INSIDE_EFFECT_KEYS)[number];\nexport function isSimpleInsideEffectFnKey(\n  value: unknown,\n): value is SimpleFnInsideEffectKeys {\n  return SIMPLE_INSIDE_EFFECT_KEYS.includes(value as any);\n}\n\nexport const COMPLEX_KEYS = ['runIf', 'skipIf'] as const;\nexport type ComplexFnKeys = (typeof COMPLEX_KEYS)[number];\n\nexport const SIMPLE_KEYS = [\n  ...SIMPLE_TRUE_KEYS,\n  ...SIMPLE_FALSE_KEYS,\n] as const;\nexport type _SimpleFnKeys = (typeof SIMPLE_KEYS)[number];\n\nexport type SimpleFnKeys<T extends boolean> =\n  NoInfer<T> extends true\n    ? _SimpleFnKeys\n    : NoInfer<T> extends false\n      ? SimpleFnFalseKeys\n      : _SimpleFnKeys;\n// #endregion\n\nexport type ReturnIfTrue = DescribeFn &\n  Omit<Record<_SimpleFnKeys, DescribeFn>, 'todo'> & {\n    todo: DescribeFnOptional;\n  };\n\nexport type ReturnIfBoolean = DescribeFnOptional &\n  Record<_SimpleFnKeys, DescribeFnOptional>;\n\nexport type ReturnIfFalse = {\n  (invite: string, fn?: MockFn): SuiteCollector;\n  skip: (invite: string, fn?: MockFn) => SuiteCollector;\n  todo: (invite: string, fn?: MockFn) => SuiteCollector;\n};\n\nexport type ReturnIf<T extends boolean> =\n  NoInfer<T> extends true\n    ? ReturnIfTrue\n    : NoInfer<T> extends false\n      ? ReturnIfFalse\n      : ReturnIfBoolean;\n// #endregion\n"],"names":[],"mappings":";;AA4FA;AACa,MAAA,gBAAgB,GAAG;IAC9B,MAAM;IACN,YAAY;IACZ,YAAY;IACZ,SAAS;EACA;AAEL,SAAU,iBAAiB,CAC/B,KAAc,EAAA;AAEd,IAAA,OAAO,gBAAgB,CAAC,QAAQ,CAAC,KAAY,CAAC,CAAC;AACjD,CAAC;MAEY,iBAAiB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAW;AAErD,SAAU,kBAAkB,CAChC,KAAc,EAAA;AAEd,IAAA,OAAO,iBAAiB,CAAC,QAAQ,CAAC,KAAY,CAAC,CAAC;AAClD,CAAC;AAEY,MAAA,uBAAuB,GAAG,CAAC,MAAM,EAAW;AAGnD,SAAU,iBAAiB,CAC/B,KAAc,EAAA;AAEd,IAAA,OAAO,uBAAuB,CAAC,QAAQ,CAAC,KAAY,CAAC,CAAC;AACxD,CAAC;AAEY,MAAA,0BAA0B,GAAG;IACxC,YAAY;IACZ,SAAS;IACT,YAAY;IACZ,MAAM;IACN,MAAM;EACG;AAGL,SAAU,oBAAoB,CAClC,KAAoB,EAAA;AAEpB,IAAA,OAAO,0BAA0B,CAAC,QAAQ,CAAC,KAAY,CAAC,CAAC;AAC3D,CAAC;AAEY,MAAA,yBAAyB,GAAG;IACvC,SAAS;IACT,YAAY;EACH;AAGL,SAAU,yBAAyB,CACvC,KAAc,EAAA;AAEd,IAAA,OAAO,yBAAyB,CAAC,QAAQ,CAAC,KAAY,CAAC,CAAC;AAC1D,CAAC;MAEY,YAAY,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAW;AAG5C,MAAA,WAAW,GAAG;AACzB,IAAA,GAAG,gBAAgB;AACnB,IAAA,GAAG,iBAAiB;EACX;AA+BX;;;;;;;;;;;;;;;"}