Skip to content

Commit

Permalink
remove flow leftovers (jestjs#8213)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeysal authored Mar 26, 2019
1 parent 7698986 commit 5816a57
Show file tree
Hide file tree
Showing 13 changed files with 3 additions and 20 deletions.
1 change: 0 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion e2e/__tests__/__snapshots__/moduleNameMapper.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -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)
`;
Original file line number Diff line number Diff line change
Expand Up @@ -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)
`;
4 changes: 0 additions & 4 deletions packages/expect/src/jasmineUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ function asymmetricMatch(a: any, b: any) {
}

if (asymmetricA) {
// $FlowFixMe – Flow sees `a` as a number
return a.asymmetricMatch(b);
}

Expand Down Expand Up @@ -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));
Expand All @@ -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
);
}
Expand Down Expand Up @@ -210,7 +207,6 @@ function keys(
}
return keys.concat(
(Object.getOwnPropertySymbols(o) as Array<any>).filter(
//$FlowFixMe Jest complains about nullability, but we know for sure that property 'symbol' does exist.
symbol =>
(Object.getOwnPropertyDescriptor(o, symbol) as any).enumerable,
),
Expand Down
4 changes: 0 additions & 4 deletions packages/jest-cli/src/init/__tests__/init.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});

Expand Down
1 change: 0 additions & 1 deletion packages/jest-config/src/setFromArgv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
1 change: 0 additions & 1 deletion packages/jest-jasmine2/src/assertionErrorMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
1 change: 0 additions & 1 deletion packages/jest-jasmine2/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion packages/jest-jasmine2/src/setup_jest_globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ export default ({
expand,
getBabelTraverse: () => require('@babel/traverse').default,
getPrettier: () =>
// $FlowFixMe dynamic require
config.prettierPath ? require(config.prettierPath) : null,
updateSnapshot,
});
Expand Down
3 changes: 1 addition & 2 deletions packages/jest-resolve/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 0 additions & 1 deletion packages/jest-util/src/deepCyclicCopy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ function deepCyclicCopyObject<T>(
? Object.create(Object.getPrototypeOf(object))
: {};

// $FlowFixMe: Object.getOwnPropertyDescriptors is polyfilled above.
const descriptors = Object.getOwnPropertyDescriptors(object);

cycles.set(object, newObject);
Expand Down
1 change: 0 additions & 1 deletion packages/jest-worker/src/WorkerPool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {

const canUseWorkerThreads = () => {
try {
// $FlowFixMe: Flow doesn't know about experimental APIs
require('worker_threads');
return true;
} catch (_) {
Expand Down
1 change: 0 additions & 1 deletion packages/jest-worker/src/workers/processChild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
]);
}
Expand Down

0 comments on commit 5816a57

Please sign in to comment.