From 3f5a0e8cdef4983813029e511d691f8d8d7b15e2 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Sun, 23 Jun 2019 10:05:41 +0200 Subject: [PATCH] chore: bump TypeScript version (#8591) --- package.json | 12 ++-- packages/jest-changed-files/src/index.ts | 2 +- packages/jest-circus/src/utils.ts | 4 +- packages/jest-core/src/SearchSource.ts | 2 +- packages/jest-core/src/TestScheduler.ts | 2 +- packages/jest-haste-map/src/HasteFS.ts | 2 +- .../src/lib/dependencyExtractor.ts | 2 +- packages/jest-jasmine2/src/errorOnPrivate.ts | 1 + packages/jest-mock/src/index.ts | 4 +- packages/jest-types/src/Circus.ts | 28 ++++----- packages/jest-util/src/deepCyclicCopy.ts | 2 +- yarn.lock | 60 +++++++++++-------- 12 files changed, 66 insertions(+), 55 deletions(-) diff --git a/package.json b/package.json index 1aac0f43063d..bc10ee8c87cc 100644 --- a/package.json +++ b/package.json @@ -15,8 +15,8 @@ "@types/babel__template": "^7.0.0", "@types/jest": "24.0.2", "@types/node": "*", - "@typescript-eslint/eslint-plugin": "^1.6.0", - "@typescript-eslint/parser": "^1.6.0", + "@typescript-eslint/eslint-plugin": "^1.10.2", + "@typescript-eslint/parser": "^1.10.2", "ansi-regex": "^4.0.0", "ansi-styles": "^3.2.0", "babel-eslint": "^9.0.0", @@ -49,6 +49,7 @@ "jest-junit": "^6.2.1", "jest-silent-reporter": "^0.1.2", "jest-snapshot-serializer-raw": "^1.1.0", + "jest-watch-typeahead": "^0.2.2-0", "jquery": "^3.2.1", "karma": "^4.0.1", "karma-chrome-launcher": "^2.1.1", @@ -60,6 +61,7 @@ "mkdirp": "^0.5.1", "mocha": "^6.0.2", "mock-fs": "^4.4.1", + "opencollective": "^1.0.3", "prettier": "^1.16.1", "prettylint": "^1.0.0", "progress": "^2.0.0", @@ -71,7 +73,7 @@ "slash": "^2.0.0", "string-length": "^2.0.0", "strip-ansi": "^5.0.0", - "typescript": "^3.4.1", + "typescript": "^3.5.2", "webpack": "^4.28.4" }, "scripts": { @@ -134,10 +136,6 @@ } ] }, - "dependencies": { - "jest-watch-typeahead": "^0.2.2-0", - "opencollective": "^1.0.3" - }, "collective": { "type": "opencollective", "url": "https://opencollective.com/jest", diff --git a/packages/jest-changed-files/src/index.ts b/packages/jest-changed-files/src/index.ts index 0b8c802e915d..7c17ea8ef781 100644 --- a/packages/jest-changed-files/src/index.ts +++ b/packages/jest-changed-files/src/index.ts @@ -52,7 +52,7 @@ export const getChangedFilesForRoots = async ( } return allFiles; - }, new Set()); + }, new Set()); return {changedFiles, repos}; }; diff --git a/packages/jest-circus/src/utils.ts b/packages/jest-circus/src/utils.ts index 433f0c59ab77..5cda1f91eebf 100644 --- a/packages/jest-circus/src/utils.ts +++ b/packages/jest-circus/src/utils.ts @@ -250,7 +250,7 @@ const makeTestResults = ( let testResults: Circus.TestResults = []; for (const test of describeBlock.tests) { const testPath = []; - let parent: Circus.TestEntry | Circus.DescribeBlock = test; + let parent: Circus.TestEntry | Circus.DescribeBlock | undefined = test; do { testPath.unshift(parent.name); } while ((parent = parent.parent)); @@ -298,7 +298,7 @@ const makeTestResults = ( // names + test title) export const getTestID = (test: Circus.TestEntry) => { const titles = []; - let parent: Circus.TestEntry | Circus.DescribeBlock = test; + let parent: Circus.TestEntry | Circus.DescribeBlock | undefined = test; do { titles.unshift(parent.name); } while ((parent = parent.parent)); diff --git a/packages/jest-core/src/SearchSource.ts b/packages/jest-core/src/SearchSource.ts index 5e9a8d330a80..7f4fe4015080 100644 --- a/packages/jest-core/src/SearchSource.ts +++ b/packages/jest-core/src/SearchSource.ts @@ -180,7 +180,7 @@ export default class SearchSource { const allPathsAbsolute = Array.from(allPaths).map(p => path.resolve(p)); - const collectCoverageFrom = new Set(); + const collectCoverageFrom = new Set(); testModulesMap.forEach(testModule => { if (!testModule.dependencies) { diff --git a/packages/jest-core/src/TestScheduler.ts b/packages/jest-core/src/TestScheduler.ts index 34f5ec44c116..ff29bde939b2 100644 --- a/packages/jest-core/src/TestScheduler.ts +++ b/packages/jest-core/src/TestScheduler.ts @@ -73,7 +73,7 @@ export default class TestScheduler { async scheduleTests(tests: Array, watcher: TestWatcher) { const onStart = this._dispatcher.onTestStart.bind(this._dispatcher); const timings: Array = []; - const contexts = new Set(); + const contexts = new Set(); tests.forEach(test => { contexts.add(test.context); if (test.duration) { diff --git a/packages/jest-haste-map/src/HasteFS.ts b/packages/jest-haste-map/src/HasteFS.ts index 0007da2d6ae9..a15af1301dce 100644 --- a/packages/jest-haste-map/src/HasteFS.ts +++ b/packages/jest-haste-map/src/HasteFS.ts @@ -83,7 +83,7 @@ export default class HasteFS { globs: Array, root: Config.Path | null, ): Set { - const files = new Set(); + const files = new Set(); for (const file of this.getAbsoluteFileIterator()) { const filePath = root ? fastPath.relative(root, file) : file; if (micromatch.some(replacePathSepForGlob(filePath), globs)) { diff --git a/packages/jest-haste-map/src/lib/dependencyExtractor.ts b/packages/jest-haste-map/src/lib/dependencyExtractor.ts index 1e10b59db7c2..2335e30d6b69 100644 --- a/packages/jest-haste-map/src/lib/dependencyExtractor.ts +++ b/packages/jest-haste-map/src/lib/dependencyExtractor.ts @@ -75,7 +75,7 @@ const JEST_EXTENSIONS_RE = createRegExp( ); export function extract(code: string): Set { - const dependencies = new Set(); + const dependencies = new Set(); const addDependency = (match: string, _: string, dep: string) => { dependencies.add(dep); diff --git a/packages/jest-jasmine2/src/errorOnPrivate.ts b/packages/jest-jasmine2/src/errorOnPrivate.ts index afc0eb54eefc..6d4f5a8f4a7d 100644 --- a/packages/jest-jasmine2/src/errorOnPrivate.ts +++ b/packages/jest-jasmine2/src/errorOnPrivate.ts @@ -53,6 +53,7 @@ export function installErrorOnPrivate(global: Global.Global): void { (Object.keys(disabledJasmineMethods) as Array< DisabledJasmineMethodsKeys >).forEach(methodName => { + // @ts-ignore jasmine[methodName] = () => { throwAtFunction(disabledJasmineMethods[methodName], jasmine[methodName]); }; diff --git a/packages/jest-mock/src/index.ts b/packages/jest-mock/src/index.ts index 50254ec0b5a5..ba06769d893b 100644 --- a/packages/jest-mock/src/index.ts +++ b/packages/jest-mock/src/index.ts @@ -390,7 +390,7 @@ class ModuleMockerClass { return []; } - const slots = new Set(); + const slots = new Set(); const EnvObjectProto = this._environmentGlobal.Object.prototype; const EnvFunctionProto = this._environmentGlobal.Function.prototype; const EnvRegExpProto = this._environmentGlobal.RegExp.prototype; @@ -1079,7 +1079,9 @@ class ModuleMockerClass { ); } + // @ts-ignore: mock is assignable descriptor[accessType] = this._makeComponent({type: 'function'}, () => { + // @ts-ignore: mock is assignable descriptor![accessType] = original; Object.defineProperty(obj, propertyName, descriptor!); }); diff --git a/packages/jest-types/src/Circus.ts b/packages/jest-types/src/Circus.ts index 0ca639632e8d..6ae1bddd4baa 100644 --- a/packages/jest-types/src/Circus.ts +++ b/packages/jest-types/src/Circus.ts @@ -69,15 +69,15 @@ export type Event = } | { name: 'hook_success'; - describeBlock: DescribeBlock | undefined | null; - test: TestEntry | undefined | null; + describeBlock?: DescribeBlock; + test?: TestEntry; hook: Hook; } | { name: 'hook_failure'; error: string | Exception; - describeBlock: DescribeBlock | undefined | null; - test: TestEntry | undefined | null; + describeBlock?: DescribeBlock; + test?: TestEntry; hook: Hook; } | { @@ -153,11 +153,11 @@ export type Event = export type TestStatus = 'skip' | 'done' | 'todo'; export type TestResult = { - duration: number | null | undefined; + duration?: number | null; errors: Array; invocations: number; status: TestStatus; - location: {column: number; line: number} | null | undefined; + location?: {column: number; line: number} | null; testPath: Array; }; @@ -177,7 +177,7 @@ export type GlobalErrorHandlers = { export type State = { currentDescribeBlock: DescribeBlock; - currentlyRunningTest: TestEntry | undefined | null; // including when hooks are being executed + currentlyRunningTest?: TestEntry | null; // including when hooks are being executed expand?: boolean; // expand error messages hasFocusedTests: boolean; // that are defined using test.only // Store process error handlers. During the run we inject our own @@ -186,7 +186,7 @@ export type State = { originalGlobalErrorHandlers?: GlobalErrorHandlers; parentProcess: Process | null; // process object from the outer scope rootDescribeBlock: DescribeBlock; - testNamePattern: RegExp | undefined | null; + testNamePattern?: RegExp | null; testTimeout: number; unhandledErrors: Array; includeTestLocationInResult: boolean; @@ -197,7 +197,7 @@ export type DescribeBlock = { hooks: Array; mode: BlockMode; name: BlockName; - parent: DescribeBlock | undefined | null; + parent?: DescribeBlock; tests: Array; }; @@ -206,13 +206,13 @@ export type TestError = Exception | Array<[Exception | undefined, Exception]>; / export type TestEntry = { asyncError: Exception; // Used if the test failure contains no usable stack trace errors: TestError; - fn: TestFn | undefined | null; + fn?: TestFn; invocations: number; mode: TestMode; name: TestName; parent: DescribeBlock; - startedAt: number | undefined | null; - duration: number | undefined | null; - status: TestStatus | undefined | null; // whether the test has been skipped or run already - timeout: number | undefined | null; + startedAt?: number | null; + duration?: number | null; + status?: TestStatus | null; // whether the test has been skipped or run already + timeout?: number; }; diff --git a/packages/jest-util/src/deepCyclicCopy.ts b/packages/jest-util/src/deepCyclicCopy.ts index 444ddff564a4..de5efab96b2b 100644 --- a/packages/jest-util/src/deepCyclicCopy.ts +++ b/packages/jest-util/src/deepCyclicCopy.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -const EMPTY = new Set(); +const EMPTY = new Set(); export type DeepCyclicCopyOptions = { blacklist?: Set; diff --git a/yarn.lock b/yarn.lock index 349471c2a428..64ecba11c03d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1673,6 +1673,11 @@ resolved "https://registry.yarnpkg.com/@types/detect-newline/-/detect-newline-2.1.0.tgz#1896b5651b473792b6aba2500270fda626bc38d0" integrity sha512-vcHS4yQkTfy+8QISuAFS+2SCjNcGs37+CWzxrrIOMv7yvPnYd6f1AeUErVEHVCu8dZreAHUqzV8RrjzeBorvtQ== +"@types/eslint-visitor-keys@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#1ee30d79544ca84d68d4b3cdb0af4f205663dd2d" + integrity sha512-OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ/7e+w79+hbMUFC1QXDNCmdyoRfAFdm0RypzwR+Qpag== + "@types/events@*": version "3.0.0" resolved "https://registry.yarnpkg.com/@types/events/-/events-3.0.0.tgz#2862f3f58a9a7f7c3e78d79f130dd4d71c25c2a7" @@ -1975,29 +1980,39 @@ resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-12.0.9.tgz#693e76a52f61a2f1e7fb48c0eef167b95ea4ffd0" integrity sha512-sCZy4SxP9rN2w30Hlmg5dtdRwgYQfYRiLo9usw8X9cxlf+H4FqM1xX7+sNH7NNKVdbXMJWqva7iyy+fxh/V7fA== -"@typescript-eslint/eslint-plugin@^1.6.0": - version "1.6.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-1.6.0.tgz#a5ff3128c692393fb16efa403ec7c8a5593dab0f" - integrity sha512-U224c29E2lo861TQZs6GSmyC0OYeRNg6bE9UVIiFBxN2MlA0nq2dCrgIVyyRbC05UOcrgf2Wk/CF2gGOPQKUSQ== +"@typescript-eslint/eslint-plugin@^1.10.2": + version "1.10.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-1.10.2.tgz#552fc64cfcb19c6162190360217c945e8faa330a" + integrity sha512-7449RhjE1oLFIy5E/5rT4wG5+KsfPzakJuhvpzXJ3C46lq7xywY0/Rjo9ZBcwrfbk0nRZ5xmUHkk7DZ67tSBKw== dependencies: - "@typescript-eslint/parser" "1.6.0" - "@typescript-eslint/typescript-estree" "1.6.0" - requireindex "^1.2.0" + "@typescript-eslint/experimental-utils" "1.10.2" + eslint-utils "^1.3.1" + functional-red-black-tree "^1.0.1" + regexpp "^2.0.1" tsutils "^3.7.0" -"@typescript-eslint/parser@1.6.0", "@typescript-eslint/parser@^1.6.0": - version "1.6.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-1.6.0.tgz#f01189c8b90848e3b8e45a6cdad27870529d1804" - integrity sha512-VB9xmSbfafI+/kI4gUK3PfrkGmrJQfh0N4EScT1gZXSZyUxpsBirPL99EWZg9MmPG0pzq/gMtgkk7/rAHj4aQw== +"@typescript-eslint/experimental-utils@1.10.2": + version "1.10.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-1.10.2.tgz#cd548c03fc1a2b3ba5c136d1599001a1ede24215" + integrity sha512-Hf5lYcrnTH5Oc67SRrQUA7KuHErMvCf5RlZsyxXPIT6AXa8fKTyfFO6vaEnUmlz48RpbxO4f0fY3QtWkuHZNjg== dependencies: - "@typescript-eslint/typescript-estree" "1.6.0" + "@typescript-eslint/typescript-estree" "1.10.2" eslint-scope "^4.0.0" + +"@typescript-eslint/parser@^1.10.2": + version "1.10.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-1.10.2.tgz#36cfe8c6bf1b6c1dd81da56f88c8588f4b1a852b" + integrity sha512-xWDWPfZfV0ENU17ermIUVEVSseBBJxKfqBcRCMZ8nAjJbfA5R7NWMZmFFHYnars5MjK4fPjhu4gwQv526oZIPQ== + dependencies: + "@types/eslint-visitor-keys" "^1.0.0" + "@typescript-eslint/experimental-utils" "1.10.2" + "@typescript-eslint/typescript-estree" "1.10.2" eslint-visitor-keys "^1.0.0" -"@typescript-eslint/typescript-estree@1.6.0": - version "1.6.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-1.6.0.tgz#6cf43a07fee08b8eb52e4513b428c8cdc9751ef0" - integrity sha512-A4CanUwfaG4oXobD5y7EXbsOHjCwn8tj1RDd820etpPAjH+Icjc2K9e/DQM1Hac5zH2BSy+u6bjvvF2wwREvYA== +"@typescript-eslint/typescript-estree@1.10.2": + version "1.10.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-1.10.2.tgz#8403585dd74b6cfb6f78aa98b6958de158b5897b" + integrity sha512-Kutjz0i69qraOsWeI8ETqYJ07tRLvD9URmdrMoF10bG8y8ucLmPtSxROvVejWvlJUGl2et/plnMiKRDW+rhEhw== dependencies: lodash.unescape "4.0.1" semver "5.5.0" @@ -11379,11 +11394,6 @@ require-main-filename@^1.0.1: resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" integrity sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE= -requireindex@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/requireindex/-/requireindex-1.2.0.tgz#3463cdb22ee151902635aa6c9535d4de9c2ef1ef" - integrity sha512-L9jEkOi3ASd9PYit2cwRfyppc9NoABujTP8/5gFcbERmo5jUoAKovIC3fsF17pkTnGsrByysqX+Kxd2OTNI1ww== - requires-port@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" @@ -12815,10 +12825,10 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@*, typescript@^3.4.1: - version "3.4.1" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.4.1.tgz#b6691be11a881ffa9a05765a205cb7383f3b63c6" - integrity sha512-3NSMb2VzDQm8oBTLH6Nj55VVtUEpe/rgkIzMir0qVoLyjDZlnMBva0U6vDiV3IH+sl/Yu6oP5QwsAQtHPmDd2Q== +typescript@*, typescript@^3.5.2: + version "3.5.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.5.2.tgz#a09e1dc69bc9551cadf17dba10ee42cf55e5d56c" + integrity sha512-7KxJovlYhTX5RaRbUdkAXN1KUZ8PwWlTzQdHV6xNqvuFOs7+WBo10TQUqT19Q/Jz2hk5v9TQDIhyLhhJY4p5AA== ua-parser-js@^0.7.18: version "0.7.19"