Anyone using JEST is a SuiteApp SDF project. I ca...
# sdf
e
Anyone using JEST is a SuiteApp SDF project. I can seem to get the import paths correct I'm my tests. The examples is the GitHub project are incomplete and only showcase Account Customization projects
s
you could look at the NFT unit tests for an alternate but similar approach (and it's a known working overall configuration for jest and netsuite)
d
So, I discovered something. Because I'm using TypeScript, my exports are directly against the
exports
object (there is no RETURNed object).
This is 'one' of the issues I'm having. @stalbert, is there a way to have the typescript compiler add that to the output?
s
add what to the output? Oh wait - what I do to make Jest testing easy is to compile to UMD format.
That emits code that works in both AMD (netsuite) or CommonJS (node/jest)
hope that helps
d
I added this at the end of my Typescript file (Restlet)
Copy code
export = {get : get};
The compiler complains, but it spits out the
return
object like I want it
s
are you compiling to UMD?
but yes that's a good point - we've used the
export =
syntax for years though I know it's now discouraged
I like the terse syntax
by the way, you could also just export the top level items directly
we don't because we put things in a namespace first to give something for
autoLogging
to grab onto
e.g.
export function get(){}
instead of
export = {get:get}
d
The problem there is, the generated module does an
exports.get = get;
when I need a
return {get : get}
s
if you compile for UMD it should return when it needs to and assign to exports when it needs to - i.e. work in both scenarios