From f54a77e8a527976c0509406fbacc9f843e57bd74 Mon Sep 17 00:00:00 2001 From: Tim Seckinger Date: Mon, 25 Mar 2019 23:45:37 +0100 Subject: [PATCH] remove flow leftovers --- .circleci/config.yml | 1 - e2e/__tests__/__snapshots__/moduleNameMapper.test.ts.snap | 2 +- .../__snapshots__/resolveNoFileExtensions.test.ts.snap | 2 +- packages/expect/src/jasmineUtils.ts | 4 ---- packages/jest-cli/src/init/__tests__/init.test.js | 4 ---- packages/jest-config/src/setFromArgv.ts | 1 - packages/jest-jasmine2/src/assertionErrorMessage.ts | 1 - packages/jest-jasmine2/src/index.ts | 1 - packages/jest-jasmine2/src/setup_jest_globals.ts | 1 - packages/jest-resolve/src/index.ts | 3 +-- packages/jest-util/src/deepCyclicCopy.ts | 1 - packages/jest-worker/src/WorkerPool.ts | 1 - packages/jest-worker/src/workers/processChild.ts | 1 - 13 files changed, 3 insertions(+), 20 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ac2e90961811..323151353c34 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -26,7 +26,6 @@ jobs: - restore-cache: *restore-cache - run: yarn --no-progress --frozen-lockfile - save-cache: *save-cache - - run: echo server.max_workers=1 >> .flowconfig - run: yarn lint --format junit -o reports/junit/js-lint-results.xml && yarn lint-es5-build --format junit -o reports/junit/js-es5-lint-results.xml && yarn lint:md:ci && yarn check-copyright-headers - store_test_results: path: reports/junit diff --git a/e2e/__tests__/__snapshots__/moduleNameMapper.test.ts.snap b/e2e/__tests__/__snapshots__/moduleNameMapper.test.ts.snap index 5d1dc26353f5..35faae772b9c 100644 --- a/e2e/__tests__/__snapshots__/moduleNameMapper.test.ts.snap +++ b/e2e/__tests__/__snapshots__/moduleNameMapper.test.ts.snap @@ -30,6 +30,6 @@ FAIL __tests__/index.js 12 | module.exports = () => 'test'; 13 | - at createNoMappedModuleFoundError (../../packages/jest-resolve/build/index.js:474:17) + at createNoMappedModuleFoundError (../../packages/jest-resolve/build/index.js:473:17) at Object.require (index.js:10:1) `; diff --git a/e2e/__tests__/__snapshots__/resolveNoFileExtensions.test.ts.snap b/e2e/__tests__/__snapshots__/resolveNoFileExtensions.test.ts.snap index 73905d202b50..e71f3bc23997 100644 --- a/e2e/__tests__/__snapshots__/resolveNoFileExtensions.test.ts.snap +++ b/e2e/__tests__/__snapshots__/resolveNoFileExtensions.test.ts.snap @@ -33,6 +33,6 @@ FAIL __tests__/test.js | ^ 4 | - at Resolver.resolveModule (../../packages/jest-resolve/build/index.js:232:17) + at Resolver.resolveModule (../../packages/jest-resolve/build/index.js:231:17) at Object.require (index.js:3:18) `; diff --git a/packages/expect/src/jasmineUtils.ts b/packages/expect/src/jasmineUtils.ts index a28db744dee1..8c98416fbd66 100644 --- a/packages/expect/src/jasmineUtils.ts +++ b/packages/expect/src/jasmineUtils.ts @@ -50,7 +50,6 @@ function asymmetricMatch(a: any, b: any) { } if (asymmetricA) { - // $FlowFixMe – Flow sees `a` as a number return a.asymmetricMatch(b); } @@ -103,7 +102,6 @@ function eq( case '[object String]': // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is // equivalent to `new String("5")`. - // $FlowFixMe – Flow sees `a` as a number return a == String(b); case '[object Number]': return Object.is(Number(a), Number(b)); @@ -119,7 +117,6 @@ function eq( a.source == b.source && a.global == b.global && a.multiline == b.multiline && - // $FlowFixMe – Flow sees `a` as a number a.ignoreCase == b.ignoreCase ); } @@ -210,7 +207,6 @@ function keys( } return keys.concat( (Object.getOwnPropertySymbols(o) as Array).filter( - //$FlowFixMe Jest complains about nullability, but we know for sure that property 'symbol' does exist. symbol => (Object.getOwnPropertyDescriptor(o, symbol) as any).enumerable, ), diff --git a/packages/jest-cli/src/init/__tests__/init.test.js b/packages/jest-cli/src/init/__tests__/init.test.js index 65a8128b36b6..73cd5168c866 100644 --- a/packages/jest-cli/src/init/__tests__/init.test.js +++ b/packages/jest-cli/src/init/__tests__/init.test.js @@ -25,17 +25,13 @@ const consoleLog = console.log; describe('init', () => { beforeEach(() => { - // $FlowFixMe mock console.log to reduce noise from the tests console.log = jest.fn(); - // $FlowFixMe mock fs.writeFileSync = jest.fn(); }); afterEach(() => { jest.clearAllMocks(); - // $FlowFixMe console.log = consoleLog; - // $FlowFixMe mock fs.writeFileSync = writeFileSync; }); diff --git a/packages/jest-config/src/setFromArgv.ts b/packages/jest-config/src/setFromArgv.ts index 8ae4aa11c4b1..b7f90b6de1d4 100644 --- a/packages/jest-config/src/setFromArgv.ts +++ b/packages/jest-config/src/setFromArgv.ts @@ -14,7 +14,6 @@ export default function setFromArgv( options: Config.InitialOptions, argv: Config.Argv, ): Config.InitialOptions { - // $FlowFixMe: Seems like flow doesn't approve of string values const argvToOptions = Object.keys(argv) .filter(key => argv[key] !== undefined && specialArgs.indexOf(key) === -1) .reduce((options: {[key: string]: unknown}, key) => { diff --git a/packages/jest-jasmine2/src/assertionErrorMessage.ts b/packages/jest-jasmine2/src/assertionErrorMessage.ts index 3a5e6761ec84..8e83b4241df9 100644 --- a/packages/jest-jasmine2/src/assertionErrorMessage.ts +++ b/packages/jest-jasmine2/src/assertionErrorMessage.ts @@ -47,7 +47,6 @@ const getOperatorName = (operator: string | null, stack: string) => { const operatorMessage = (operator: string | null) => { const niceOperatorName = getOperatorName(operator, ''); - // $FlowFixMe: we default to the operator itself, so holes in the map doesn't matter const humanReadableOperator = humanReadableOperators[niceOperatorName]; return typeof operator === 'string' diff --git a/packages/jest-jasmine2/src/index.ts b/packages/jest-jasmine2/src/index.ts index d1bce2deaac0..1860ad51bf96 100644 --- a/packages/jest-jasmine2/src/index.ts +++ b/packages/jest-jasmine2/src/index.ts @@ -127,7 +127,6 @@ async function jasmine2( if (globalConfig.errorOnDeprecated) { installErrorOnPrivate(environment.global); } else { - // $FlowFixMe Flow seems to be confused about accessors and tries to enforce having a `value` property. Object.defineProperty(jasmine, 'DEFAULT_TIMEOUT_INTERVAL', { configurable: true, enumerable: true, diff --git a/packages/jest-jasmine2/src/setup_jest_globals.ts b/packages/jest-jasmine2/src/setup_jest_globals.ts index cff86b27cb45..9da4aa850bb9 100644 --- a/packages/jest-jasmine2/src/setup_jest_globals.ts +++ b/packages/jest-jasmine2/src/setup_jest_globals.ts @@ -105,7 +105,6 @@ export default ({ expand, getBabelTraverse: () => require('@babel/traverse').default, getPrettier: () => - // $FlowFixMe dynamic require config.prettierPath ? require(config.prettierPath) : null, updateSnapshot, }); diff --git a/packages/jest-resolve/src/index.ts b/packages/jest-resolve/src/index.ts index f64be27244d2..658995ce2d0a 100644 --- a/packages/jest-resolve/src/index.ts +++ b/packages/jest-resolve/src/index.ts @@ -83,8 +83,7 @@ class Resolver { options: FindNodeModuleConfig, ): Config.Path | null { const resolver = options.resolver - ? /* $FlowFixMe */ - require(options.resolver) + ? require(options.resolver) : defaultResolver; const paths = options.paths; diff --git a/packages/jest-util/src/deepCyclicCopy.ts b/packages/jest-util/src/deepCyclicCopy.ts index 465ce9f3f1e0..f1bd4ca4f1c5 100644 --- a/packages/jest-util/src/deepCyclicCopy.ts +++ b/packages/jest-util/src/deepCyclicCopy.ts @@ -54,7 +54,6 @@ function deepCyclicCopyObject( ? Object.create(Object.getPrototypeOf(object)) : {}; - // $FlowFixMe: Object.getOwnPropertyDescriptors is polyfilled above. const descriptors = Object.getOwnPropertyDescriptors(object); cycles.set(object, newObject); diff --git a/packages/jest-worker/src/WorkerPool.ts b/packages/jest-worker/src/WorkerPool.ts index dd61ce4dfa8e..cd7159bfad9d 100644 --- a/packages/jest-worker/src/WorkerPool.ts +++ b/packages/jest-worker/src/WorkerPool.ts @@ -18,7 +18,6 @@ import { const canUseWorkerThreads = () => { try { - // $FlowFixMe: Flow doesn't know about experimental APIs require('worker_threads'); return true; } catch (_) { diff --git a/packages/jest-worker/src/workers/processChild.ts b/packages/jest-worker/src/workers/processChild.ts index beb395af1a22..6998b971f908 100644 --- a/packages/jest-worker/src/workers/processChild.ts +++ b/packages/jest-worker/src/workers/processChild.ts @@ -88,7 +88,6 @@ function reportError(error: Error, type: PARENT_MESSAGE_ERROR) { error.constructor && error.constructor.name, error.message, error.stack, - // $FlowFixMe: this is safe to just inherit from Object. typeof error === 'object' ? {...error} : error, ]); }