Azure / autorest.typescript

Extension for AutoRest (https://github.com/Azure/autorest) that generates TypeScript code. The transpiled javascript code is isomorphic. It can be run in browser and in node.js environment.
MIT License
177 stars 75 forks source link

Update generated code to use assert from @azure/test-utils #1304

Open maorleger opened 2 years ago

maorleger commented 2 years ago

Once https://github.com/Azure/azure-sdk-for-js/pull/20195 is merged @azure/test-utils will re-export a version of chai preloaded with useful plugins.

This issue tracks updating the generator to use @azure/test-utils instead of chai

  1. generated package.json should not have dependencies on chai
  2. generated package.json should have a dependency on @azure/test-utils
  3. generated test code should import { assert } from "@azure/test-utils" instead of from "chai"

Anything else I might have missed? There's no urgency to this, just the updated PR template reminded me to file an issue here (thanks @sarangan12 !)

sarangan12 commented 2 years ago

I had on offline chat with @maorleger. The gist of our conversation is:

  1. The generator has 2 flavors:
    1. Regular Generator
    2. Rest Generator
  2. The Regular generator does not have any chai dependency. Only the Rest generator has chai dependency.
  3. We could introduce @azure/test-utils dependency to the Rest Generator. (It is Ok to introduce it in the Regular Generator also)
  4. We should remove the chai dependency from the Rest flavor.
  5. But, all of this could be done only when@azure/test-utils package is released to npm. (Or, we could create an internal stream and release it there) @maorleger will work on releasing the package and then update this Issue. After that, we could work on this issue. Until then, we could put this issue in the backlog.