Skip to content

Commit

Permalink
chore: make changes for yarn berry to successfully run tsc
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Feb 9, 2020
1 parent 22a8de7 commit 1db89ce
Show file tree
Hide file tree
Showing 28 changed files with 66 additions and 28 deletions.
3 changes: 2 additions & 1 deletion packages/babel-plugin-jest-hoist/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"@types/babel__traverse": "^7.0.6"
},
"devDependencies": {
"@babel/types": "^7.3.3"
"@babel/types": "^7.3.3",
"@types/node": "*"
},
"publishConfig": {
"access": "public"
Expand Down
4 changes: 2 additions & 2 deletions packages/jest-cli/src/cli/args.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {Config} from '@jest/types';
import {isJSONString} from 'jest-config';
import isCI = require('is-ci');

export const check = (argv: Config.Argv): true => {
export function check(argv: Config.Argv): true {
if (argv.runInBand && argv.hasOwnProperty('maxWorkers')) {
throw new Error(
'Both --runInBand and --maxWorkers were specified, but these two ' +
Expand Down Expand Up @@ -61,7 +61,7 @@ export const check = (argv: Config.Argv): true => {
}

return true;
};
}

export const usage =
'Usage: $0 [--config=<pathToConfigFile>] [TestPathPattern]';
Expand Down
3 changes: 3 additions & 0 deletions packages/jest-console/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
"jest-util": "^25.1.0",
"slash": "^3.0.0"
},
"devDependencies": {
"@types/node": "*"
},
"engines": {
"node": ">= 8.3"
},
Expand Down
1 change: 1 addition & 0 deletions packages/jest-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"@types/exit": "^0.1.30",
"@types/graceful-fs": "^4.1.2",
"@types/micromatch": "^4.0.0",
"@types/node": "*",
"@types/rimraf": "^2.0.2"
},
"engines": {
Expand Down
6 changes: 3 additions & 3 deletions packages/jest-core/src/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ const {print: preRunMessagePrint} = preRunMessage;

type OnCompleteCallback = (results: AggregatedResult) => void;

export const runCLI = async (
export async function runCLI(
argv: Config.Argv,
projects: Array<Config.Path>,
): Promise<{
results: AggregatedResult;
globalConfig: Config.GlobalConfig;
}> => {
}> {
const realFs = require('fs');
const fs = require('graceful-fs');
fs.gracefulify(realFs);
Expand Down Expand Up @@ -109,7 +109,7 @@ export const runCLI = async (
}

return {globalConfig, results};
};
}

const buildContextsAndHasteMaps = async (
configs: Array<Config.ProjectConfig>,
Expand Down
3 changes: 3 additions & 0 deletions packages/jest-docblock/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
"dependencies": {
"detect-newline": "^3.0.0"
},
"devDependencies": {
"@types/node": "*"
},
"engines": {
"node": ">= 8.3"
},
Expand Down
3 changes: 2 additions & 1 deletion packages/jest-fake-timers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"lolex": "^5.0.0"
},
"devDependencies": {
"@types/lolex": "^5.1.0"
"@types/lolex": "^5.1.0",
"@types/node": "*"
},
"engines": {
"node": ">= 8.3"
Expand Down
1 change: 1 addition & 0 deletions packages/jest-haste-map/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"@types/fb-watchman": "^2.0.0",
"@types/graceful-fs": "^4.1.2",
"@types/micromatch": "^4.0.0",
"@types/node": "*",
"@types/sane": "^2.0.0"
},
"optionalDependencies": {
Expand Down
3 changes: 2 additions & 1 deletion packages/jest-jasmine2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"throat": "^5.0.0"
},
"devDependencies": {
"@types/babel__traverse": "^7.0.4"
"@types/babel__traverse": "^7.0.4",
"@types/co": "^4.6.2"
},
"engines": {
"node": ">= 8.3"
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-jasmine2/src/jasmine/Env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ export default function(j$: Jasmine) {
if (arguments.length !== 1 || typeof description !== 'string') {
throw new ErrorWithStack(
'Todo must be called with only a description.',
test.todo,
this.todo,
);
}

Expand Down
3 changes: 3 additions & 0 deletions packages/jest-matcher-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
"jest-get-type": "^25.1.0",
"pretty-format": "^25.1.0"
},
"devDependencies": {
"@types/node": "*"
},
"publishConfig": {
"access": "public"
},
Expand Down
3 changes: 3 additions & 0 deletions packages/jest-mock/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
"dependencies": {
"@jest/types": "^25.1.0"
},
"devDependencies": {
"@types/node": "*"
},
"license": "MIT",
"main": "build/index.js",
"types": "build/index.d.ts",
Expand Down
3 changes: 3 additions & 0 deletions packages/jest-regex-util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
"url": "https://github.com/facebook/jest.git",
"directory": "packages/jest-regex-util"
},
"devDependencies": {
"@types/node": "*"
},
"engines": {
"node": ">= 8.3"
},
Expand Down
6 changes: 4 additions & 2 deletions packages/jest-repl/src/cli/args.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@
*
*/

import {Options} from 'yargs';
import Runtime = require('jest-runtime');

export const usage = 'Usage: $0 [--config=<pathToConfigFile>]';

export const options = Object.assign({}, Runtime.getCLIOptions(), {
export const options: Record<string, Options> = {
...Runtime.getCLIOptions(),
replname: {
alias: 'r',
description:
'The "name" of the file given to transformers to be ' +
'transformed. For example, "repl.ts" if using a TypeScript transformer.',
type: 'string',
},
});
};
1 change: 1 addition & 0 deletions packages/jest-runner/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"devDependencies": {
"@types/exit": "^0.1.30",
"@types/graceful-fs": "^4.1.2",
"@types/node": "*",
"@types/source-map-support": "^0.5.0"
},
"engines": {
Expand Down
1 change: 1 addition & 0 deletions packages/jest-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"@types/exit": "^0.1.30",
"@types/glob": "^7.1.1",
"@types/graceful-fs": "^4.1.2",
"@types/yargs": "^15.0.3",
"jest-environment-node": "^25.1.0"
},
"bin": "./bin/jest-runtime.js",
Expand Down
4 changes: 2 additions & 2 deletions packages/jest-runtime/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ class Runtime {
return cliRun(args, info);
}

static getCLIOptions() {
static getCLIOptions(): typeof cliOptions {
return cliOptions;
}

Expand Down Expand Up @@ -587,7 +587,7 @@ class Runtime {
this._v8CoverageResult = await this._v8CoverageInstrumenter.stopInstrumenting();
}

getAllCoverageInfoCopy() {
getAllCoverageInfoCopy(): JestEnvironment['global']['__coverage__'] {
return deepCyclicCopy(this._environment.global.__coverage__);
}

Expand Down
3 changes: 3 additions & 0 deletions packages/jest-serializer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
"url": "https://github.com/facebook/jest.git",
"directory": "packages/jest-serializer"
},
"devDependencies": {
"@types/node": "*"
},
"engines": {
"node": ">= 8.3"
},
Expand Down
6 changes: 3 additions & 3 deletions packages/jest-snapshot/src/inline_snapshots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ export type InlineSnapshot = {
frame: Frame;
};

export const saveInlineSnapshots = (
export function saveInlineSnapshots(
snapshots: Array<InlineSnapshot>,
prettier: typeof import('prettier') | null,
babelTraverse: Function,
): void => {
): void {
if (!prettier) {
throw new Error(
`Jest: Inline Snapshots requires Prettier.\n` +
Expand All @@ -54,7 +54,7 @@ export const saveInlineSnapshots = (
babelTraverse,
);
}
};
}

const saveSnapshotsForFile = (
snapshots: Array<InlineSnapshot>,
Expand Down
3 changes: 3 additions & 0 deletions packages/jest-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
"@types/yargs": "^15.0.0",
"chalk": "^3.0.0"
},
"devDependencies": {
"@types/node": "*"
},
"publishConfig": {
"access": "public"
},
Expand Down
3 changes: 2 additions & 1 deletion packages/jest-util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
},
"devDependencies": {
"@types/graceful-fs": "^4.1.2",
"@types/is-ci": "^2.0.0"
"@types/is-ci": "^2.0.0",
"@types/node": "*"
},
"engines": {
"node": ">= 8.3"
Expand Down
3 changes: 3 additions & 0 deletions packages/jest-validate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
"leven": "^3.1.0",
"pretty-format": "^25.1.0"
},
"devDependencies": {
"@types/yargs": "^15.0.3"
},
"engines": {
"node": ">= 8.3"
},
Expand Down
3 changes: 3 additions & 0 deletions packages/jest-watcher/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
"jest-util": "^25.1.0",
"string-length": "^3.1.0"
},
"devDependencies": {
"@types/node": "*"
},
"repository": {
"type": "git",
"url": "https://github.com/facebook/jest",
Expand Down
1 change: 1 addition & 0 deletions packages/jest-worker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
},
"devDependencies": {
"@types/merge-stream": "^1.1.2",
"@types/node": "*",
"@types/supports-color": "^5.3.0",
"get-stream": "^5.1.0",
"worker-farm": "^1.6.0"
Expand Down
6 changes: 5 additions & 1 deletion packages/test-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
"main": "build/index.js",
"types": "build/index.d.ts",
"dependencies": {
"@types/jest": "*",
"@types/node": "*",
"@types/semver": "^6.2.1",
"ansi-regex": "^5.0.0",
"ansi-styles": "^4.1.0"
"ansi-styles": "^4.1.0",
"semver": "^6.3.0"
}
}
9 changes: 2 additions & 7 deletions scripts/buildTs.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,7 @@ const packagesWithTs = packages.filter(p =>
);

const args = [
'--max-old-space-size=4096',
path.resolve(
require.resolve('typescript/package.json'),
'..',
require('typescript/package.json').bin.tsc
),
'tsc',
'-b',
...packagesWithTs,
...process.argv.slice(2),
Expand All @@ -35,7 +30,7 @@ const args = [
console.log(chalk.inverse('Building TypeScript definition files'));

try {
execa.sync('node', args, {stdio: 'inherit'});
execa.sync('yarn', args, {stdio: 'inherit'});
console.log(
chalk.inverse.green('Successfully built TypeScript definition files')
);
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"exclude": [
".yarn/releases/*",
"**/__tests__/**/*",
"**/__mocks__/**/*",
"**/build/**/*",
"**/build-es5/**/*"
]
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2028,7 +2028,7 @@
resolved "https://registry.yarnpkg.com/@types/ci-info/-/ci-info-2.0.0.tgz#51848cc0f5c30c064f4b25f7f688bf35825b3971"
integrity sha512-5R2/MHILQLDCzTuhs1j4Qqq8AaKUf7Ma4KSSkCtc12+fMs47zfa34qhto9goxpyX00tQK1zxB885VCiawZ5Qhg==

"@types/co@^4.6.0":
"@types/co@^4.6.0", "@types/co@^4.6.2":
version "4.6.2"
resolved "https://registry.yarnpkg.com/@types/co/-/co-4.6.2.tgz#027177ea7a3e34adbd55424e8b949fceb80fda32"
integrity sha512-tCPGk0b+zVZgFq6JovNM9MPH78BdLBE4RQMa21GCe2LhSs91kCSegS2Qdpb1NdRmfa7Asay9+rY2u1Z8Iw0s8A==
Expand Down Expand Up @@ -2316,7 +2316,7 @@
dependencies:
"@types/node" "*"

"@types/semver@^6.0.1":
"@types/semver@^6.0.1", "@types/semver@^6.2.1":
version "6.2.1"
resolved "https://registry.yarnpkg.com/@types/semver/-/semver-6.2.1.tgz#a236185670a7860f1597cf73bea2e16d001461ba"
integrity sha512-+beqKQOh9PYxuHvijhVl+tIHvT6tuwOrE9m14zd+MT2A38KoKZhh7pYJ0SNleLtwDsiIxHDsIk9bv01oOxvSvA==
Expand Down Expand Up @@ -2386,7 +2386,7 @@
dependencies:
"@types/yargs-parser" "*"

"@types/yargs@^15.0.0":
"@types/yargs@^15.0.0", "@types/yargs@^15.0.3":
version "15.0.3"
resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-15.0.3.tgz#41453a0bc7ab393e995d1f5451455638edbd2baf"
integrity sha512-XCMQRK6kfpNBixHLyHUsGmXrpEmFFxzMrcnSXFMziHd8CoNJo8l16FkHyQq4x+xbM7E2XL83/O78OD8u+iZTdQ==
Expand Down

0 comments on commit 1db89ce

Please sign in to comment.