@pkg-nec/jest-core 30.4.2

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.
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) Meta Platforms, Inc. and affiliates.
4
+ Copyright Contributors to the Jest project.
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # @pkg-nec/jest-core
2
+
3
+ Jest is currently working on providing a programmatic API. This is under development, and usage of this package directly is currently not supported.
@@ -0,0 +1,112 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import {ChangedFiles} from '@pkg-nec/jest-changed-files';
9
+ import {TestPathPatternsExecutor} from '@pkg-nec/jest-pattern';
10
+ import {BaseReporter, Reporter, ReporterContext} from '@pkg-nec/jest-reporters';
11
+ import {TestRunnerContext} from '@pkg-nec/jest-runner';
12
+ import {AggregatedResult,Test,TestContext} from '@pkg-nec/jest-test-result';
13
+ import {Config} from '@pkg-nec/jest-types';
14
+ import {TestWatcher} from '@pkg-nec/jest-watcher';
15
+
16
+ export declare function createTestScheduler(
17
+ globalConfig: Config.GlobalConfig,
18
+ context: TestSchedulerContext,
19
+ ): Promise<TestScheduler>;
20
+
21
+ declare type Filter = (testPaths: Array<string>) => Promise<{
22
+ filtered: Array<string>;
23
+ }>;
24
+
25
+ export declare function getVersion(): string;
26
+
27
+ declare type ReporterConstructor = new (
28
+ globalConfig: Config.GlobalConfig,
29
+ reporterConfig: Record<string, unknown>,
30
+ reporterContext: ReporterContext,
31
+ ) => BaseReporter;
32
+
33
+ export declare function runCLI(
34
+ argv: Config.Argv,
35
+ projects: Array<string>,
36
+ ): Promise<{
37
+ results: AggregatedResult;
38
+ globalConfig: Config.GlobalConfig;
39
+ }>;
40
+
41
+ declare type SearchResult = {
42
+ noSCM?: boolean;
43
+ stats?: Stats;
44
+ collectCoverageFrom?: Set<string>;
45
+ tests: Array<Test>;
46
+ total?: number;
47
+ };
48
+
49
+ export declare class SearchSource {
50
+ private readonly _context;
51
+ private _dependencyResolver;
52
+ private readonly _testPathCases;
53
+ constructor(context: TestContext);
54
+ private _getOrBuildDependencyResolver;
55
+ private _filterTestPathsWithStats;
56
+ private _getAllTestPaths;
57
+ isTestFilePath(path: string): boolean;
58
+ findMatchingTests(
59
+ testPathPatternsExecutor: TestPathPatternsExecutor,
60
+ ): SearchResult;
61
+ findRelatedTests(
62
+ allPaths: Set<string>,
63
+ collectCoverage: boolean,
64
+ ): Promise<SearchResult>;
65
+ findTestsByPaths(paths: Array<string>): SearchResult;
66
+ findRelatedTestsFromPattern(
67
+ paths: Array<string>,
68
+ collectCoverage: boolean,
69
+ ): Promise<SearchResult>;
70
+ findTestRelatedToChangedFiles(
71
+ changedFilesInfo: ChangedFiles,
72
+ collectCoverage: boolean,
73
+ ): Promise<SearchResult>;
74
+ private _getTestPaths;
75
+ filterPathsWin32(paths: Array<string>): Array<string>;
76
+ getTestPaths(
77
+ globalConfig: Config.GlobalConfig,
78
+ projectConfig: Config.ProjectConfig,
79
+ changedFiles?: ChangedFiles,
80
+ filter?: Filter,
81
+ ): Promise<SearchResult>;
82
+ findRelatedSourcesFromTestsInChangedFiles(
83
+ changedFilesInfo: ChangedFiles,
84
+ ): Promise<Array<string>>;
85
+ }
86
+
87
+ declare type Stats = {
88
+ roots: number;
89
+ testMatch: number;
90
+ testPathIgnorePatterns: number;
91
+ testRegex: number;
92
+ testPathPatterns?: number;
93
+ };
94
+
95
+ declare class TestScheduler {
96
+ private readonly _context;
97
+ private readonly _dispatcher;
98
+ private readonly _globalConfig;
99
+ constructor(globalConfig: Config.GlobalConfig, context: TestSchedulerContext);
100
+ addReporter(reporter: Reporter): void;
101
+ removeReporter(reporterConstructor: ReporterConstructor): void;
102
+ scheduleTests(
103
+ tests: Array<Test>,
104
+ watcher: TestWatcher,
105
+ ): Promise<AggregatedResult>;
106
+ private _partitionTests;
107
+ _setupReporters(tests: Array<Test>): Promise<void>;
108
+ private _addCustomReporter;
109
+ private _bailIfNeeded;
110
+ }
111
+
112
+ declare type TestSchedulerContext = ReporterContext & TestRunnerContext;