Forum Discussion
Awesome, but I'm wondering what is the purpose of import/export then. Why does TC even have that? just curious.
Thanks, I'll give //USEUNIT a try.
Import/export is part of JavaScript, usuable outside of the TestComplete environment. so, it's not a matter of it being something that TestComplete does but just native to JavaScript.
TestComplete includes the //USEUNIT support for those situations where someone has converted a JScript project to JavaScript so that little editing needs to be done. THAT is part of TestComplete.
As mentioned, you CAN use modules.export to export an object... There's a few different ways you can do that, but, in essence, anything you want available in other units needs to be exported somehow if you're going to go that route.
See https://support.smartbear.com/testcomplete/docs/scripting/calling-routines/declared-in-another-unit/javascript.html
- CSL8 years agoContributor
Thanks