-
Notifications
You must be signed in to change notification settings - Fork 8
Why transpile to files instead of in memory?
Suman has full support for both in-memory and disk transpilation for JS based tests. Suman does not have a preference, but in general Suman may encourage developers to transpile test source to disk.
There are at least 3 good reasons for this:
-
If you have already transpiled the file, and the source files haven't changed since, then you don't need to transpile again! Saves time when executing the tests. This is a big one :) In other words, maybe your application code has changed, but your test source hasn't. So just run the test target files, without re-transpiling them.
-
Transpiled test files on disk helps you debug, in this case of transpilation issues, etc. Babel, TypeScript, etc, are still not perfect.
-
Code coverage - you will want/need to run Istanbul against your target files instead of source files.
On the other hand, the advantages of in-memory are significant. The biggest advantage is:
- By monkey-patching require(), babel-register and ts-node can ensure all relevant files get transpiled. It can be difficult to ensure all source gets included and transpiled when writing target files to disk.