@hyperfixi/testing-framework 4.1.0 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -376,8 +376,15 @@ export async function initDirectPathHosts(): Promise<DirectPathHosts> {
376
376
  for (const steps of scriptOf(c)) parts.push(await run(host, c, code, lang, steps));
377
377
  return parts.join(' ‖ ');
378
378
  };
379
- const rejects = (host: ScriptHost, code: string): string | undefined =>
380
- host.parse(code)?.errors?.[0]?.message.split('\n')[0];
379
+ // Two failure channels: parse errors, and the tokenizer THROWING on a
380
+ // character it does not know (the text a refused translation leaves as written).
381
+ const rejects = (host: ScriptHost, code: string): string | undefined => {
382
+ try {
383
+ return host.parse(code)?.errors?.[0]?.message.split('\n')[0];
384
+ } catch (e) {
385
+ return (e as Error).message.split('\n')[0] ?? 'threw';
386
+ }
387
+ };
381
388
 
382
389
  return {
383
390
  async runCase(c) {