Skip to content

Commit 1ddde63

Browse files
committed
build: adjust dts test setup
1 parent d10a81e commit 1ddde63

28 files changed

+50
-45
lines changed

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ module.exports = {
3232
overrides: [
3333
// tests, no restrictions (runs in Node / jest with jsdom)
3434
{
35-
files: ['**/__tests__/**', 'test-dts/**'],
35+
files: ['**/__tests__/**', 'packages/dts-test/**'],
3636
rules: {
3737
'no-restricted-globals': 'off',
3838
'no-restricted-syntax': 'off',

package.json

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"test-unit": "vitest -c vitest.unit.config.ts",
1818
"test-e2e": "node scripts/build.mjs vue -f global -d && vitest -c vitest.e2e.config.ts",
1919
"test-dts": "run-s build-dts test-dts-only",
20-
"test-dts-only": "tsc -p ./test-dts/tsconfig.build.json",
20+
"test-dts-only": "tsc -p ./packages/dts-test/tsconfig.test.json",
2121
"test-coverage": "vitest -c vitest.unit.config.ts --coverage",
2222
"release": "node scripts/release.mjs",
2323
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
@@ -37,7 +37,6 @@
3737
"preinstall": "node ./scripts/preinstall.mjs",
3838
"postinstall": "simple-git-hooks"
3939
},
40-
"types": "test-dts/index.d.ts",
4140
"simple-git-hooks": {
4241
"pre-commit": "pnpm lint-staged && pnpm check",
4342
"commit-msg": "node scripts/verifyCommit.mjs"
@@ -69,9 +68,6 @@
6968
"@typescript-eslint/parser": "^5.23.0",
7069
"@vitest/coverage-istanbul": "^0.28.2",
7170
"@vue/consolidate": "0.17.3",
72-
"@vue/reactivity": "workspace:*",
73-
"@vue/runtime-core": "workspace:*",
74-
"@vue/runtime-dom": "workspace:*",
7571
"brotli": "^1.3.2",
7672
"chalk": "^4.1.0",
7773
"conventional-changelog-cli": "^2.0.31",
@@ -105,7 +101,6 @@
105101
"tslib": "^2.4.0",
106102
"typescript": "^4.9.0",
107103
"vite": "^4.0.4",
108-
"vitest": "^0.28.2",
109-
"vue": "workspace:*"
104+
"vitest": "^0.28.2"
110105
}
111106
}

packages/dts-test/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# dts-test
2+
3+
Tests Typescript types to ensure the types remain as expected.
4+
5+
- This directory is included in the root `tsconfig.json`, where package imports are aliased to `src` directories, so in IDEs and the `pnpm check` script the types are validated against source code.
6+
7+
- When runnong `tsc` with `packages/dts-test/tsconfig.test.json`, packages are resolved using using normal `node` resolution, so the types are validated against actual **built** types. This requires the types to be built first via `pnpm build-types`.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

test-dts/index.d.ts renamed to packages/dts-test/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// This directory contains a number of d.ts assertions
22
// use \@ts-expect-error where errors are expected.
33

4-
export * from '@vue/runtime-dom'
4+
export * from 'vue'
55

66
export function describe(_name: string, _fn: () => void): void
77
export function test(_name: string, _fn: () => any): void
File renamed without changes.

packages/dts-test/package.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "dts-test",
3+
"private": true,
4+
"dependencies": {
5+
"vue": "workspace:*",
6+
"@vue/runtime-core": "workspace:*",
7+
"@vue/runtime-dom": "workspace:*",
8+
"@vue/reactivity": "workspace:*"
9+
}
10+
}

test-dts/reactivityMacros.test-d.ts renamed to packages/dts-test/reactivityMacros.test-d.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1-
import { WritableComputedRef } from '@vue/reactivity'
2-
import { expectType, ref, computed, Ref, ComputedRef } from './index'
1+
import {
2+
expectType,
3+
ref,
4+
computed,
5+
Ref,
6+
ComputedRef,
7+
WritableComputedRef
8+
} from './index'
39
import 'vue/macros-global'
410
import { RefType, RefTypes } from 'vue/macros'
511

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

packages/runtime-core/src/apiSetupHelpers.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { ComponentPropsOptions } from '@vue/runtime-core'
21
import { isArray, isPromise, isFunction } from '@vue/shared'
32
import {
43
getCurrentInstance,
@@ -8,7 +7,11 @@ import {
87
unsetCurrentInstance
98
} from './component'
109
import { EmitFn, EmitsOptions } from './componentEmits'
11-
import { ComponentObjectPropsOptions, ExtractPropTypes } from './componentProps'
10+
import {
11+
ComponentPropsOptions,
12+
ComponentObjectPropsOptions,
13+
ExtractPropTypes
14+
} from './componentProps'
1215
import { warn } from './warning'
1316

1417
// dev only

pnpm-lock.yaml

Lines changed: 12 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/aliases.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ const entries = {
2222
const nonSrcPackages = [
2323
'sfc-playground',
2424
'size-check',
25-
'template-explorer'
25+
'template-explorer',
26+
'dts-test'
2627
]
2728

2829
for (const dir of dirs) {

test-dts/README.md

Lines changed: 0 additions & 13 deletions
This file was deleted.

test-dts/tsconfig.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

tsconfig.build.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
"packages/template-explorer",
1111
"packages/sfc-playground",
1212
"packages/size-check",
13-
"test-dts"
13+
"packages/dts-test"
1414
]
1515
}

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@
3232
"packages/*/src",
3333
"packages/runtime-dom/types/jsx.d.ts",
3434
"packages/*/__tests__",
35-
"test-dts"
35+
"packages/dts-test"
3636
]
3737
}

0 commit comments

Comments
 (0)