Skip to content

Commit e8a785a

Browse files
MartinDelillecharlierudolph
authored andcommitted
docs: normalize syntax highlighting (#726)
1 parent 09b891b commit e8a785a

File tree

6 files changed

+27
-16
lines changed

6 files changed

+27
-16
lines changed

CHANGELOG.md

+11-4
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
#### Breaking Changes
3030

3131
* update support code library interface - instead of exporting a function and calling methods on `this`, require the `cucumber` module and call `defineSupportCode` which passes an object as the first argument whch exposes the methods. Overriding the world constructor has changed from overriding the World property to calling `setWorldConstructor`.
32-
```js
32+
33+
```javascript
3334
// 1.3.1
3435
module.exports = function () {
3536
this.Given(/^a step$/, function() {});
@@ -114,7 +115,8 @@
114115
* Support Files
115116
* Attachments
116117
* The `attach` function used for adding attachments moved from the API scenario object to world. It is thus now available in step definitions without saving a reference to the scenario.
117-
```js
118+
119+
```javascript
118120
// 1.3.0
119121
this.After(function(scenario, callback) {
120122
scenario.attach(new Buffer([137, 80, 78, 71]), 'image/png')
@@ -125,18 +127,22 @@
125127
this.attach(new Buffer([137, 80, 78, 71]), 'image/png');
126128
});
127129
```
130+
128131
* When attaching buffers or strings, the callback argument is ignored.
129132
* Hooks
130133
* Hooks now receive a [ScenarioResult](/src/models/scenario_result.js) instead of the Scenario
131-
```js
134+
135+
```javascript
132136
// 1.3.0
133137
this.After(function(scenario) {});
134138

135139
// 2.0.0
136140
this.After(function(scenarioResult) {});
137141
```
142+
138143
* The `tags` option for hook should now be a string instead of an array and uses [cucumber-tag-expressions](https://docs.cucumber.io/tag-expressions/)
139-
```js
144+
145+
```javascript
140146
// 1.3.0
141147
this.Before({tags: ["@foo"]}, function (scenario) {})
142148
this.Before({tags: ["@foo,@bar"]}, function (scenario) {})
@@ -147,6 +153,7 @@
147153
this.Before({tags: "@foo and @bar"}, function (scenario) {})
148154
this.Before({tags: "@foo or @bar"}, function (scenario) {})
149155
```
156+
150157
* Step Definitions
151158
* String patterns were removed in favor [cucumber-expressions](https://docs.cucumber.io/cucumber-expressions/)
152159
* Regular Expressions

docs/support_files/api_reference.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ Add a new transform to convert a capture group into something else.
1515
* `typeName`: string used to refer to this type in cucumber expressions
1616

1717
The built in transforms are:
18-
```js
18+
19+
```javascript
1920
// Float
2021
{
2122
captureGroupRegexps: ['-?\\d*\\.?\\d+'],
@@ -113,7 +114,8 @@ Set a function used to wrap step / hook definitions. When used, the result is wr
113114
#### `setWorldConstructor(constructor)`
114115

115116
Set a custom world constructor, to override the default world constructor:
116-
```js
117+
118+
```javascript
117119
function World({attach, parameters}) {
118120
attach = attach
119121
parameters = parameters

docs/support_files/attachments.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Text, images and files can be added to the output of the JSON formatter with att
44
The world constructor is passed an `attach` function,
55
which the default world constructor assigns to `this.attach`.
66

7-
``` javascript
7+
```javascript
88
var {defineSupportCode} = require('cucumber');
99

1010
defineSupportCode(function({After}) {
@@ -17,7 +17,7 @@ defineSupportCode(function({After}) {
1717
By default, text is saved with a MIME type of `text/plain`. You can also specify
1818
a different MIME type:
1919

20-
``` javascript
20+
```javascript
2121
var {defineSupportCode} = require('cucumber');
2222

2323
defineSupportCode(function({After}) {
@@ -31,7 +31,7 @@ Images and other binary data can be attached using a [stream.Readable](https://n
3131
The data will be `base64` encoded in the output.
3232
You should wait for the stream to be read before continuing by providing a callback or waiting for the returned promise to resolve.
3333

34-
``` javascript
34+
```javascript
3535
var {defineSupportCode} = require('cucumber');
3636

3737
defineSupportCode(function({After}) {
@@ -59,7 +59,7 @@ defineSupportCode(function({After}) {
5959
Images and binary data can also be attached using a [Buffer](https://nodejs.org/api/buffer.html).
6060
The data will be `base64` encoded in the output.
6161

62-
``` javascript
62+
```javascript
6363
var {defineSupportCode} = require('cucumber');
6464

6565
defineSupportCode(function({After}) {
@@ -75,7 +75,7 @@ defineSupportCode(function({After}) {
7575
Here is an example of saving a screenshot using [Selenium WebDriver](https://www.npmjs.com/package/selenium-webdriver)
7676
when a scenario fails:
7777

78-
``` javascript
78+
```javascript
7979
var {defineSupportCode} = require('cucumber');
8080

8181
defineSupportCode(function({After}) {

docs/support_files/hooks.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ defineSupportCode(function({After, Before}) {
3636

3737
Hooks can be conditionally selected for execution based on the tags of the scenario.
3838

39-
``` javascript
39+
```javascript
4040
var {defineSupportCode} = require('cucumber');
4141

4242
defineSupportCode(function({After, Before}) {

docs/support_files/timeouts.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
By default, asynchronous hooks and steps timeout after 5000 milliseconds.
44
This can be modified globally with:
55

6-
```js
6+
```javascript
77
var {defineSupportCode} = require('cucumber');
88

99
defineSupportCode(function({setDefaultTimeout}) {
@@ -13,7 +13,7 @@ defineSupportCode(function({setDefaultTimeout}) {
1313

1414
A specific hook's or step's timeout can be set with:
1515

16-
```js
16+
```javascript
1717
var {defineSupportCode} = require('cucumber');
1818

1919
defineSupportCode(function({Before, Given}) {
@@ -35,7 +35,7 @@ Disable timeouts by setting it to -1.
3535
If you use this, you need to implement your own timeout protection.
3636
Otherwise the test suite may end prematurely or hang indefinitely.
3737

38-
```js
38+
```javascript
3939
var {defineSupportCode} = require('cucumber');
4040
var Promise = require('bluebird');
4141

docs/support_files/world.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22

33
*World* is an isolated context for each scenario, exposed to the hooks and steps as `this`.
44
The default world constructor is:
5-
```js
5+
6+
```javascript
67
function World({attach, parameters}) {
78
attach = attach
89
parameters = parameters
910
}
1011
```
1112

1213
The default can be overridden with `setWorldConstructor`.
14+
1315
```javascript
1416
var {defineSupportCode} = require('cucumber');
1517
var seleniumWebdriver = require('selenium-webdriver');

0 commit comments

Comments
 (0)