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 e0add3f
Show file tree
Hide file tree
Showing 27 changed files with 63 additions and 25 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

0 comments on commit e0add3f

Please sign in to comment.