From 973e231b4fcd7a0523b7fd175137bce4ea491b5c Mon Sep 17 00:00:00 2001 From: PeachScript Date: Thu, 7 Sep 2023 11:10:50 +0800 Subject: [PATCH] test: correct type error for build cases --- .../build/bundle-alias-tsconfig/tsconfig.json | 14 ++------------ tests/fixtures/build/bundle-targets/src/index.ts | 2 +- tests/fixtures/build/bundless-alias/tsconfig.json | 3 +-- .../build/bundless-babel-targets/src/index.ts | 2 +- .../fixtures/build/bundless-diff-dts/tsconfig.json | 1 + .../build/bundless-esbuild-targets/src/index.ts | 2 +- .../fixtures/build/bundless-include-dts/expect.ts | 2 +- .../build/bundless-include-dts/tsconfig.json | 4 +++- .../build/bundless-outer-paths/tsconfig.json | 5 ++--- .../build/bundless-swc-alias/tsconfig.json | 3 +-- .../build/bundless-swc-targets/src/index.ts | 2 +- tests/fixtures/build/tsconfig.json | 7 +++---- 12 files changed, 18 insertions(+), 29 deletions(-) diff --git a/tests/fixtures/build/bundle-alias-tsconfig/tsconfig.json b/tests/fixtures/build/bundle-alias-tsconfig/tsconfig.json index 1228d9f4..6eb0b932 100644 --- a/tests/fixtures/build/bundle-alias-tsconfig/tsconfig.json +++ b/tests/fixtures/build/bundle-alias-tsconfig/tsconfig.json @@ -1,17 +1,7 @@ { + "extends": "../tsconfig.json", "compilerOptions": { - "declaration": true, - "declarationMap": true, - "esModuleInterop": true, - "module": "commonjs", - "moduleResolution": "node", - "noUnusedLocals": true, - "noUnusedParameters": true, - "strict": true, - "skipLibCheck": true, - "target": "es2015", - "jsx": "react", - "baseUrl": ".", + "baseUrl": "./", "paths": { "alias-module": ["./src/alias.ts"], "@/*": ["./src/*"], diff --git a/tests/fixtures/build/bundle-targets/src/index.ts b/tests/fixtures/build/bundle-targets/src/index.ts index 02ae7784..fae80c97 100644 --- a/tests/fixtures/build/bundle-targets/src/index.ts +++ b/tests/fixtures/build/bundle-targets/src/index.ts @@ -2,4 +2,4 @@ async function hello() { return await Promise.resolve('ok'); } -hello(); +export default hello; diff --git a/tests/fixtures/build/bundless-alias/tsconfig.json b/tests/fixtures/build/bundless-alias/tsconfig.json index 3e4f685d..a7fde3d5 100644 --- a/tests/fixtures/build/bundless-alias/tsconfig.json +++ b/tests/fixtures/build/bundless-alias/tsconfig.json @@ -1,8 +1,7 @@ { + "extends": "../tsconfig.json", "compilerOptions": { - "strict": true, "declaration": true, - "skipLibCheck": true, "baseUrl": "./", "paths": { "@/*": ["./src/*"], diff --git a/tests/fixtures/build/bundless-babel-targets/src/index.ts b/tests/fixtures/build/bundless-babel-targets/src/index.ts index 02ae7784..fae80c97 100644 --- a/tests/fixtures/build/bundless-babel-targets/src/index.ts +++ b/tests/fixtures/build/bundless-babel-targets/src/index.ts @@ -2,4 +2,4 @@ async function hello() { return await Promise.resolve('ok'); } -hello(); +export default hello; diff --git a/tests/fixtures/build/bundless-diff-dts/tsconfig.json b/tests/fixtures/build/bundless-diff-dts/tsconfig.json index 6b0eea50..52547fe0 100644 --- a/tests/fixtures/build/bundless-diff-dts/tsconfig.json +++ b/tests/fixtures/build/bundless-diff-dts/tsconfig.json @@ -1,4 +1,5 @@ { + "extends": "../tsconfig.json", "compilerOptions": { "declaration": true } diff --git a/tests/fixtures/build/bundless-esbuild-targets/src/index.ts b/tests/fixtures/build/bundless-esbuild-targets/src/index.ts index 02ae7784..fae80c97 100644 --- a/tests/fixtures/build/bundless-esbuild-targets/src/index.ts +++ b/tests/fixtures/build/bundless-esbuild-targets/src/index.ts @@ -2,4 +2,4 @@ async function hello() { return await Promise.resolve('ok'); } -hello(); +export default hello; diff --git a/tests/fixtures/build/bundless-include-dts/expect.ts b/tests/fixtures/build/bundless-include-dts/expect.ts index d69ae731..99617f4a 100644 --- a/tests/fixtures/build/bundless-include-dts/expect.ts +++ b/tests/fixtures/build/bundless-include-dts/expect.ts @@ -1,4 +1,4 @@ export default (files: Record) => { // expect global types to be included - expect(files['esm/index.d.js']).toContain(': string;'); + expect(files['esm/index.d.ts']).toContain(': string;'); }; diff --git a/tests/fixtures/build/bundless-include-dts/tsconfig.json b/tests/fixtures/build/bundless-include-dts/tsconfig.json index f141b36e..52547fe0 100644 --- a/tests/fixtures/build/bundless-include-dts/tsconfig.json +++ b/tests/fixtures/build/bundless-include-dts/tsconfig.json @@ -1,4 +1,6 @@ { "extends": "../tsconfig.json", - "include": ["global.d.ts", "src/**/*.ts"] + "compilerOptions": { + "declaration": true + } } diff --git a/tests/fixtures/build/bundless-outer-paths/tsconfig.json b/tests/fixtures/build/bundless-outer-paths/tsconfig.json index 1ed57949..c9bb6bee 100644 --- a/tests/fixtures/build/bundless-outer-paths/tsconfig.json +++ b/tests/fixtures/build/bundless-outer-paths/tsconfig.json @@ -1,9 +1,8 @@ { + "extends": "../tsconfig.json", "compilerOptions": { - "strict": true, - "skipLibCheck": true, "declaration": true, - "baseUrl": ".", + "baseUrl": "./", "paths": { "@bundless-overrides": ["../bundless-overrides/src/client"] } diff --git a/tests/fixtures/build/bundless-swc-alias/tsconfig.json b/tests/fixtures/build/bundless-swc-alias/tsconfig.json index 3e4f685d..a7fde3d5 100644 --- a/tests/fixtures/build/bundless-swc-alias/tsconfig.json +++ b/tests/fixtures/build/bundless-swc-alias/tsconfig.json @@ -1,8 +1,7 @@ { + "extends": "../tsconfig.json", "compilerOptions": { - "strict": true, "declaration": true, - "skipLibCheck": true, "baseUrl": "./", "paths": { "@/*": ["./src/*"], diff --git a/tests/fixtures/build/bundless-swc-targets/src/index.ts b/tests/fixtures/build/bundless-swc-targets/src/index.ts index 02ae7784..fae80c97 100644 --- a/tests/fixtures/build/bundless-swc-targets/src/index.ts +++ b/tests/fixtures/build/bundless-swc-targets/src/index.ts @@ -2,4 +2,4 @@ async function hello() { return await Promise.resolve('ok'); } -hello(); +export default hello; diff --git a/tests/fixtures/build/tsconfig.json b/tests/fixtures/build/tsconfig.json index 57c4da7c..af51a745 100644 --- a/tests/fixtures/build/tsconfig.json +++ b/tests/fixtures/build/tsconfig.json @@ -1,8 +1,7 @@ { - "extends": "../../../tsconfig.json", "compilerOptions": { - "rootDir": ".", + "strict": true, + "skipLibCheck": true, "jsx": "react" - }, - "include": ["**/*.ts", "**/*.tsx"] + } }