close
logo
Rstest
Guide
Config
API
English
简体中文
Guide
Config
API
English
简体中文
logo
Rstest
Overview

Test Configurations

root
name
include
exclude
setupFiles
projects
update
globals
passWithNoTests
includeSource
testNamePattern
env
retry
testTimeout
hookTimeout
maxConcurrency
pool
isolate
testEnvironment
clearMocks
resetMocks
restoreMocks
unstubEnvs
unstubGlobals
coverage
reporters
hideSkippedTests
slowTestThreshold
snapshotFormat
resolveSnapshotPath
printConsoleTrace
onConsoleLog
disableConsoleIntercept

Build Configurations

plugins
source
output
resolve
tools
dev
performance
📝 Edit this page on GitHub
Previous Pagesource
Next Pageresolve

#output

#output.externals output.externalsoutput.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, all packages in node_modules are externalized by default.
  • 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.

rstest.config.ts
import { defineConfig } from '@rstest/core';

export default defineConfig({
  output: {
    externals: ['react'],
  },
});

If you want all dependencies to be bundled, you can configure it through the following configuration:

rstest.config.ts
import { defineConfig } from '@rstest/core';

export default defineConfig({
  tools: {
    rspack: (config) => {
      config.externals = [];
    },
  },
});

#output.cssModules output.cssModulesoutput.cssModules

For custom CSS Modules configuration.

#output.cleanDistPath output.cleanDistPathoutput.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.