harmonyc 0.16.2 → 0.16.3

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.
@@ -3,7 +3,7 @@ import { OutFile } from './outFile.ts';
3
3
  export declare class VitestGenerator implements CodeGenerator {
4
4
  private tf;
5
5
  private sf;
6
- static error(message: string): string;
6
+ static error(message: string, stack: string): string;
7
7
  framework: string;
8
8
  phraseFns: Map<string, Phrase>;
9
9
  currentFeatureName: string;
@@ -1,10 +1,11 @@
1
1
  import { basename } from 'path';
2
2
  import { Arg, Response, Word, } from "../model/model.js";
3
3
  export class VitestGenerator {
4
- static error(message) {
4
+ static error(message, stack) {
5
5
  return `const e = new SyntaxError(${str(message)});
6
6
  e.stack = undefined;
7
- throw e;`;
7
+ throw e;
8
+ ${stack ? `/* ${stack} */` : ''}`;
8
9
  }
9
10
  constructor(tf, sf) {
10
11
  this.tf = tf;
@@ -42,7 +42,7 @@ export async function compileFile(fn) {
42
42
  }
43
43
  catch (e) {
44
44
  const outFileName = testFileName(fn);
45
- writeFileSync(outFileName, VitestGenerator.error((_a = e.message) !== null && _a !== void 0 ? _a : `${e}`));
45
+ writeFileSync(outFileName, VitestGenerator.error((_a = e.message) !== null && _a !== void 0 ? _a : `${e}`, e.stack));
46
46
  return undefined;
47
47
  }
48
48
  }
package/model/model.js CHANGED
@@ -288,7 +288,7 @@ export class Phrase {
288
288
  return this.parts.map((p) => p.toSingleLineString()).join(' ');
289
289
  }
290
290
  switch(i) {
291
- return new this.constructor(this.parts.map((p) => (p instanceof Switch ? p.choices[i] : p)));
291
+ return new this.constructor(this.parts.map((p) => (p instanceof Switch ? p.choices[i] : p))).setFeature(this.feature);
292
292
  }
293
293
  }
294
294
  export class Action extends Phrase {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "harmonyc",
3
3
  "description": "Harmony Code - model-driven BDD for Vitest",
4
- "version": "0.16.2",
4
+ "version": "0.16.3",
5
5
  "author": "Bernát Kalló",
6
6
  "type": "module",
7
7
  "bin": {