Skip to content

Commit ed0abb7

Browse files
authored
refactor(jest-validate) rename __fixtures__ folder (jestjs#13454)
1 parent 4e26ec2 commit ed0abb7

File tree

3 files changed

+11
-16
lines changed

3 files changed

+11
-16
lines changed

jest.config.mjs

-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ export default {
6363
'/packages/jest-runtime/src/__tests__/NODE_PATH_dir',
6464
'/packages/jest-snapshot/src/__tests__/plugins',
6565
'/packages/jest-snapshot/src/__tests__/fixtures/',
66-
'/packages/jest-validate/src/__tests__/fixtures/',
6766
'/e2e/__tests__/iterator-to-null-test.ts',
6867
'/e2e/__tests__/tsIntegration.test.ts', // this test needs types to be build, it runs in a separate CI job through `jest.config.ts.mjs`
6968
],

packages/jest-validate/src/__tests__/fixtures/jestConfig.ts packages/jest-validate/src/__tests__/__fixtures__/jestConfig.ts

+8-12
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const replacePathSepForRegex = (string: string) => {
1919

2020
const NODE_MODULES_REGEXP = replacePathSepForRegex(NODE_MODULES);
2121

22-
const defaultConfig = {
22+
export const defaultConfig = {
2323
automock: false,
2424
bail: 0,
2525
cacheDirectory: path.join(tmpdir(), 'jest'),
@@ -55,7 +55,7 @@ const defaultConfig = {
5555
watchPathIgnorePatterns: [],
5656
};
5757

58-
const validConfig = {
58+
export const validConfig = {
5959
automock: false,
6060
bail: 0,
6161
cache: true,
@@ -121,10 +121,12 @@ const validConfig = {
121121
};
122122

123123
const format = (value: string) =>
124-
require('pretty-format').format(value, {min: true});
124+
(require('pretty-format') as typeof import('pretty-format')).format(value, {
125+
min: true,
126+
});
125127

126-
const deprecatedConfig = {
127-
preprocessorIgnorePatterns: (config: Record<string, any>) =>
128+
export const deprecatedConfig = {
129+
preprocessorIgnorePatterns: (config: {preprocessorIgnorePatterns: string}) =>
128130
` Option ${chalk.bold(
129131
'preprocessorIgnorePatterns',
130132
)} was replaced by ${chalk.bold(
@@ -140,7 +142,7 @@ const deprecatedConfig = {
140142
141143
Please update your configuration.`,
142144

143-
scriptPreprocessor: (config: Record<string, any>) =>
145+
scriptPreprocessor: (config: {scriptPreprocessor: string}) =>
144146
` Option ${chalk.bold('scriptPreprocessor')} was replaced by ${chalk.bold(
145147
'transform',
146148
)}, which support multiple preprocessors.
@@ -154,9 +156,3 @@ const deprecatedConfig = {
154156
155157
Please update your configuration.`,
156158
};
157-
158-
module.exports = {
159-
defaultConfig,
160-
deprecatedConfig,
161-
validConfig,
162-
};

packages/jest-validate/src/__tests__/validate.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ import {multipleValidOptions} from '../condition';
1010
import jestValidateDefaultConfig from '../defaultConfig';
1111
import jestValidateExampleConfig from '../exampleConfig';
1212
import validate from '../validate';
13-
const {
13+
import {
1414
defaultConfig,
15-
validConfig,
1615
deprecatedConfig,
17-
} = require('./fixtures/jestConfig');
16+
validConfig,
17+
} from './__fixtures__/jestConfig';
1818

1919
test('recursively validates default Jest config', () => {
2020
expect(

0 commit comments

Comments
 (0)