@gnuechtel/nx-cucumber 2.1.0 → 2.1.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.
Files changed (2) hide show
  1. package/README.md +79 -4
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -18,6 +18,8 @@ Plugin to use Cucumber within Nx workspaces
18
18
  - [Inferred tasks](#inferred-tasks)
19
19
  - [Plugin registration](#plugin-registration)
20
20
  - [Cucumber configuration](#cucumber-configuration)
21
+ - [Default configuration](#default-configuration)
22
+ - [Config file formats](#config-file-formats)
21
23
  - [World parameters](#world-parameters)
22
24
  - [Enable videos](#enable-videos)
23
25
  - [Change screenshot options](#change-screenshot-options)
@@ -67,7 +69,7 @@ Version 2.x is a deliberate breaking release that simplifies the plugin architec
67
69
  - **Faster execution.** Removing the executor bootstrap, in-process Cucumber API, plugin-managed dev server lifecycle, and report post-processing from the execution path results in faster test runs.
68
70
  - **Reporting is formatter-first.** Generated projects now rely on Cucumber-native formatters (`html`, `json`, `message`, `junit`) plus a dedicated run-metadata formatter artifact. No HTML mutation layer is used.
69
71
  - **Legacy HTML post-processing removed.** The previously exported `createBeautifulHtmlReport` helper and `cucumber-html-reporter` integration are no longer part of 2.x.
70
- - **Configuration filename scope.** In 2.x, plugin discovery/generation/migration is centered on `cucumber.js`.
72
+ - **All cucumber-js config formats.** Plugin discovery, generation, and migration support every cucumber-js configuration file format (`cucumber.js`, `.cjs`, `.mjs`, `.ts`, `.mts`, `.cts`, `.json`, `.yaml`, `.yml`). See [Config file formats](#config-file-formats).
71
73
 
72
74
  ## Prerequisites
73
75
 
@@ -229,7 +231,11 @@ Target names can be customized:
229
231
 
230
232
  ### Cucumber configuration
231
233
 
232
- All Cucumber options are configured in the `cucumber.js` file. The generator creates a default configuration. For example, to customize tags based on environment variables:
234
+ The generator scaffolds a cucumber-js configuration file for each project. It is a standard cucumber-js config, so any advanced Cucumber [option](https://github.com/cucumber/cucumber-js/blob/main/docs/configuration.md#options) can be set there.
235
+
236
+ #### Default configuration
237
+
238
+ By default the generator creates a `cucumber.js`. Because the code formats are evaluated when loaded, options can be computed at runtime — for example, deriving the tag filter from an environment variable:
233
239
 
234
240
  ```javascript
235
241
  const tagsFilter =
@@ -244,9 +250,78 @@ module.exports = {
244
250
  };
245
251
  ```
246
252
 
247
- All advanced Cucumber [options](https://github.com/cucumber/cucumber-js/blob/main/docs/configuration.md#options) can be set in the `cucumber.js` file.
253
+ #### Config file formats
254
+
255
+ Nx-cucumber supports every cucumber-js configuration file format for inferred-task discovery, generator output, and migration output. Select one with the generator's `configFormat` option (default `js`):
256
+
257
+ | `configFormat` | Config file | Style |
258
+ | -------------- | --------------- | -------- |
259
+ | `js` (default) | `cucumber.js` | CommonJS |
260
+ | `cjs` | `cucumber.cjs` | CommonJS |
261
+ | `mjs` | `cucumber.mjs` | ESM |
262
+ | `ts` | `cucumber.ts` | ESM / TS |
263
+ | `mts` | `cucumber.mts` | ESM / TS |
264
+ | `cts` | `cucumber.cts` | ESM / TS |
265
+ | `json` | `cucumber.json` | JSON |
266
+ | `yaml` | `cucumber.yaml` | YAML |
267
+ | `yml` | `cucumber.yml` | YAML |
268
+
269
+ The **code formats** (`js`, `cjs`, `mjs`, `ts`, `mts`, `cts`) are evaluated as modules, so they can contain logic like the default configuration above. The **data formats** (`json`, `yaml`, `yml`) are static and hold plain values only.
270
+
271
+ The same configuration expressed in the remaining formats:
272
+
273
+ **ES module** — `cucumber.mjs`
274
+
275
+ ```javascript
276
+ const tagsFilter =
277
+ process.env['CI_STAGE'] !== 'qa'
278
+ ? 'and not @qa-stage-only'
279
+ : 'and (@qa-stage or @qa-stage-only)';
280
+
281
+ export default {
282
+ default: {
283
+ tags: `not @ignore ${tagsFilter}`,
284
+ },
285
+ };
286
+ ```
287
+
288
+ **TypeScript** — `cucumber.ts`, `cucumber.mts`, `cucumber.cts`
289
+
290
+ ```typescript
291
+ import type { IConfiguration } from '@cucumber/cucumber';
292
+
293
+ const tagsFilter =
294
+ process.env['CI_STAGE'] !== 'qa'
295
+ ? 'and not @qa-stage-only'
296
+ : 'and (@qa-stage or @qa-stage-only)';
297
+
298
+ const config: { default: Partial<IConfiguration> } = {
299
+ default: {
300
+ tags: `not @ignore ${tagsFilter}`,
301
+ },
302
+ };
303
+
304
+ export default config;
305
+ ```
306
+
307
+ **JSON** — `cucumber.json`
308
+
309
+ JSON is static and cannot run the environment check above, so the tags are set directly:
248
310
 
249
- > **2.x limitation:** `@gnuechtel/nx-cucumber` currently supports `cucumber.js` as the plugin configuration file for inferred-task discovery, generator output, and migration output. Other Cucumber config filenames (for example `cucumber.mjs`) are not supported by the plugin in this major version.
311
+ ```json
312
+ {
313
+ "default": {
314
+ "tags": "not @ignore"
315
+ }
316
+ }
317
+ ```
318
+
319
+ **YAML** — `cucumber.yaml`, `cucumber.yml`
320
+
321
+ ```yaml
322
+ default:
323
+ tags: 'not @ignore'
324
+ ```
250
325
 
251
326
  ### World parameters
252
327
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gnuechtel/nx-cucumber",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "Plugin to use Cucumber within Nx workspaces",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -12,8 +12,8 @@
12
12
  "@nx/devkit": ">=22 <23",
13
13
  "minimatch": "^10.0.0",
14
14
  "tslib": "^2.3.0",
15
- "@gnuechtel/shared-coverage": "2.1.0",
16
- "@gnuechtel/shared-util": "2.1.0"
15
+ "@gnuechtel/shared-coverage": "2.1.1",
16
+ "@gnuechtel/shared-util": "2.1.1"
17
17
  },
18
18
  "peerDependencies": {
19
19
  "@cucumber/cucumber": ">=9 <13",