@pkg-nec/jest-config 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.
@@ -0,0 +1,201 @@
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 {Config} from '@pkg-nec/jest-types';
9
+ import {DeprecatedOptions} from '@pkg-nec/jest-validate';
10
+
11
+ declare type AllOptions = Config.ProjectConfig & Config.GlobalConfig;
12
+
13
+ declare namespace constants {
14
+ export {
15
+ NODE_MODULES,
16
+ DEFAULT_JS_PATTERN,
17
+ PACKAGE_JSON,
18
+ JEST_CONFIG_BASE_NAME,
19
+ JEST_CONFIG_EXT_CJS,
20
+ JEST_CONFIG_EXT_MJS,
21
+ JEST_CONFIG_EXT_MTS,
22
+ JEST_CONFIG_EXT_JS,
23
+ JEST_CONFIG_EXT_TS,
24
+ JEST_CONFIG_EXT_CTS,
25
+ JEST_CONFIG_EXT_JSON,
26
+ JEST_CONFIG_EXT_ORDER,
27
+ };
28
+ }
29
+ export {constants};
30
+
31
+ declare const DEFAULT_JS_PATTERN = '\\.[jt]sx?$';
32
+
33
+ export declare const defaults: Config.DefaultOptions;
34
+
35
+ /**
36
+ * Type helper to make it easier to use Jest config accepts a direct JestTestConfigObject object, or a function that returns it. The function receives a JestTestConfigObject object.
37
+ */
38
+ export declare function defineConfig(
39
+ config: JestTestConfigObject,
40
+ ): JestTestConfigObject;
41
+
42
+ export declare function defineConfig(
43
+ config: Promise<JestTestConfigObject>,
44
+ ): Promise<JestTestConfigObject>;
45
+
46
+ export declare function defineConfig(
47
+ config: UserConfigFnObject,
48
+ ): UserConfigFnObject;
49
+
50
+ export declare function defineConfig(
51
+ config: UserConfigFnPromise,
52
+ ): UserConfigFnPromise;
53
+
54
+ export declare function defineConfig(config: UserConfigFn): UserConfigFn;
55
+
56
+ export declare const deprecationEntries: DeprecatedOptions;
57
+
58
+ export declare const descriptions: {
59
+ [key in keyof Config.InitialOptions]: string;
60
+ };
61
+
62
+ export declare const isJSONString: (
63
+ text?: JSONString | string,
64
+ ) => text is JSONString;
65
+
66
+ declare const JEST_CONFIG_BASE_NAME = 'jest.config';
67
+
68
+ declare const JEST_CONFIG_EXT_CJS = '.cjs';
69
+
70
+ declare const JEST_CONFIG_EXT_CTS = '.cts';
71
+
72
+ declare const JEST_CONFIG_EXT_JS = '.js';
73
+
74
+ declare const JEST_CONFIG_EXT_JSON = '.json';
75
+
76
+ declare const JEST_CONFIG_EXT_MJS = '.mjs';
77
+
78
+ declare const JEST_CONFIG_EXT_MTS = '.mts';
79
+
80
+ declare const JEST_CONFIG_EXT_ORDER: ReadonlyArray<string>;
81
+
82
+ declare const JEST_CONFIG_EXT_TS = '.ts';
83
+
84
+ declare type JestTestConfigObject = Config.InitialOptions;
85
+
86
+ declare type JSONString = string & {
87
+ readonly $$type: never;
88
+ };
89
+
90
+ /**
91
+ * Merges two configuration objects, where the second object takes precedence over the first one.
92
+ */
93
+ export declare function mergeConfig<
94
+ D extends UserConfigExport,
95
+ O extends UserConfigExport,
96
+ >(
97
+ defaults: D extends Function ? never : D,
98
+ overrides: O extends Function ? never : O,
99
+ ): JestTestConfigObject;
100
+
101
+ declare const NODE_MODULES: string;
102
+
103
+ export declare function normalize(
104
+ initialOptions: Config.InitialOptions,
105
+ argv: Config.Argv,
106
+ configPath?: string | null,
107
+ projectIndex?: number,
108
+ isProjectOptions?: boolean,
109
+ ): Promise<{
110
+ hasDeprecationWarnings: boolean;
111
+ options: AllOptions;
112
+ }>;
113
+
114
+ declare const PACKAGE_JSON = 'package.json';
115
+
116
+ declare type ReadConfig = {
117
+ configPath: string | null | undefined;
118
+ globalConfig: Config.GlobalConfig;
119
+ hasDeprecationWarnings: boolean;
120
+ projectConfig: Config.ProjectConfig;
121
+ };
122
+
123
+ export declare function readConfig(
124
+ argv: Config.Argv,
125
+ packageRootOrConfig: string | Config.InitialOptions,
126
+ skipArgvConfigOption?: boolean,
127
+ parentConfigDirname?: string | null,
128
+ projectIndex?: number,
129
+ skipMultipleConfigError?: boolean,
130
+ ): Promise<ReadConfig>;
131
+
132
+ export declare function readConfigs(
133
+ argv: Config.Argv,
134
+ projectPaths: Array<string>,
135
+ ): Promise<{
136
+ globalConfig: Config.GlobalConfig;
137
+ configs: Array<Config.ProjectConfig>;
138
+ hasDeprecationWarnings: boolean;
139
+ }>;
140
+
141
+ /**
142
+ * Reads the jest config, without validating them or filling it out with defaults.
143
+ * @param config The path to the file or serialized config.
144
+ * @param param1 Additional options
145
+ * @returns The raw initial config (not validated)
146
+ */
147
+ export declare function readInitialOptions(
148
+ config?: string,
149
+ {
150
+ packageRootOrConfig,
151
+ parentConfigDirname,
152
+ readFromCwd,
153
+ skipMultipleConfigError,
154
+ }?: ReadJestConfigOptions,
155
+ ): Promise<{
156
+ config: Config.InitialOptions;
157
+ configPath: string | null;
158
+ }>;
159
+
160
+ export declare interface ReadJestConfigOptions {
161
+ /**
162
+ * The package root or deserialized config (default is cwd)
163
+ */
164
+ packageRootOrConfig?: string | Config.InitialOptions;
165
+ /**
166
+ * When the `packageRootOrConfig` contains config, this parameter should
167
+ * contain the dirname of the parent config
168
+ */
169
+ parentConfigDirname?: null | string;
170
+ /**
171
+ * Indicates whether or not to read the specified config file from disk.
172
+ * When true, jest will read try to read config from the current working directory.
173
+ * (default is false)
174
+ */
175
+ readFromCwd?: boolean;
176
+ /**
177
+ * Indicates whether or not to ignore the error of jest finding multiple config files.
178
+ * (default is false)
179
+ */
180
+ skipMultipleConfigError?: boolean;
181
+ }
182
+
183
+ export declare const replaceRootDirInPath: (
184
+ rootDir: string,
185
+ filePath: string,
186
+ ) => string;
187
+
188
+ declare type UserConfigExport =
189
+ | JestTestConfigObject
190
+ | Promise<JestTestConfigObject>
191
+ | UserConfigFnObject
192
+ | UserConfigFnPromise
193
+ | UserConfigFn;
194
+
195
+ declare type UserConfigFn = () =>
196
+ | JestTestConfigObject
197
+ | Promise<JestTestConfigObject>;
198
+
199
+ declare type UserConfigFnObject = () => JestTestConfigObject;
200
+
201
+ declare type UserConfigFnPromise = () => Promise<JestTestConfigObject>;