How do I import an external library to my tests #2699
-
I have tests that depend on a typespec library that is on npm. This typespec library contains types that I am using in my tests. I have tried adding the package to my devDependencies then adding it to the tests using createTestWrapper method like so: All my tests fail when I add this library autoImport |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @Onokaev, you can find docs on how to setup your test environment included how to include another library in your test host here https://microsoft.github.io/typespec/extending-typespec/basics#testing The test host needs to know ahead of time what are the files that are going to be needed(tsp, js, etc.) which is why you have to register those test libraries. Example here on how to include
|
Beta Was this translation helpful? Give feedback.
Hi @Onokaev, you can find docs on how to setup your test environment included how to include another library in your test host here
https://microsoft.github.io/typespec/extending-typespec/basics#testing
The test host needs to know ahead of time what are the files that are going to be needed(tsp, js, etc.) which is why you have to register those test libraries.
Example here on how to include
@typespec/rest
with theRestTestLibrary