ZenWave360 / karate-ide

The Best OpenSource IDE for KarateDSL.
https://marketplace.visualstudio.com/items?itemName=KarateIDE.karate-ide
Other
9 stars 4 forks source link

Chore/add testing infrastructure #25

Open DanieleCremoniniOwkin opened 1 year ago

DanieleCremoniniOwkin commented 1 year ago

Add testing infrastructure to the project

The project doesn't contain any test infrastructure, which prevents safe refactoring, is needed for bug fixing and is helpful for new developments.

I created the needed infrastructure. One fake test is included.

To run the tests: npm run test from the project root directory.

A caveat: compiling with npm run compile gives some 12 errors such as:

  Overload 1 of 2, '(debugType: string, factory: DebugAdapterDescriptorFactory): Disposable', gave the following error.
    Argument of type 'ProviderDebugAdapter' is not assignable to parameter of type 'DebugAdapterDescriptorFactory'.
      The types returned by 'createDebugAdapterDescriptor(...)' are incompatible between these types.
        Type 'Promise<ProviderResult<DebugAdapterDescriptor>>' is not assignable to type 'ProviderResult<DebugAdapterDescriptor>'.
          Type 'Promise<ProviderResult<DebugAdapterDescriptor>>' is not assignable to type 'Thenable<DebugAdapterDescriptor>'.
            Types of property 'then' are incompatible.
              Type '<TResult1 = ProviderResult<DebugAdapterDescriptor>, TResult2 = never>(onfulfilled?: (value: ProviderResult<DebugAdapterDescriptor>) => TResult1 | PromiseLike<...>, onrejected?: (reason: any) => TResult2 | PromiseLike<...>) => Promise<...>' is not assignable to type '{ <TResult>(onfulfilled?: (value: DebugAdapterDescriptor) => TResult | Thenable<TResult>, onrejected?: (reason: any) => TResult | Thenable<...>): Thenable<...>; <TResult>(onfulfilled?: (value: DebugAdapterDescriptor) => TResult | Thenable<...>, onrejected?: (reason: any) => void): Thenable<...>; <TResult>(onfulfille...'.
                Types of parameters 'onfulfilled' and 'onfulfilled' are incompatible.
                  Types of parameters 'value' and 'value' are incompatible.
                    Type 'ProviderResult<DebugAdapterDescriptor>' is not assignable to type 'DebugAdapterDescriptor'.
                      Type 'Thenable<DebugAdapterDescriptor>' is not assignable to type 'DebugAdapterDescriptor'.
  Overload 2 of 2, '(debugType: string, factory: DebugAdapterDescriptorFactory): Disposable', gave the following error.
    Argument of type 'ProviderDebugAdapter' is not assignable to parameter of type 'DebugAdapterDescriptorFactory'.

several instances of:

TS2339: Property 'joinPath' does not exist on type 'typeof Uri'.

this one

TS2416: Property 'createDebugAdapterDescriptor' in type 'ProviderDebugAdapter' is not assignable to the same property in base type 'DebugAdapterDescriptorFactory'.
  Type '(session: DebugSession, executable: DebugAdapterExecutable) => Promise<ProviderResult<DebugAdapterDescriptor>>' is not assignable to type '{ (session: DebugSession, executable: DebugAdapterExecutable): ProviderResult<DebugAdapterDescriptor>; (session: DebugSession, executable: DebugAdapterExecutable): ProviderResult<...>; }'.

and

TS2322: Type '{ command: string; title: string; tooltip: string; }' is not assignable to type 'string'.

which could depend on my environment but I cannot resolve.

ivangsa commented 1 year ago

It looks good.. Do you want to merge this now or when some tests are aded?

DanieleCremoniniOwkin commented 1 year ago

I'd prefer now.

Can you please fix the build problems I pasted?

Thank you

ivangsa commented 1 year ago

there is also this error

$ vsce package
 ERROR  You should not depend on 'vscode' in your 'dependencies'. Did you mean to add it to 'devDependencies'?
ivangsa commented 1 year ago

npm run compile runs fine on master... I guess this is caused by the dependencies/versions you added