Skip to content

docs: clarify tsconfig transform settings - #1698

Merged
9aoy merged 3 commits into
mainfrom
9aoy/docs-tsconfig-transform
Aug 7, 2026
Merged

9aoy merged 3 commits into
mainfrom
9aoy/docs-tsconfig-transform

Conversation

@9aoy

@9aoy 9aoy commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

Rstest resolves compilerOptions.paths from the active tsconfig.json, but transform-related compiler options are not imported automatically. This updates the source configuration reference and Jest/Vitest migration guides with the explicit tools.swc and source.decorators setup needed for target and decorator behavior.

Checklist

  • Tests updated (not required; verified the existing Node CLI paths fixture).
  • Documentation updated.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 7, 2026

Copy link
Copy Markdown

Deploying rstest with  Cloudflare Pages  Cloudflare Pages

Latest commit: 49ee3a6
Status: ✅  Deploy successful!
Preview URL: https://4d2daf35.rstest.pages.dev
Branch Preview URL: https://9aoy-docs-tsconfig-transform.rstest.pages.dev

View logs

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9242ad7bac

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread website/docs/en/config/build/source.mdx Outdated

When this option is not set, Rstest detects `tsconfig.json` in each project's root. Its `compilerOptions.paths` mappings are used for module resolution.

Rstest does not use other `compilerOptions` to configure code transformation. Configure the output target with [`tools.swc`](/config/build/tools#toolsswc), and configure decorator syntax explicitly with [`source.decorators`](#sourcedecorators). For example, a project that uses a legacy decorator transform and ES2020 output can use:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Account for the Rslib adapter's decorator inference

When users reuse an Rslib configuration through @rstest/adapter-rslib, this blanket statement is incorrect: withRslibConfig loads the configured/default tsconfig and maps compilerOptions.experimentalDecorators to source.decorators.version = 'legacy' when neither the Rstest nor Rslib config specifies a decorator version. Clarify that explicit configuration is required for the default core path while documenting this adapter exception; otherwise Rslib users are told that a setting already inferred by their integration must be migrated manually.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a94715a35d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread website/docs/en/config/build/source.mdx Outdated
Comment on lines +109 to +110
jsc: {
target: 'es2020',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid combining jsc.target with Rsbuild's env target

In a normal direct Rstest project, Rsbuild already supplies env.targets: ['node >= 20'] to builtin:swc-loader (see packages/core/tests/core/__snapshots__/rsbuild.test.ts.snap lines 203–216), so merging this object leaves both env and jsc.target in the SWC options even though those target mechanisms are mutually exclusive. A user following this exact migration example can therefore get a compilation error instead of ES2020 output; configure env.targets or explicitly remove env before setting jsc.target.

Useful? React with 👍 / 👎.


Rstest uses Rsbuild as the default test build tool instead of Vite. You can view all available build configuration options in [Build Configurations](/config/#build-configurations).

Vite reads selected `tsconfig.json` compiler options when transforming TypeScript. When configuring Rstest directly, it automatically uses `compilerOptions.paths` for module resolution, but does not use `target`, `experimentalDecorators`, or other compiler options to configure its transform. Move those settings to `tools.swc` and `source.decorators`; adapters can inherit or infer additional settings, so refer to the documentation for the [adapter you use](/guide/integration/adapters). See [source.tsconfigPath](/config/build/source#sourcetsconfigpath). If your Vitest config enables Vite's TypeScript paths support or uses a `vite-tsconfig-paths` plugin, remove that Vite-specific setup after confirming the Rstest project uses the intended `tsconfig.json`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Do not migrate TypeScript target as a Vite transform setting

For Vitest projects whose only target setting is compilerOptions.target, Vite's esbuild transform does not use that field to select its output target; Vite controls this through esbuild.target (and build.target for builds). Grouping target with compiler options such as experimentalDecorators and telling users to move it therefore introduces downleveling that was not present in their Vitest run and can change emitted syntax or runtime behavior. Limit this instruction to tsconfig options Vite actually honors and map Vite's real target option separately.

Useful? React with 👍 / 👎.

@9aoy
9aoy merged commit 02e695a into main Aug 7, 2026
10 checks passed
@9aoy
9aoy deleted the 9aoy/docs-tsconfig-transform branch August 7, 2026 10:58
@9aoy 9aoy mentioned this pull request Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant