output
output.module
output.module
Whether to output JavaScript files in ES module format.
Rstest outputs and executes test code in CommonJS format by default. If you want to output test code in ES module format, you can enable it through the following configuration:
output.externals
output.externals
Prevent some import dependencies from being packed into bundles in your code, and instead Rstest will import them at runtime.
- In the Node.js test environment, Rstest will bundle and transpile the following files by default:
- Any TypeScript and JSX files in any directory, with file extensions
.ts,.tsx,.jsx,.mts,.cts. - JavaScript files outside the
node_modulesdirectory, with file extensions.js,.mjs,.cjs.
- Any TypeScript and JSX files in any directory, with file extensions
- In the browser-like (jsdom, etc) test environment, all packages are bundled by default.
If you want a dependency to be externalized, you can configure it in output.externals.
If you want all dependencies to be bundled, you can configure it through the following configuration:
Specify external type
You can use ${externalsType} ${libraryName} syntax to specify the external type of a dependency.
For example, you can use commonjs lodash to specify that lodash should be externalized as a CommonJS module:
You can also specify the default external type for all dependencies through the externalsType configuration option.
output.cssModules
output.cssModules
For custom CSS Modules configuration.
output.cleanDistPath
output.cleanDistPath
Whether to clean up all test temporary files under the output directory before the test starts.
By default, rstest does not write test temporary files to disk, and this configuration item may be required when you debug rstest outputs.