From 5e11c1cce0e3d32afcd200226ecb9fedebcba0bc Mon Sep 17 00:00:00 2001 From: Vincent Ricard Date: Wed, 13 May 2020 18:37:08 +0200 Subject: [PATCH] chore: fix TestUtils.ts to match the types --- TestUtils.ts | 30 +++++++++---------- .../log_debug_messages.test.ts.snap | 15 ---------- .../script_transformer.test.js.snap | 16 +++++----- 3 files changed, 23 insertions(+), 38 deletions(-) diff --git a/TestUtils.ts b/TestUtils.ts index 031f9de0916a..0de81a811a81 100644 --- a/TestUtils.ts +++ b/TestUtils.ts @@ -13,38 +13,38 @@ const DEFAULT_GLOBAL_CONFIG: Config.GlobalConfig = { changedSince: '', collectCoverage: false, collectCoverageFrom: [], - collectCoverageOnlyFrom: null, + collectCoverageOnlyFrom: undefined, coverageDirectory: 'coverage', coverageProvider: 'babel', coverageReporters: [], coverageThreshold: {global: {}}, detectLeaks: false, detectOpenHandles: false, - enabledTestsMap: null, + enabledTestsMap: undefined, errorOnDeprecated: false, expand: false, - filter: null, + filter: undefined, findRelatedTests: false, forceExit: false, - globalSetup: null, - globalTeardown: null, + globalSetup: undefined, + globalTeardown: undefined, json: false, lastCommit: false, listTests: false, logHeapUsage: false, maxConcurrency: 5, maxWorkers: 2, - noSCM: null, + noSCM: undefined, noStackTrace: false, nonFlagArgs: [], notify: false, notifyMode: 'failure-change', onlyChanged: false, onlyFailures: false, - outputFile: null, + outputFile: undefined, passWithNoTests: false, projects: [], - replname: null, + replname: undefined, reporters: [], rootDir: '/test_root_dir/', runTestsByPath: false, @@ -53,7 +53,7 @@ const DEFAULT_GLOBAL_CONFIG: Config.GlobalConfig = { testFailureExitCode: 1, testNamePattern: '', testPathPattern: '', - testResultsProcessor: null, + testResultsProcessor: undefined, testSequencer: '@jest/test-sequencer', testTimeout: 5000, updateSnapshot: 'none', @@ -77,10 +77,10 @@ const DEFAULT_PROJECT_CONFIG: Config.ProjectConfig = { displayName: undefined, errorOnDeprecated: false, extraGlobals: [], - filter: null, + filter: undefined, forceCoverageMatch: [], - globalSetup: null, - globalTeardown: null, + globalSetup: undefined, + globalTeardown: undefined, globals: {}, haste: {}, moduleDirectories: [], @@ -93,7 +93,7 @@ const DEFAULT_PROJECT_CONFIG: Config.ProjectConfig = { prettierPath: 'prettier', resetMocks: false, resetModules: false, - resolver: null, + resolver: undefined, restoreMocks: false, rootDir: '/test_root_dir/', roots: [], @@ -102,7 +102,7 @@ const DEFAULT_PROJECT_CONFIG: Config.ProjectConfig = { setupFilesAfterEnv: [], skipFilter: false, skipNodeResolution: false, - snapshotResolver: null, + snapshotResolver: undefined, snapshotSerializers: [], testEnvironment: 'node', testEnvironmentOptions: {}, @@ -115,7 +115,7 @@ const DEFAULT_PROJECT_CONFIG: Config.ProjectConfig = { timers: 'real', transform: [], transformIgnorePatterns: [], - unmockedModulePathPatterns: null, + unmockedModulePathPatterns: undefined, watchPathIgnorePatterns: [], }; diff --git a/packages/jest-core/src/lib/__tests__/__snapshots__/log_debug_messages.test.ts.snap b/packages/jest-core/src/lib/__tests__/__snapshots__/log_debug_messages.test.ts.snap index 6cb0bf755035..0d7a420000ea 100644 --- a/packages/jest-core/src/lib/__tests__/__snapshots__/log_debug_messages.test.ts.snap +++ b/packages/jest-core/src/lib/__tests__/__snapshots__/log_debug_messages.test.ts.snap @@ -13,10 +13,7 @@ exports[`prints the config object 1`] = ` "detectOpenHandles": false, "errorOnDeprecated": false, "extraGlobals": [], - "filter": null, "forceCoverageMatch": [], - "globalSetup": null, - "globalTeardown": null, "globals": {}, "haste": {}, "moduleDirectories": [], @@ -31,7 +28,6 @@ exports[`prints the config object 1`] = ` "prettierPath": "prettier", "resetMocks": false, "resetModules": false, - "resolver": null, "restoreMocks": false, "rootDir": "/path/to/dir", "roots": [ @@ -42,7 +38,6 @@ exports[`prints the config object 1`] = ` "setupFilesAfterEnv": [], "skipFilter": false, "skipNodeResolution": false, - "snapshotResolver": null, "snapshotSerializers": [], "testEnvironment": "node", "testEnvironmentOptions": {}, @@ -57,7 +52,6 @@ exports[`prints the config object 1`] = ` "timers": "real", "transform": [], "transformIgnorePatterns": [], - "unmockedModulePathPatterns": null, "watchPathIgnorePatterns": [] }, "globalConfig": { @@ -66,7 +60,6 @@ exports[`prints the config object 1`] = ` "changedSince": "", "collectCoverage": false, "collectCoverageFrom": [], - "collectCoverageOnlyFrom": null, "coverageDirectory": "coverage", "coverageProvider": "babel", "coverageReporters": [], @@ -75,31 +68,24 @@ exports[`prints the config object 1`] = ` }, "detectLeaks": false, "detectOpenHandles": false, - "enabledTestsMap": null, "errorOnDeprecated": false, "expand": false, - "filter": null, "findRelatedTests": false, "forceExit": false, - "globalSetup": null, - "globalTeardown": null, "json": false, "lastCommit": false, "listTests": false, "logHeapUsage": false, "maxConcurrency": 5, "maxWorkers": 2, - "noSCM": null, "noStackTrace": false, "nonFlagArgs": [], "notify": false, "notifyMode": "failure-change", "onlyChanged": false, "onlyFailures": false, - "outputFile": null, "passWithNoTests": false, "projects": [], - "replname": null, "reporters": [], "rootDir": "/test_root_dir/", "runTestsByPath": false, @@ -108,7 +94,6 @@ exports[`prints the config object 1`] = ` "testFailureExitCode": 1, "testNamePattern": "", "testPathPattern": "", - "testResultsProcessor": null, "testSequencer": "@jest/test-sequencer", "testTimeout": 5000, "updateSnapshot": "none", diff --git a/packages/jest-transform/src/__tests__/__snapshots__/script_transformer.test.js.snap b/packages/jest-transform/src/__tests__/__snapshots__/script_transformer.test.js.snap index 8cc51acac4fa..6114987506eb 100644 --- a/packages/jest-transform/src/__tests__/__snapshots__/script_transformer.test.js.snap +++ b/packages/jest-transform/src/__tests__/__snapshots__/script_transformer.test.js.snap @@ -14,10 +14,10 @@ Object { "displayName": undefined, "errorOnDeprecated": false, "extraGlobals": Array [], - "filter": null, + "filter": undefined, "forceCoverageMatch": Array [], - "globalSetup": null, - "globalTeardown": null, + "globalSetup": undefined, + "globalTeardown": undefined, "globals": Object {}, "haste": Object {}, "moduleDirectories": Array [], @@ -32,7 +32,7 @@ Object { "prettierPath": "prettier", "resetMocks": false, "resetModules": false, - "resolver": null, + "resolver": undefined, "restoreMocks": false, "rootDir": "/", "roots": Array [], @@ -41,7 +41,7 @@ Object { "setupFilesAfterEnv": Array [], "skipFilter": false, "skipNodeResolution": false, - "snapshotResolver": null, + "snapshotResolver": undefined, "snapshotSerializers": Array [], "testEnvironment": "node", "testEnvironmentOptions": Object {}, @@ -63,7 +63,7 @@ Object { "transformIgnorePatterns": Array [ "/node_modules/", ], - "unmockedModulePathPatterns": null, + "unmockedModulePathPatterns": undefined, "watchPathIgnorePatterns": Array [], }, "instrument": true, @@ -229,7 +229,7 @@ exports[`ScriptTransformer uses multiple preprocessors 1`] = ` const TRANSFORMED = { filename: '/fruits/banana.js', script: 'module.exports = "banana";', - config: '{"automock":false,"cache":true,"cacheDirectory":"/cache/","clearMocks":false,"coveragePathIgnorePatterns":[],"cwd":"/test_root_dir/","detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"extraGlobals":[],"filter":null,"forceCoverageMatch":[],"globalSetup":null,"globalTeardown":null,"globals":{},"haste":{},"moduleDirectories":[],"moduleFileExtensions":["js"],"moduleLoader":"/test_module_loader_path","moduleNameMapper":[],"modulePathIgnorePatterns":[],"modulePaths":[],"name":"test","prettierPath":"prettier","resetMocks":false,"resetModules":false,"resolver":null,"restoreMocks":false,"rootDir":"/","roots":[],"runner":"jest-runner","setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"skipNodeResolution":false,"snapshotResolver":null,"snapshotSerializers":[],"testEnvironment":"node","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":[],"testPathIgnorePatterns":[],"testRegex":["\\\\.test\\\\.js$"],"testRunner":"jest-jasmine2","testURL":"http://localhost","timers":"real","transform":[["^.+\\\\.js$","test_preprocessor"],["^.+\\\\.css$","css-preprocessor"]],"transformIgnorePatterns":["/node_modules/"],"unmockedModulePathPatterns":null,"watchPathIgnorePatterns":[]}', + config: '{"automock":false,"cache":true,"cacheDirectory":"/cache/","clearMocks":false,"coveragePathIgnorePatterns":[],"cwd":"/test_root_dir/","detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"extraGlobals":[],"forceCoverageMatch":[],"globals":{},"haste":{},"moduleDirectories":[],"moduleFileExtensions":["js"],"moduleLoader":"/test_module_loader_path","moduleNameMapper":[],"modulePathIgnorePatterns":[],"modulePaths":[],"name":"test","prettierPath":"prettier","resetMocks":false,"resetModules":false,"restoreMocks":false,"rootDir":"/","roots":[],"runner":"jest-runner","setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"skipNodeResolution":false,"snapshotSerializers":[],"testEnvironment":"node","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":[],"testPathIgnorePatterns":[],"testRegex":["\\\\.test\\\\.js$"],"testRunner":"jest-jasmine2","testURL":"http://localhost","timers":"real","transform":[["^.+\\\\.js$","test_preprocessor"],["^.+\\\\.css$","css-preprocessor"]],"transformIgnorePatterns":["/node_modules/"],"watchPathIgnorePatterns":[]}', }; `; @@ -246,7 +246,7 @@ exports[`ScriptTransformer uses the supplied preprocessor 1`] = ` const TRANSFORMED = { filename: '/fruits/banana.js', script: 'module.exports = "banana";', - config: '{"automock":false,"cache":true,"cacheDirectory":"/cache/","clearMocks":false,"coveragePathIgnorePatterns":[],"cwd":"/test_root_dir/","detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"extraGlobals":[],"filter":null,"forceCoverageMatch":[],"globalSetup":null,"globalTeardown":null,"globals":{},"haste":{},"moduleDirectories":[],"moduleFileExtensions":["js"],"moduleLoader":"/test_module_loader_path","moduleNameMapper":[],"modulePathIgnorePatterns":[],"modulePaths":[],"name":"test","prettierPath":"prettier","resetMocks":false,"resetModules":false,"resolver":null,"restoreMocks":false,"rootDir":"/","roots":[],"runner":"jest-runner","setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"skipNodeResolution":false,"snapshotResolver":null,"snapshotSerializers":[],"testEnvironment":"node","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":[],"testPathIgnorePatterns":[],"testRegex":["\\\\.test\\\\.js$"],"testRunner":"jest-jasmine2","testURL":"http://localhost","timers":"real","transform":[["^.+\\\\.js$","test_preprocessor"]],"transformIgnorePatterns":["/node_modules/"],"unmockedModulePathPatterns":null,"watchPathIgnorePatterns":[]}', + config: '{"automock":false,"cache":true,"cacheDirectory":"/cache/","clearMocks":false,"coveragePathIgnorePatterns":[],"cwd":"/test_root_dir/","detectLeaks":false,"detectOpenHandles":false,"errorOnDeprecated":false,"extraGlobals":[],"forceCoverageMatch":[],"globals":{},"haste":{},"moduleDirectories":[],"moduleFileExtensions":["js"],"moduleLoader":"/test_module_loader_path","moduleNameMapper":[],"modulePathIgnorePatterns":[],"modulePaths":[],"name":"test","prettierPath":"prettier","resetMocks":false,"resetModules":false,"restoreMocks":false,"rootDir":"/","roots":[],"runner":"jest-runner","setupFiles":[],"setupFilesAfterEnv":[],"skipFilter":false,"skipNodeResolution":false,"snapshotSerializers":[],"testEnvironment":"node","testEnvironmentOptions":{},"testLocationInResults":false,"testMatch":[],"testPathIgnorePatterns":[],"testRegex":["\\\\.test\\\\.js$"],"testRunner":"jest-jasmine2","testURL":"http://localhost","timers":"real","transform":[["^.+\\\\.js$","test_preprocessor"]],"transformIgnorePatterns":["/node_modules/"],"watchPathIgnorePatterns":[]}', }; `;