Skip to content

Commit 291b03e

Browse files
authored
Improve docs before release (#19)
1 parent cf96c8c commit 291b03e

File tree

1 file changed

+43
-1
lines changed

1 file changed

+43
-1
lines changed

README.md

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,57 @@ Since cucumber-node augments the standard Node.js test runner, you can use many
8484

8585
## Writing steps
8686

87-
Full API documentation is at https://cucumber.github.io/cucumber-node/ and includes:
87+
Full API documentation is at https://cucumber.github.io/cucumber-node and includes:
8888

8989
- `Before` and `After` for hooks
9090
- `Given`, `When` and `Then` for steps
9191
- `ParameterType` for custom parameter types
92+
- `DataTable` for working with data tables
93+
94+
### Test context
95+
96+
When you write a step or hook function, the first argument will always be a [`TestCaseContext`](https://cucumber.github.io/cucumber-node/types/TestCaseContext.html) object, similar to the one that `node --test` gives you when writing tests in JavaScript and with many of the same properties, plus the "world" where you can keep your state, and methods for attaching content.
97+
98+
### Finding your code
99+
100+
Discovery of your code is based on the following glob (relative to the working directory):
101+
102+
```
103+
features/**/*.{cjs,js,mjs}
104+
```
105+
106+
This isn't configurable ([yet](https://github.com/cucumber/cucumber-node/issues/10)).
92107

93108
## Reporters
94109

95110
Some Cucumber formatters are included as Node.js test reporters:
96111

97112
- HTML `--test-reporter=@cucumber/node/reporters/html --test-reporter-destination=./report.html`
98113
- Message `--test-reporter=@cucumber/node/reporters/message --test-reporter-destination=./messages.ndjson`
114+
115+
## Limitations
116+
117+
It's early days, and there are some rough edges here, which we'll smooth out as soon as possible:
118+
119+
- **You can't mix Cucumber tests with other tests** so if you have non-Cucumber tests to run with `node --test`, you should do that in a separate run.
120+
- **The `spec` reporter gets noisy if you also use a Cucumber reporter** because we're kind of abusing the `diagnostic` channel to send messages to the reporter. We'd recommend the `dot` reporter in the meantime.
121+
122+
There are also some pretty standard Cucumber features that are conspicuous by their absence (again, not for long):
123+
124+
- [Filtering by tag expression](https://github.com/cucumber/cucumber-node/issues/9)
125+
- [BeforeAll/AfterAll hooks](https://github.com/cucumber/cucumber-node/issues/8)
126+
- [Regular expression steps](https://github.com/cucumber/cucumber-node/issues/6)
127+
128+
## What's different?
129+
130+
Some behaviour differs from that of `cucumber-js` in meaningful ways.
131+
132+
### Arrow functions
133+
134+
`cucumber-node` doesn't set `this` to anything for the scope of your step/hook functions. Instead, a context object is passed as the first argument. This means there's no need to avoid arrow functions.
135+
136+
### Concurrency
137+
138+
`node --test` by default runs each test file in a separate process, and runs them concurrently as much as possible within the constraints of the system. This is different from `cucumber-js` which by default runs everything in-process and in serial.
139+
140+
The way work is divided up to run concurrently is also worth calling out. `node --test` does so at the file level, meaning many feature files can be executed concurrently, but scenarios within a feature file will always run in the defined order and in the same process. This is more predictable than `cucumber-js` which just makes a single pool of all scenarios and assigns them to worker processes as they become idle.

0 commit comments

Comments
 (0)