What happens
When rstack.config.ts only defines define.lint() and define.fmt() (no define.test()), rs test still starts Rstest with an empty config {}, scans the whole directory with the default include, and runs whatever it finds.
A real case is the rspack-examples repo. The root rstack.config.ts has lint, fmt and staged only. rstest/module-federation-node/host/ has its own rstest.config.ts that registers remote/* through the @module-federation/rstest plugin. Running rs test at the repo root collects host/tests/federated-modules.test.ts too, but with the root's empty config and no federation plugin, so it fails with Cannot find module 'remote/formatPrice' (exit 1). Running rstest inside host/ passes. A minimal fixture with the same layout reproduces the same result.
Another case is a repo that uses vitest. rs test picks up src/sum.test.ts and fails while loading it with Vitest failed to find the current suite (exit 1).
rs lint behaves the same way: without define.lint() it runs with [], prints Lint passed (2 files, 0 rules) and exits 0, reporting nothing for debugger statements or unused variables.
Environment: rstack 0.7.4, @rstest/core 0.11.12 (rstack itself depends on ~0.11.12, so it is always installed alongside rstack), vitest 5.0.1, Node 26.5.0.
History
I went through the git history and the issues and could not find this fallback being discussed:
- The
{} fallback for test comes from 2dc4974 (feat: support for defining test config). The [] fallback for lint comes from c7b4ec1 (feat: add lint command placeholder). Both were pushed directly with no linked PR, and neither commit message mentions the missing-definition case.
- The docs say "Define only the configurations your project needs" but do not say what happens when you invoke a tool that has no definition.
- By contrast,
rs staged refuses when define.staged() is missing (No define.staged config found). It is the only command that handles the missing case on purpose.
So this looks like a default that came with ?? {} rather than an explicit product decision.
Question
When the matching define.* is missing, what should rs test / rs lint do?
- Keep the current behavior: treat it as
define.test({}) and run. If so, this should be documented, so users know that rs test at a monorepo root will pick up nested projects and tests written for other runners.
- Align with
rs staged: exit with an error that asks for define.test().
What happens
When
rstack.config.tsonly definesdefine.lint()anddefine.fmt()(nodefine.test()),rs teststill starts Rstest with an empty config{}, scans the whole directory with the defaultinclude, and runs whatever it finds.A real case is the rspack-examples repo. The root
rstack.config.tshas lint, fmt and staged only.rstest/module-federation-node/host/has its ownrstest.config.tsthat registersremote/*through the@module-federation/rstestplugin. Runningrs testat the repo root collectshost/tests/federated-modules.test.tstoo, but with the root's empty config and no federation plugin, so it fails withCannot find module 'remote/formatPrice'(exit 1). Runningrstestinsidehost/passes. A minimal fixture with the same layout reproduces the same result.Another case is a repo that uses vitest.
rs testpicks upsrc/sum.test.tsand fails while loading it withVitest failed to find the current suite(exit 1).rs lintbehaves the same way: withoutdefine.lint()it runs with[], printsLint passed (2 files, 0 rules)and exits 0, reporting nothing fordebuggerstatements or unused variables.Environment: rstack 0.7.4, @rstest/core 0.11.12 (rstack itself depends on
~0.11.12, so it is always installed alongside rstack), vitest 5.0.1, Node 26.5.0.History
I went through the git history and the issues and could not find this fallback being discussed:
{}fallback for test comes from 2dc4974 (feat: support for defining test config). The[]fallback for lint comes from c7b4ec1 (feat: add lint command placeholder). Both were pushed directly with no linked PR, and neither commit message mentions the missing-definition case.rs stagedrefuses whendefine.staged()is missing (No define.staged config found). It is the only command that handles the missing case on purpose.So this looks like a default that came with
?? {}rather than an explicit product decision.Question
When the matching
define.*is missing, what shouldrs test/rs lintdo?define.test({})and run. If so, this should be documented, so users know thatrs testat a monorepo root will pick up nested projects and tests written for other runners.rs staged: exit with an error that asks fordefine.test().