Open zawiasam opened 3 months ago
@zawiasam The problem is that chai switched to ESM with v5 (see Release Notes). This is not supported by the require. You would have to use import()
. However, I do not currently provide this. I first have to learn how to do it. The current workaround would be to downgrade to chai@4.x
@AnWeber Maybe I could help somehow, any hint where I could to start?
@zawiasam With pleasure. It is actually also encapsulated and can therefore be worked on without the big picture. But the problem is complicated enough.
The method runScript
is used to run some text Content as NodeJS Script. In this Script access to all variables is needed and exports needs to be added to the variables after script execution.
Unfortunately, this method does not support ESM or the use of import
. For import()
setting importModuleDynamically
would apparently be necessary, but this is new territory for me.
Another special feature is that the import has to be "bent", or that's my idea. The code acts within httpyac package and therefore has access to httpyac dependencies. In order to have access to deps from the target package, this must be bent. Hence the const mod = createModule(filename);
hack to get require
calls working.
In the Contributing would be a guide on how to debug it, but another approach would be to extract the code and make it run independently and then integrate the features.
Can't import chai for assertions
after sending request
error from vc extension
from CLI
package.json