Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing dependency on @types/node to all packages #10248

Merged
merged 9 commits into from Jul 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -13,6 +13,7 @@

### Chore & Maintenance

- `[*]` Add missing dependency on `@types/node` ([#10248](https://github.com/facebook/jest/pull/10248))
- `[jest-jasmine2]` Convert `PCancelable` to TypeScript ([#10215](https://github.com/facebook/jest/pull/10215))
- `[jest-jasmine2]` Refine typings of `queueRunner` ([#10215](https://github.com/facebook/jest/pull/10215))
- `[jest-jasmine2]` Remove usage of `Function` type ([#10216](https://github.com/facebook/jest/pull/10216))
Expand Down
1 change: 1 addition & 0 deletions packages/jest-circus/package.json
Expand Up @@ -14,6 +14,7 @@
"@jest/environment": "^26.1.0",
"@jest/test-result": "^26.1.0",
"@jest/types": "^26.1.0",
"@types/node": "*",
"chalk": "^4.0.0",
"co": "^4.6.0",
"dedent": "^0.7.0",
Expand Down
1 change: 1 addition & 0 deletions packages/jest-console/package.json
Expand Up @@ -11,6 +11,7 @@
"types": "build/index.d.ts",
"dependencies": {
"@jest/types": "^26.1.0",
"@types/node": "*",
"chalk": "^4.0.0",
"jest-message-util": "^26.1.0",
"jest-util": "^26.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-core/package.json
Expand Up @@ -10,6 +10,7 @@
"@jest/test-result": "^26.1.0",
"@jest/transform": "^26.1.0",
"@jest/types": "^26.1.0",
"@types/node": "*",
"ansi-escapes": "^4.2.1",
"chalk": "^4.0.0",
"exit": "^0.1.2",
Expand Down Expand Up @@ -38,7 +39,6 @@
"@types/exit": "^0.1.30",
"@types/graceful-fs": "^4.1.2",
"@types/micromatch": "^4.0.0",
"@types/node": "*",
"@types/rimraf": "^3.0.0",
"jest-snapshot-serializer-raw": "^1.1.0"
},
Expand Down
1 change: 1 addition & 0 deletions packages/jest-environment-jsdom/package.json
Expand Up @@ -13,6 +13,7 @@
"@jest/environment": "^26.1.0",
"@jest/fake-timers": "^26.1.0",
"@jest/types": "^26.1.0",
"@types/node": "*",
"jest-mock": "^26.1.0",
"jest-util": "^26.1.0",
"jsdom": "^16.2.2"
Expand Down
1 change: 1 addition & 0 deletions packages/jest-environment-node/package.json
Expand Up @@ -13,6 +13,7 @@
"@jest/environment": "^26.1.0",
"@jest/fake-timers": "^26.1.0",
"@jest/types": "^26.1.0",
"@types/node": "*",
"jest-mock": "^26.1.0",
"jest-util": "^26.1.0"
},
Expand Down
4 changes: 1 addition & 3 deletions packages/jest-environment/package.json
Expand Up @@ -12,11 +12,9 @@
"dependencies": {
"@jest/fake-timers": "^26.1.0",
"@jest/types": "^26.1.0",
"@types/node": "*",
"jest-mock": "^26.1.0"
},
"devDependencies": {
"@types/node": "*"
},
"engines": {
"node": ">= 10.14.2"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-fake-timers/package.json
Expand Up @@ -12,12 +12,12 @@
"dependencies": {
"@jest/types": "^26.1.0",
"@sinonjs/fake-timers": "^6.0.1",
"@types/node": "*",
"jest-message-util": "^26.1.0",
"jest-mock": "^26.1.0",
"jest-util": "^26.1.0"
},
"devDependencies": {
"@types/node": "*",
"@types/sinonjs__fake-timers": "^6.0.1"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-globals/tsconfig.json
Expand Up @@ -2,7 +2,7 @@
"extends": "../../tsconfig.json",
"compilerOptions": {
// we don't want `@types/jest` to be referenced
"types": ["node"],
"types": [],
"rootDir": "src",
"outDir": "build"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-haste-map/package.json
Expand Up @@ -12,6 +12,7 @@
"dependencies": {
"@jest/types": "^26.1.0",
"@types/graceful-fs": "^4.1.2",
"@types/node": "*",
"anymatch": "^3.0.3",
"fb-watchman": "^2.0.0",
"graceful-fs": "^4.2.4",
Expand All @@ -28,7 +29,6 @@
"@types/anymatch": "^1.3.1",
"@types/fb-watchman": "^2.0.0",
"@types/micromatch": "^4.0.0",
"@types/node": "*",
"@types/sane": "^2.0.0",
"@types/which": "^1.3.2"
},
Expand Down
1 change: 1 addition & 0 deletions packages/jest-jasmine2/package.json
Expand Up @@ -15,6 +15,7 @@
"@jest/source-map": "^26.1.0",
"@jest/test-result": "^26.1.0",
"@jest/types": "^26.1.0",
"@types/node": "*",
"chalk": "^4.0.0",
"co": "^4.6.0",
"expect": "^26.1.0",
Expand Down
4 changes: 1 addition & 3 deletions packages/jest-mock/package.json
Expand Up @@ -10,9 +10,7 @@
"node": ">= 10.14.2"
},
"dependencies": {
"@jest/types": "^26.1.0"
},
"devDependencies": {
"@jest/types": "^26.1.0",
"@types/node": "*"
},
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-runner/package.json
Expand Up @@ -14,6 +14,7 @@
"@jest/environment": "^26.1.0",
"@jest/test-result": "^26.1.0",
"@jest/types": "^26.1.0",
"@types/node": "*",
"chalk": "^4.0.0",
"exit": "^0.1.2",
"graceful-fs": "^4.2.4",
Expand All @@ -33,7 +34,6 @@
"devDependencies": {
"@types/exit": "^0.1.30",
"@types/graceful-fs": "^4.1.2",
"@types/node": "*",
"@types/source-map-support": "^0.5.0",
"jest-circus": "^26.1.0"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/jest-serializer/package.json
Expand Up @@ -7,10 +7,10 @@
"directory": "packages/jest-serializer"
},
"devDependencies": {
"@types/graceful-fs": "^4.1.3",
"@types/node": "*"
"@types/graceful-fs": "^4.1.3"
},
"dependencies": {
"@types/node": "*",
"graceful-fs": "^4.2.4"
},
"engines": {
Expand Down
4 changes: 1 addition & 3 deletions packages/jest-types/package.json
Expand Up @@ -15,12 +15,10 @@
"dependencies": {
"@types/istanbul-lib-coverage": "^2.0.0",
"@types/istanbul-reports": "^1.1.1",
"@types/node": "*",
"@types/yargs": "^15.0.0",
"chalk": "^4.0.0"
},
"devDependencies": {
"@types/node": "*"
},
"publishConfig": {
"access": "public"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/jest-util/package.json
Expand Up @@ -11,6 +11,7 @@
"types": "build/index.d.ts",
"dependencies": {
"@jest/types": "^26.1.0",
"@types/node": "*",
"chalk": "^4.0.0",
"graceful-fs": "^4.2.4",
"is-ci": "^2.0.0",
Expand All @@ -19,8 +20,7 @@
"devDependencies": {
"@types/graceful-fs": "^4.1.2",
"@types/is-ci": "^2.0.0",
"@types/micromatch": "^4.0.0",
"@types/node": "*"
"@types/micromatch": "^4.0.0"
},
"engines": {
"node": ">= 10.14.2"
Expand Down
4 changes: 1 addition & 3 deletions packages/jest-watcher/package.json
Expand Up @@ -7,14 +7,12 @@
"dependencies": {
"@jest/test-result": "^26.1.0",
"@jest/types": "^26.1.0",
"@types/node": "*",
"ansi-escapes": "^4.2.1",
"chalk": "^4.0.0",
"jest-util": "^26.1.0",
"string-length": "^4.0.1"
},
"devDependencies": {
"@types/node": "*"
},
"repository": {
"type": "git",
"url": "https://github.com/facebook/jest",
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-worker/package.json
Expand Up @@ -10,12 +10,12 @@
"main": "build/index.js",
"types": "build/index.d.ts",
"dependencies": {
"@types/node": "*",
"merge-stream": "^2.0.0",
"supports-color": "^7.0.0"
},
"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
25 changes: 23 additions & 2 deletions scripts/buildTs.js
Expand Up @@ -32,7 +32,7 @@ packagesWithTs.forEach(pkgDir => {

assert.ok(pkg.types, `Package ${pkg.name} is missing \`types\` field`);

assert.equal(
assert.strictEqual(
pkg.types,
pkg.main.replace(/\.js$/, '.d.ts'),
`\`main\` and \`types\` field of ${pkg.name} does not match`,
Expand Down Expand Up @@ -72,8 +72,11 @@ Promise.all(
globbed.map(file => Promise.all([file, readFilePromise(file, 'utf8')])),
);

const filesWithReferences = files
const filesWithTypeReferences = files
.filter(([, content]) => content.includes('/// <reference types'))
.filter(hit => hit.length > 0);

const filesWithReferences = filesWithTypeReferences
.map(([name, content]) => [
name,
content
Expand All @@ -98,6 +101,24 @@ Promise.all(

process.exit(1);
}

const filesWithNodeReference = filesWithTypeReferences.map(
([filename]) => filename,
);

if (filesWithNodeReference.length > 0) {
const pkg = require(pkgDir + '/package.json');

assert.ok(
pkg.dependencies,
`Package \`${pkg.name}\` is missing \`dependencies\``,
);
assert.strictEqual(
pkg.dependencies['@types/node'],
'*',
`Package \`${pkg.name}\` is missing a dependency on \`@types/node\``,
);
}
}),
),
).catch(e => {
Expand Down
4 changes: 4 additions & 0 deletions yarn.lock
Expand Up @@ -11036,6 +11036,7 @@ fsevents@^1.2.7:
"@types/co": ^4.6.0
"@types/dedent": ^0.7.0
"@types/graceful-fs": ^4.1.3
"@types/node": "*"
"@types/stack-utils": ^1.0.1
chalk: ^4.0.0
co: ^4.6.0
Expand Down Expand Up @@ -11155,6 +11156,7 @@ fsevents@^1.2.7:
"@jest/fake-timers": ^26.1.0
"@jest/types": ^26.1.0
"@types/jsdom": ^16.2.1
"@types/node": "*"
jest-mock: ^26.1.0
jest-util: ^26.1.0
jsdom: ^16.2.2
Expand All @@ -11168,6 +11170,7 @@ fsevents@^1.2.7:
"@jest/environment": ^26.1.0
"@jest/fake-timers": ^26.1.0
"@jest/types": ^26.1.0
"@types/node": "*"
jest-mock: ^26.1.0
jest-util: ^26.1.0
languageName: unknown
Expand Down Expand Up @@ -11250,6 +11253,7 @@ fsevents@^1.2.7:
"@jest/types": ^26.1.0
"@types/babel__traverse": ^7.0.4
"@types/co": ^4.6.2
"@types/node": "*"
chalk: ^4.0.0
co: ^4.6.0
expect: ^26.1.0
Expand Down