I am creating tests for the current REST API that I am working on. Some tests require that I invoke the REST API with other calls than the main request to set up the data that the main request will use for the test.
I created a package that turns the pm.sendRequest function into an async function that returns a Promise.
I was planning to use this in a package that is specific for this current API, while still having it available for other APIs that I might build in the future.
That led to requiring a package from a second package, which, after some more research, seems that it is not possible currently.
I am doing the same thing, and was able to get around this issue by requiring package a in the request script where I called package b, as well as in package b itself.
Same here. The clumsy workaround is to require the same dependencies in the package and in the calling script, but this is clearly a misfeature. Require should work correctly in packages. The need for this is obvious. It is the same as why we need packages in the first place: sharing and reusing code.
In my case I wrote some general-purpose utilities, then tried to use them in more specialized packages when I ran into this issue.
Thank you for keeping this request in mind. The packages feature could be a really useful feature when this and another couple of issues will be resolved.