harmonyc 0.21.0 → 0.22.1

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.
package/README.md CHANGED
@@ -23,6 +23,10 @@ export default {
23
23
 
24
24
  This will run .harmony files in vitest.
25
25
 
26
+ ### Auto-generating phrases files and methods
27
+
28
+ The Vitest plugin will auto-generate phrases files or edit them to add necessary phrase methods whenever you change your .harmony files. It will automatically sort phrase methods.
29
+
26
30
  ## VSCode plugin
27
31
 
28
32
  Harmony Code has a [VSCode plugin](https://marketplace.visualstudio.com/items?itemName=harmony-ac.harmony-code) that supports syntax highlighting.
@@ -79,14 +83,16 @@ becomes
79
83
  ```javascript
80
84
  test('T1 - strings', async () => {
81
85
  const P = new Phrases()
82
- await P.When_hello_('John')
86
+ await P.When_hello_X('John')
83
87
  })
84
88
  test('T2 - code fragment', async () => {
85
89
  const P = new Phrases()
86
- await P.When_greet__times(3)
90
+ await P.When_greet_X_times(3)
87
91
  })
88
92
  ```
89
93
 
94
+ Arguments are added to the function name as `X`, `Y`, `Z`, `A`, `B` etc.
95
+
90
96
  ### Labels
91
97
 
92
98
  Labels are lines that start with `-` or `+` and end with `:`. You can use them to structure your test design.
@@ -127,7 +133,7 @@ becomes
127
133
  test('T1 - set variable', (context) => {
128
134
  const P = new Phrases();
129
135
  (context.task.meta.variables ??= {})['name'] = "John";
130
- await P.When_greet_(context.task.meta.variables?.['name']);
136
+ await P.When_greet_X(context.task.meta.variables?.['name']);
131
137
  })
132
138
  test('T2 - store result in variable', (context) => {
133
139
  const P = new Phrases();
@@ -22,7 +22,7 @@ export class VitestGenerator {
22
22
  this.extraArgs = [];
23
23
  }
24
24
  feature(feature) {
25
- const phrasesModule = './' + basename(this.sourceFileName.replace(/\.harmony$/, '.phrases.js'));
25
+ const phrasesModule = './' + basename(this.sourceFileName.replace(/\.harmony$/, '.phrases'));
26
26
  const fn = (this.featureClassName =
27
27
  this.currentFeatureName =
28
28
  pascalCase(feature.name) + 'Phrases');
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.21.0",
4
+ "version": "0.22.1",
5
5
  "author": "Bernát Kalló",
6
6
  "homepage": "https://github.com/harmony-ac/code#readme",
7
7
  "repository": {
@@ -19,8 +19,7 @@
19
19
  "test": "vitest --run",
20
20
  "test:compile": "tsx ./src/cli/cli 'src/**/*.harmony'",
21
21
  "dev": "vitest --watch",
22
- "publish": "cp ../../README.md . && npm publish",
23
- "release": "npm run test && npm run build && release publish"
22
+ "release": "npm run test && npm run build && cp ../../README.md . && release publish"
24
23
  },
25
24
  "files": [
26
25
  "dist",