Azure / azure-sdk-for-js

This repository is for active development of the Azure SDK for JavaScript (NodeJS & Browser). For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/javascript/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-js.
MIT License
2.03k stars 1.19k forks source link

Failed to run typecheck command in vitest test code #30962

Open kazrael2119 opened 2 weeks ago

kazrael2119 commented 2 weeks ago

command: dev-tool run typecheck package path: sdk\core\core-lro

error message:

$ dev-tool run typecheck
[typecheck] type-checking...
[typecheck] ../../../common/temp/node_modules/.pnpm/@types+chai@4.3.18/node_modules/@types/chai/index.d.ts:1:1 - error TS6200: Definitions of the following identifiers conflict with those in another file: Message, ObjectProperty, ChaiPlugin, AssertionArgs, Operator, OperatorComparable, AssertionError, chai

1 declare namespace Chai {
  ~~~~~~~

  ../../../common/temp/node_modules/.pnpm/@vitest+expect@2.0.5/node_modules/@vitest/expect/dist/chai.d.cts:16:1
    16 declare namespace Chai {
       ~~~~~~~
    Conflicts are in this file.
../../../common/temp/node_modules/.pnpm/@vitest+expect@2.0.5/node_modules/@vitest/expect/dist/chai.d.cts:16:1 - error TS6200: Definitions of the following identifiers conflict with those in another file: Message, ObjectProperty, ChaiPlugin, AssertionArgs, Operator, OperatorComparable, AssertionError, chai

16 declare namespace Chai {
   ~~~~~~~

  ../../../common/temp/node_modules/.pnpm/@types+chai@4.3.18/node_modules/@types/chai/index.d.ts:1:1
    1 declare namespace Chai {
      ~~~~~~~
    Conflicts are in this file.
../../../common/temp/node_modules/.pnpm/vite-node@2.0.5_@types+node@18.19.46/node_modules/vite-node/dist/index-CCsqCcr7.d.ts:88:14 - error TS2304: Cannot find name 'WebSocket'.

88   webSocket: WebSocket
                ~~~~~~~~~
../../../common/temp/node_modules/.pnpm/vite-node@2.0.5_@types+node@18.19.46/node_modules/vite-node/dist/server.d.ts:1:10 - error TS2305: Module '"vite"' has no exported member 'TransformResult'.

1 import { TransformResult, ViteDevServer } from 'vite';
           ~~~~~~~~~~~~~~~
../../../common/temp/node_modules/.pnpm/vite-node@2.0.5_@types+node@18.19.46/node_modules/vite-node/dist/server.d.ts:1:27 - error TS2305: Module '"vite"' has no exported member 'ViteDevServer'.

1 import { TransformResult, ViteDevServer } from 'vite';
                            ~~~~~~~~~~~~~
../../../common/temp/node_modules/.pnpm/vitest@2.0.5_@types+node@18.19.46_@vitest+browser@2.0.5/node_modules/vitest/dist/chunks/reporters.C_zwCd4j.d.ts:4:10 - error TS2305: Module '"vite"' has no exported member 'ViteDevServer'.

4 import { ViteDevServer, TransformResult as TransformResult$1, UserConfig as UserConfig$1, ConfigEnv, ServerOptions, DepOptimizationConfig, AliasOptions } from 'vite';
           ~~~~~~~~~~~~~
../../../common/temp/node_modules/.pnpm/vitest@2.0.5_@types+node@18.19.46_@vitest+browser@2.0.5/node_modules/vitest/dist/chunks/reporters.C_zwCd4j.d.ts:4:25 - error TS2305: Module '"vite"' has no exported member 'TransformResult'.

4 import { ViteDevServer, TransformResult as TransformResult$1, UserConfig as UserConfig$1, ConfigEnv, ServerOptions, DepOptimizationConfig, AliasOptions } from 'vite';
                          ~~~~~~~~~~~~~~~
../../../common/temp/node_modules/.pnpm/vitest@2.0.5_@types+node@18.19.46_@vitest+browser@2.0.5/node_modules/vitest/dist/chunks/reporters.C_zwCd4j.d.ts:4:63 - error TS2305: Module '"vite"' has no exported member 'UserConfig'.

4 import { ViteDevServer, TransformResult as TransformResult$1, UserConfig as UserConfig$1, ConfigEnv, ServerOptions, DepOptimizationConfig, AliasOptions } from 'vite';
                                                                ~~~~~~~~~~
../../../common/temp/node_modules/.pnpm/vitest@2.0.5_@types+node@18.19.46_@vitest+browser@2.0.5/node_modules/vitest/dist/chunks/reporters.C_zwCd4j.d.ts:4:91 - error TS2305: Module '"vite"' has no exported member 'ConfigEnv'.

4 import { ViteDevServer, TransformResult as TransformResult$1, UserConfig as UserConfig$1, ConfigEnv, ServerOptions, DepOptimizationConfig, AliasOptions } from 'vite';
                                                                                            ~~~~~~~~~
../../../common/temp/node_modules/.pnpm/vitest@2.0.5_@types+node@18.19.46_@vitest+browser@2.0.5/node_modules/vitest/dist/chunks/reporters.C_zwCd4j.d.ts:4:102 - error TS2305: Module '"vite"' has no exported member 'ServerOptions'.

4 import { ViteDevServer, TransformResult as TransformResult$1, UserConfig as UserConfig$1, ConfigEnv, ServerOptions, DepOptimizationConfig, AliasOptions } from 'vite';
                                                                                                       ~~~~~~~~~~~~~
../../../common/temp/node_modules/.pnpm/vitest@2.0.5_@types+node@18.19.46_@vitest+browser@2.0.5/node_modules/vitest/dist/chunks/reporters.C_zwCd4j.d.ts:4:117 - error TS2305: Module '"vite"' has no exported member 'DepOptimizationConfig'.

4 import { ViteDevServer, TransformResult as TransformResult$1, UserConfig as UserConfig$1, ConfigEnv, ServerOptions, DepOptimizationConfig, AliasOptions } from 'vite';
                                                                                                                      ~~~~~~~~~~~~~~~~~~~~~
../../../common/temp/node_modules/.pnpm/vitest@2.0.5_@types+node@18.19.46_@vitest+browser@2.0.5/node_modules/vitest/dist/chunks/reporters.C_zwCd4j.d.ts:4:140 - error TS2305: Module '"vite"' has no exported member 'AliasOptions'.

4 import { ViteDevServer, TransformResult as TransformResult$1, UserConfig as UserConfig$1, ConfigEnv, ServerOptions, DepOptimizationConfig, AliasOptions } from 'vite';
                                                                                                                                             ~~~~~~~~~~~~
../../../common/temp/node_modules/.pnpm/vitest@2.0.5_@types+node@18.19.46_@vitest+browser@2.0.5/node_modules/vitest/dist/chunks/reporters.C_zwCd4j.d.ts:643:45 - error TS2503: Cannot find namespace 'vite'.

643     getModulesByFilepath(file: string): Set<vite.ModuleNode>;
                                                ~~~~
../../../common/temp/node_modules/.pnpm/vitest@2.0.5_@types+node@18.19.46_@vitest+browser@2.0.5/node_modules/vitest/dist/chunks/reporters.C_zwCd4j.d.ts:644:32 - error TS2503: Cannot find namespace 'vite'.

644     getModuleById(id: string): vite.ModuleNode | undefined;
                                   ~~~~
../../../common/temp/node_modules/.pnpm/vitest@2.0.5_@types+node@18.19.46_@vitest+browser@2.0.5/node_modules/vitest/dist/chunks/reporters.C_zwCd4j.d.ts:2675:16 - error TS2671: Cannot augment module 'vite' because it resolves to a non-module entity.

2675 declare module 'vite' {
                    ~~~~~~

[dev-tool] Errors occured. See the output above.

only remove"./test/**/*.ts" under include from tsconfig.json, this command could pass

MaryGao commented 2 weeks ago

@jeremymeng it seems this is a general issue when we try to run typecheck in vitest. not sure we should just ignore this or any way we could fix it.

jeremymeng commented 2 weeks ago

@MaryGao It's this issue https://github.com/vitest-dev/vitest/issues/4688. Can you work around by adding "skipLibCheck": true to tsconfig.json?

kazrael2119 commented 1 week ago

skipLibCheck": true

It works with adding this config

xirzec commented 1 week ago

/cc @mpodwysocki