kiota-typescript icon indicating copy to clipboard operation
kiota-typescript copied to clipboard

chore: change to vitest and remove cjs bundling.

Open musale opened this issue 1 year ago • 5 comments

closes #1072, closes #1055

This is a change that is part of a bigger goal to improve our confidence in browser testing and update the codebase to adapt to node/browser environment without throwing errors:

  • adds Vitest as the test framework that has browser testing.
  • drops karma. eventually drop add-ins like Sinon used for mocking and completely build on Vitest.
  • updates test imports to use Vitest API.
  • adds browser testing for the packages.
  • adds utility function to check the environment(node/browser) the code is running in.
  • Fixes browser incompatible code in the codebase.
  • Removes common js bundling tooling and support.

Status

  • [x] abstractions package is updated to vitest and has browser tests
  • [x] authentication/azure package is updated to vitest and has a trigger for browser tests that pass
  • [x] authentication/spfx is updated
  • [x] http is updated.
  • [x] serialization/* is updated.

musale avatar Mar 11 '24 08:03 musale

@baywet I'm having a blocker with completing this. When running the steps to build and test, there's an error with building that comes from having build instructions in tsconfig that outputs commonjs. I think it would be a good idea to make a decision on #1055 to unblock this. What do you think?

musale avatar Mar 18 '24 07:03 musale

Agreed, let's get confirmation on the PM side. If Seb doesn't reply within a few days, please reach out to him directly

baywet avatar Mar 18 '24 12:03 baywet

Hi @musale, Can you please give instructions on how to run the build and tests locally. this is what I get:

npm run build

npm-run-build

npm run test

npm-run-test

koros avatar Apr 22 '24 08:04 koros

Hi @musale, Can you please give instructions on how to run the build and tests locally. this is what I get:

npm run build

npm-run-build

npm run test

npm-run-test

Hi @koros this CI/CD pipeline and build is adapted for a Linux environment. I see you're using PowerShell and this will fail for commands like clean and tsconfig file path resolutions. Please use WSL or a Linux environment to test this.

musale avatar Apr 23 '24 08:04 musale

Hi @musale, Can you please give instructions on how to run the build and tests locally. this is what I get:

npm run build

npm-run-build

npm run test

npm-run-test

Hi @koros this CI/CD pipeline and build is adapted for a Linux environment. I see you're using PowerShell and this will fail for commands like clean and tsconfig file path resolutions. Please use WSL or a Linux environment to test this.

@musale this seems to resolve the issue on Win OS

    "build:@microsoft/*": "lerna run build --scope \"@microsoft/*\"",
    "clean": "lerna run --parallel --stream --scope \"@microsoft/*\" clean",
    "test:browser": "lerna run --scope \"@microsoft/*\" test:browser",
    "test:node": "lerna run --scope \"@microsoft/*\" test:node",

See: https://github.com/magento/pwa-studio/issues/236#issuecomment-422485988

koros avatar May 01 '24 20:05 koros