@isentinel/jest-roblox 0.0.8 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import { ReportOptions } from "istanbul-reports";
2
2
 
3
- //#region ../../node_modules/.pnpm/@rbxts+jest@3.13.3-ts.1/node_modules/@rbxts/jest/src/config.d.ts
3
+ //#region node_modules/.pnpm/@rbxts+jest@3.13.3-ts.1/node_modules/@rbxts/jest/src/config.d.ts
4
4
  interface ReporterConfig {
5
5
  reporter: string | ModuleScript;
6
6
  options?: Record<string, any>;
@@ -57,7 +57,7 @@ type Argv = Partial<{
57
57
  version: boolean;
58
58
  }>;
59
59
  //#endregion
60
- //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/is-any.d.ts
60
+ //#region node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/is-any.d.ts
61
61
  /**
62
62
  Returns a boolean for whether the given type is `any`.
63
63
 
@@ -88,7 +88,7 @@ const anyA = get(anyObject, 'a');
88
88
  */
89
89
  type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
90
90
  //#endregion
91
- //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/is-optional-key-of.d.ts
91
+ //#region node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/is-optional-key-of.d.ts
92
92
  /**
93
93
  Returns a boolean for whether the given key is an optional key of type.
94
94
 
@@ -131,7 +131,7 @@ type T5 = IsOptionalKeyOf<User | Admin, 'surname'>;
131
131
  */
132
132
  type IsOptionalKeyOf<Type extends object, Key extends keyof Type> = IsAny<Type | Key> extends true ? never : Key extends keyof Type ? Type extends Record<Key, Type[Key]> ? false : true : false;
133
133
  //#endregion
134
- //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/optional-keys-of.d.ts
134
+ //#region node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/optional-keys-of.d.ts
135
135
  /**
136
136
  Extract all optional keys from the given type.
137
137
 
@@ -169,7 +169,7 @@ type OptionalKeysOf<Type extends object> = Type extends unknown // For distribut
169
169
  ? (keyof { [Key in keyof Type as IsOptionalKeyOf<Type, Key> extends false ? never : Key]: never }) & keyof Type // Intersect with `keyof Type` to ensure result of `OptionalKeysOf<Type>` is always assignable to `keyof Type`
170
170
  : never;
171
171
  //#endregion
172
- //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/required-keys-of.d.ts
172
+ //#region node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/required-keys-of.d.ts
173
173
  /**
174
174
  Extract all required keys from the given type.
175
175
 
@@ -197,7 +197,7 @@ const validator2 = createValidation<User>('surname', value => value.length < 25)
197
197
  type RequiredKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
198
198
  ? Exclude<keyof Type, OptionalKeysOf<Type>> : never;
199
199
  //#endregion
200
- //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/is-never.d.ts
200
+ //#region node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/is-never.d.ts
201
201
  /**
202
202
  Returns a boolean for whether the given type is `never`.
203
203
 
@@ -241,7 +241,7 @@ endIfEqual('abc', '123');
241
241
  */
242
242
  type IsNever<T> = [T] extends [never] ? true : false;
243
243
  //#endregion
244
- //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/if.d.ts
244
+ //#region node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/if.d.ts
245
245
  /**
246
246
  An if-else-like type that resolves depending on whether the given `boolean` type is `true` or `false`.
247
247
 
@@ -336,7 +336,7 @@ type Works = IncludesWithoutIf<HundredZeroes, '1'>;
336
336
  */
337
337
  type If<Type extends boolean, IfBranch, ElseBranch> = IsNever<Type> extends true ? ElseBranch : Type extends true ? IfBranch : ElseBranch;
338
338
  //#endregion
339
- //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/simplify.d.ts
339
+ //#region node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/simplify.d.ts
340
340
  /**
341
341
  Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.
342
342
 
@@ -396,7 +396,7 @@ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface`
396
396
  */
397
397
  type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
398
398
  //#endregion
399
- //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/is-equal.d.ts
399
+ //#region node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/is-equal.d.ts
400
400
  /**
401
401
  Returns a boolean for whether the two given types are equal.
402
402
 
@@ -427,7 +427,7 @@ type IsEqual<A, B> = [A, B] extends [infer AA, infer BB] ? [AA] extends [never]
427
427
  // This version fails the `equalWrappedTupleIntersectionToBeNeverAndNeverExpanded` test in `test-d/is-equal.ts`.
428
428
  type _IsEqual<A, B> = (<G>() => G extends A & G | G ? 1 : 2) extends (<G>() => G extends B & G | G ? 1 : 2) ? true : false;
429
429
  //#endregion
430
- //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/omit-index-signature.d.ts
430
+ //#region node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/omit-index-signature.d.ts
431
431
  /**
432
432
  Omit any index signatures from the given object type, leaving only explicitly defined properties.
433
433
 
@@ -520,7 +520,7 @@ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
520
520
  */
521
521
  type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType] };
522
522
  //#endregion
523
- //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/pick-index-signature.d.ts
523
+ //#region node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/pick-index-signature.d.ts
524
524
  /**
525
525
  Pick only index signatures from the given object type, leaving out all explicitly defined properties.
526
526
 
@@ -568,7 +568,7 @@ type ExampleIndexSignature = PickIndexSignature<Example>;
568
568
  */
569
569
  type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType] };
570
570
  //#endregion
571
- //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/merge.d.ts
571
+ //#region node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/merge.d.ts
572
572
  // Merges two objects without worrying about index signatures.
573
573
  type SimpleMerge<Destination, Source> = { [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key] } & Source;
574
574
  /**
@@ -607,7 +607,7 @@ export type FooBar = Merge<Foo, Bar>;
607
607
  */
608
608
  type Merge<Destination, Source> = Simplify<SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>> & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>>;
609
609
  //#endregion
610
- //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/internal/object.d.ts
610
+ //#region node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/internal/object.d.ts
611
611
  /**
612
612
  Merges user specified options with default options.
613
613
 
@@ -662,7 +662,7 @@ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOp
662
662
  */
663
663
  type ApplyDefaultOptions<Options extends object, Defaults extends Simplify<Omit<Required<Options>, RequiredKeysOf<Options>> & Partial<Record<RequiredKeysOf<Options>, never>>>, SpecifiedOptions extends Options> = If<IsAny<SpecifiedOptions>, Defaults, If<IsNever<SpecifiedOptions>, Defaults, Simplify<Merge<Defaults, { [Key in keyof SpecifiedOptions as Key extends OptionalKeysOf<Options> ? undefined extends SpecifiedOptions[Key] ? never : Key : Key]: SpecifiedOptions[Key] }> & Required<Options>>>>;
664
664
  //#endregion
665
- //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/except.d.ts
665
+ //#region node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/except.d.ts
666
666
  /**
667
667
  Filter out keys from an object.
668
668
 
@@ -759,7 +759,7 @@ type Except<ObjectType, KeysType extends keyof ObjectType, Options extends Excep
759
759
  type _Except<ObjectType, KeysType extends keyof ObjectType, Options extends Required<ExceptOptions>> = { [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType] } & (Options['requireExactProps'] extends true ? Partial<Record<KeysType, never>> : {});
760
760
  //#endregion
761
761
  //#region src/config/schema.d.ts
762
- type Backend = "auto" | "open-cloud" | "studio";
762
+ type Backend$1 = "auto" | "open-cloud" | "studio";
763
763
  type CoverageReporter = keyof ReportOptions;
764
764
  type FormatterEntry = [string, Record<string, unknown>] | string;
765
765
  interface SnapshotFormatOptions {
@@ -772,13 +772,45 @@ interface SnapshotFormatOptions {
772
772
  printBasicPrototype?: boolean;
773
773
  printFunctionName?: boolean;
774
774
  }
775
- interface Config extends Except<Argv, "rootDir" | "setupFiles" | "setupFilesAfterEnv" | "testPathPattern"> {
776
- backend?: Backend;
775
+ declare const ROOT_ONLY_KEYS: ReadonlySet<string>;
776
+ interface DisplayName {
777
+ name: string;
778
+ color: string;
779
+ }
780
+ interface ProjectTestConfig {
781
+ automock?: boolean;
782
+ clearMocks?: boolean;
783
+ displayName: DisplayName | string;
784
+ exclude?: Array<string>;
785
+ include: Array<string>;
786
+ injectGlobals?: boolean;
787
+ mockDataModel?: boolean;
788
+ outDir?: string;
789
+ resetMocks?: boolean;
790
+ resetModules?: boolean;
791
+ restoreMocks?: boolean;
792
+ root?: string;
793
+ setupFiles?: Array<string>;
794
+ setupFilesAfterEnv?: Array<string>;
795
+ slowTestThreshold?: number;
796
+ snapshotFormat?: SnapshotFormatOptions;
797
+ snapshotSerializers?: Array<string>;
798
+ testEnvironment?: string;
799
+ testEnvironmentOptions?: Record<string, unknown>;
800
+ testMatch?: Array<string>;
801
+ testPathIgnorePatterns?: Array<string>;
802
+ testRegex?: Array<string> | string;
803
+ testTimeout?: number;
804
+ }
805
+ interface InlineProjectConfig {
806
+ test: ProjectTestConfig;
807
+ }
808
+ type ProjectEntry = InlineProjectConfig | string;
809
+ interface Config extends Except<Argv, "projects" | "rootDir" | "setupFiles" | "setupFilesAfterEnv" | "testPathPattern"> {
810
+ backend?: Backend$1;
777
811
  cache?: boolean;
778
812
  collectCoverage?: boolean;
779
813
  collectCoverageFrom?: Array<string>;
780
- compact?: boolean;
781
- compactMaxFailures?: number;
782
814
  coverageDirectory?: string;
783
815
  coveragePathIgnorePatterns?: Array<string>;
784
816
  coverageReporters?: Array<CoverageReporter>;
@@ -788,6 +820,7 @@ interface Config extends Except<Argv, "rootDir" | "setupFiles" | "setupFilesAfte
788
820
  lines?: number;
789
821
  statements?: number;
790
822
  };
823
+ extends?: Array<string> | string;
791
824
  formatters?: Array<FormatterEntry>;
792
825
  gameOutput?: string;
793
826
  jestPath?: string;
@@ -795,6 +828,7 @@ interface Config extends Except<Argv, "rootDir" | "setupFiles" | "setupFilesAfte
795
828
  placeFile?: string;
796
829
  pollInterval?: number;
797
830
  port?: number;
831
+ projects?: Array<ProjectEntry>;
798
832
  reporters?: Array<string>;
799
833
  rojoProject?: string;
800
834
  rootDir?: string;
@@ -810,17 +844,14 @@ interface Config extends Except<Argv, "rootDir" | "setupFiles" | "setupFilesAfte
810
844
  typecheckTsconfig?: string;
811
845
  updateSnapshot?: boolean;
812
846
  }
813
- interface ResolvedConfig extends Config {
814
- backend: Backend;
847
+ interface ResolvedConfig extends Except<Config, "projects"> {
848
+ backend: Backend$1;
815
849
  cache: boolean;
816
850
  collectCoverage: boolean;
817
851
  color: boolean;
818
- compact: boolean;
819
- compactMaxFailures: number;
820
852
  coverageDirectory: string;
821
853
  coveragePathIgnorePatterns: Array<string>;
822
854
  coverageReporters: Array<CoverageReporter>;
823
- json: boolean;
824
855
  placeFile: string;
825
856
  pollInterval: number;
826
857
  port: number;
@@ -837,14 +868,14 @@ interface ResolvedConfig extends Config {
837
868
  typecheckTsconfig?: string;
838
869
  verbose: boolean;
839
870
  }
871
+ type MergerFunction<T> = (defaults: T) => T;
872
+ type Mergeable<T> = MergerFunction<T> | T;
840
873
  declare const DEFAULT_CONFIG: ResolvedConfig;
841
874
  interface CliOptions {
842
- backend?: Backend;
875
+ backend?: Backend$1;
843
876
  cache?: boolean;
844
877
  collectCoverage?: boolean;
845
878
  color?: boolean;
846
- compact?: boolean;
847
- compactMaxFailures?: number;
848
879
  config?: string;
849
880
  coverageDirectory?: string;
850
881
  coverageReporters?: Array<CoverageReporter>;
@@ -852,11 +883,10 @@ interface CliOptions {
852
883
  formatters?: Array<string>;
853
884
  gameOutput?: string;
854
885
  help?: boolean;
855
- json?: boolean;
856
886
  outputFile?: string;
857
887
  pollInterval?: number;
858
888
  port?: number;
859
- projects?: Array<string>;
889
+ project?: Array<string>;
860
890
  reporters?: Array<string>;
861
891
  rojoProject?: string;
862
892
  setupFiles?: Array<string>;
@@ -874,6 +904,181 @@ interface CliOptions {
874
904
  verbose?: boolean;
875
905
  version?: boolean;
876
906
  }
877
- declare const defineConfig: (input: Config) => Config;
907
+ interface ConfigInput extends Except<Config, "collectCoverageFrom" | "coveragePathIgnorePatterns" | "coverageReporters" | "formatters" | "luauRoots" | "reporters" | "setupFiles" | "setupFilesAfterEnv" | "testMatch" | "testPathIgnorePatterns"> {
908
+ collectCoverageFrom?: Mergeable<Array<string>>;
909
+ coveragePathIgnorePatterns?: Mergeable<Array<string>>;
910
+ coverageReporters?: Mergeable<Array<CoverageReporter>>;
911
+ formatters?: Mergeable<Array<FormatterEntry>>;
912
+ luauRoots?: Mergeable<Array<string>>;
913
+ reporters?: Mergeable<Array<string>>;
914
+ setupFiles?: Mergeable<Array<string>>;
915
+ setupFilesAfterEnv?: Mergeable<Array<string>>;
916
+ testMatch?: Mergeable<Array<string>>;
917
+ testPathIgnorePatterns?: Mergeable<Array<string>>;
918
+ }
919
+ declare const defineConfig: (input: ConfigInput) => ConfigInput;
920
+ declare const defineProject: (input: ProjectTestConfig) => ProjectTestConfig;
921
+ //#endregion
922
+ //#region src/config/projects.d.ts
923
+ interface ResolvedProjectConfig {
924
+ config: ResolvedConfig;
925
+ displayColor?: string;
926
+ displayName: string;
927
+ /** Original include patterns (with TS extensions) for filesystem discovery. */
928
+ include: Array<string>;
929
+ /** Resolved output directory (workspace-relative) for stub generation. */
930
+ outDir?: string;
931
+ /** DataModel paths for Jest execution. */
932
+ projects: Array<string>;
933
+ /** Luau-side testMatch patterns (extensions stripped). */
934
+ testMatch: Array<string>;
935
+ }
936
+ //#endregion
937
+ //#region src/coverage/types.d.ts
938
+ /**
939
+ * Raw hit counts for a single file, keyed by statement/function index.
940
+ */
941
+ interface RawFileCoverage {
942
+ b?: Record<string, Array<number>>;
943
+ f?: Record<string, number>;
944
+ s: Record<string, number>;
945
+ }
946
+ /**
947
+ * Raw coverage data for all files, keyed by original Luau-relative path.
948
+ */
949
+ type RawCoverageData = Record<string, RawFileCoverage>;
950
+ //#endregion
951
+ //#region src/types/jest-result.d.ts
952
+ type TestStatus = "disabled" | "failed" | "passed" | "pending" | "skipped" | "todo";
953
+ interface TestCaseResult {
954
+ ancestorTitles: Array<string>;
955
+ duration?: number;
956
+ failureMessages: Array<string>;
957
+ fullName: string;
958
+ location?: {
959
+ column: number;
960
+ line: number;
961
+ };
962
+ numPassingAsserts?: number;
963
+ retryReasons?: Array<string>;
964
+ status: TestStatus;
965
+ title: string;
966
+ }
967
+ interface TestFileResult {
968
+ failureMessage?: string;
969
+ numFailingTests: number;
970
+ numPassingTests: number;
971
+ numPendingTests: number;
972
+ testFilePath: string;
973
+ testResults: Array<TestCaseResult>;
974
+ }
975
+ interface SnapshotSummary {
976
+ added: number;
977
+ matched: number;
978
+ total: number;
979
+ unmatched: number;
980
+ updated: number;
981
+ }
982
+ interface JestResult {
983
+ numFailedTests: number;
984
+ numPassedTests: number;
985
+ numPendingTests: number;
986
+ numTodoTests?: number;
987
+ numTotalTests: number;
988
+ snapshot?: SnapshotSummary;
989
+ startTime: number;
990
+ success: boolean;
991
+ testResults: Array<TestFileResult>;
992
+ }
993
+ //#endregion
994
+ //#region src/reporter/parser.d.ts
995
+ type SnapshotWrites = Record<string, string>;
996
+ interface ParseResult {
997
+ coverageData?: RawCoverageData;
998
+ luauTiming?: Record<string, number>;
999
+ result: JestResult;
1000
+ snapshotWrites?: SnapshotWrites;
1001
+ }
1002
+ declare function extractJsonFromOutput(output: string): string | undefined;
1003
+ declare function parseJestOutput(output: string): ParseResult;
1004
+ //#endregion
1005
+ //#region src/backends/interface.d.ts
1006
+ interface BackendOptions {
1007
+ config: ResolvedConfig;
1008
+ testFiles: Array<string>;
1009
+ }
1010
+ interface BackendTiming {
1011
+ executionMs: number;
1012
+ uploadCached?: boolean;
1013
+ uploadMs?: number;
1014
+ }
1015
+ interface BackendResult {
1016
+ coverageData?: RawCoverageData;
1017
+ gameOutput?: string;
1018
+ luauTiming?: Record<string, number>;
1019
+ result: JestResult;
1020
+ snapshotWrites?: SnapshotWrites;
1021
+ timing: BackendTiming;
1022
+ }
1023
+ interface Backend {
1024
+ runTests(options: BackendOptions): Promise<BackendResult>;
1025
+ }
1026
+ //#endregion
1027
+ //#region src/source-mapper/index.d.ts
1028
+ interface MappedLocation {
1029
+ luauLine: number;
1030
+ luauPath: string;
1031
+ sourceContent?: string;
1032
+ tsColumn?: number;
1033
+ tsLine?: number;
1034
+ tsPath?: string;
1035
+ }
1036
+ interface MappedFailure {
1037
+ locations: Array<MappedLocation>;
1038
+ message: string;
1039
+ }
1040
+ interface SourceMapper {
1041
+ mapFailureMessage(message: string): string;
1042
+ mapFailureWithLocations(message: string): MappedFailure;
1043
+ resolveTestFilePath(testFilePath: string): string | undefined;
1044
+ }
1045
+ //#endregion
1046
+ //#region src/types/timing.d.ts
1047
+ interface TimingResult {
1048
+ coverageMs?: number;
1049
+ executionMs: number;
1050
+ startTime: number;
1051
+ testsMs: number;
1052
+ totalMs: number;
1053
+ uploadCached?: boolean;
1054
+ uploadMs?: number;
1055
+ }
1056
+ //#endregion
1057
+ //#region src/executor.d.ts
1058
+ interface ExecuteOptions {
1059
+ backend: Backend;
1060
+ config: ResolvedConfig;
1061
+ deferFormatting?: boolean;
1062
+ testFiles: Array<string>;
1063
+ version: string;
1064
+ }
1065
+ interface ExecuteResult {
1066
+ coverageData?: RawCoverageData;
1067
+ exitCode: number;
1068
+ gameOutput?: string;
1069
+ output: string;
1070
+ result: JestResult;
1071
+ sourceMapper?: SourceMapper;
1072
+ timing: TimingResult;
1073
+ }
1074
+ interface FormatOutputOptions {
1075
+ config: ResolvedConfig;
1076
+ result: JestResult;
1077
+ sourceMapper?: SourceMapper;
1078
+ timing: TimingResult;
1079
+ version: string;
1080
+ }
1081
+ declare function formatExecuteOutput(options: FormatOutputOptions): string;
1082
+ declare function execute(options: ExecuteOptions): Promise<ExecuteResult>;
878
1083
  //#endregion
879
- export { ResolvedConfig as a, Argv as c, FormatterEntry as i, Config as n, SnapshotFormatOptions as o, DEFAULT_CONFIG as r, defineConfig as s, CliOptions as t };
1084
+ export { defineConfig as A, FormatterEntry as C, ROOT_ONLY_KEYS as D, ProjectTestConfig as E, Argv as M, ResolvedConfig as O, DisplayName as S, ProjectEntry as T, ResolvedProjectConfig as _, formatExecuteOutput as a, ConfigInput as b, Backend as c, extractJsonFromOutput as d, parseJestOutput as f, TestStatus as g, TestFileResult as h, execute as i, defineProject as j, SnapshotFormatOptions as k, BackendOptions as l, TestCaseResult as m, ExecuteResult as n, TimingResult as o, JestResult as p, FormatOutputOptions as r, SourceMapper as s, ExecuteOptions as t, BackendResult as u, CliOptions as v, InlineProjectConfig as w, DEFAULT_CONFIG as x, Config as y };