Hi how can I export and import a class to a test using module exports?
This is how I export with module.exports
module.exports = class ExampleClass {
}
How do I import this class to a test?
You can import the class like this Import ExampleClass from 'ExampleClass.js'
Then in the spec file you would initialize the class something like this const example = new ExampleClass;
Then you would have access to the class methods and such.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.