Reject multiple k6 scenarios in script validation - #1795
Conversation
Synthetic Monitoring only supports a single VU/scenario. Extra scenarios were previously ignored by validation, so invalid options in later scenarios could slip through. Reject scripts that define more than one scenario with a clear error. Signed-off-by: amarkdotdev <amarkdotdev@users.noreply.github.com>
|
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 6dabac9. Configure here.
| (scenario) => | ||
| (scenario.key.type === 'Identifier' || scenario.key.type === 'Literal') && | ||
| scenario.value.type === 'ObjectExpression' | ||
| ).length; |
There was a problem hiding this comment.
Scenario count skips non-literal values
Medium Severity
countScenarios only counts entries whose values are inline ObjectExpressions. Scenario configs referenced by identifier (including shorthand like scenarios: { ui, api }) are ignored, so multi-scenario scripts can pass the new single-scenario check.
Reviewed by Cursor Bugbot for commit 6dabac9. Configure here.
|
@amarkdotdev Thanks for your contribution and picking this up! Can you sign the CLA, please? 🙏 |


Summary
options.scenariosdefines more than one scenario, instead of validating only the first.Fixes #1741
Test plan
yarn test src/schemas/forms/script/validation.test.ts