ReactiveX/rxjs · error · Error
Unknown framework: ${framework}
Error message
Unknown framework: ${framework} What it means
Thrown by parseArguments in the @rxjs/migrate CLI when --framework receives an unrecognized value. Only 'preserve' (leave test framework untouched) and 'mocha-chai-vitest' (rewrite Mocha/Chai assertions to Vitest) are supported; anything else stops parsing.
Source
Thrown at packages/migrate/src/cli.ts:146
break;
case '--out-dir':
options.outputRoot = requiredValue(argv, ++index, argument);
break;
case '--source-repo':
options.repository = requiredValue(argv, ++index, argument);
break;
case '--source-sha':
options.sha = requiredValue(argv, ++index, argument);
break;
case '--mode': {
const mode = requiredValue(argv, ++index, argument);
if (mode !== 'cold' && mode !== 'platform') throw new Error(`Unknown mode: ${mode}`);
options.mode = mode;
break;
}
case '--framework': {
const framework = requiredValue(argv, ++index, argument);
if (framework !== 'preserve' && framework !== 'mocha-chai-vitest') throw new Error(`Unknown framework: ${framework}`);
options.framework = framework;
break;
}
case '--write':
options.write = true;
break;
case '--help':
case '-h':
options.help = true;
break;
default:
if (argument.startsWith('-')) throw new Error(`Unknown option: ${argument}`);
options.files.push(argument);
}
}
return options;
}
View on GitHub (pinned to 54796b38a5)
Solutions
- Use --framework preserve if your framework is not Mocha/Chai
- Use --framework mocha-chai-vitest only when rewriting Mocha+Chai tests to Vitest
- Run with --help to confirm accepted values
Example fix
// before npx @rxjs/migrate --framework jest ... // after npx @rxjs/migrate --framework preserve ...
Defensive patterns
Strategy: validation
Validate before calling
const FRAMEWORKS = new Set(['preserve', 'mocha-chai-vitest']);
if (!FRAMEWORKS.has(framework)) {
console.error(`--framework must be one of ${[...FRAMEWORKS].join(' | ')}`);
process.exit(1);
} Type guard
const isFramework = (v: string): v is 'preserve' | 'mocha-chai-vitest' => v === 'preserve' || v === 'mocha-chai-vitest';
Try / catch
try { runCli(argv); } catch (e) { console.error((e as Error).message); } Prevention
- Pin allowed framework values in the wrapper script
- Use --framework preserve for anything other than Mocha/Chai suites
When it happens
Trigger: Passing `--framework jest`, `--framework jasmine`, or a misspelled value like `--framework mochachai` to the CLI.
Common situations: Trying to migrate a Jest or Karma suite (unsupported), assuming framework names from other codemods, or typos in scripts copied from migration docs.
Related errors
- Unknown mode: ${mode}
- Unknown option: ${argument}
- Missing required argument${missing.length === 1 ? '' : 's'}:
- --out-dir is required with --write
- ${option} requires a value
AI-assisted analysis of ReactiveX/rxjs@54796b38a5 (2026-08-28).
Data as JSON: /api/errors/f6c6893e9f392b5b.
Report an issue: GitHub.