Skip to content

Commit 74ce177

Browse files
committed
Merge branch 'master' of https://github.com/badeball/cypress-cucumber-preprocessor into feature/json-formatter-args
2 parents 1ac8761 + 3a8615a commit 74ce177

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+594
-44
lines changed

.github/workflows/examples.yml

Lines changed: 192 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ defaults:
1010
shell: bash
1111

1212
jobs:
13-
browserify:
13+
browserify-cjs:
1414
runs-on: ubuntu-20.04
1515
container:
1616
image: cypress/base:17.3.0
@@ -31,16 +31,16 @@ jobs:
3131
- name: Make checkout sparse
3232
run: |
3333
shopt -s extglob
34-
rm -rf examples/!(browserify)
34+
rm -rf examples/!(browserify-cjs)
3535
rm -rf !(examples)
3636
- name: Install NPM modules
37-
working-directory: examples/browserify
37+
working-directory: examples/browserify-cjs
3838
run: npm install
3939
- name: Run Cypress
40-
working-directory: examples/browserify
40+
working-directory: examples/browserify-cjs
4141
run: npx cypress run
4242

43-
webpack:
43+
browserify-esm:
4444
runs-on: ubuntu-20.04
4545
container:
4646
image: cypress/base:17.3.0
@@ -61,16 +61,16 @@ jobs:
6161
- name: Make checkout sparse
6262
run: |
6363
shopt -s extglob
64-
rm -rf examples/!(webpack)
64+
rm -rf examples/!(browserify-esm)
6565
rm -rf !(examples)
6666
- name: Install NPM modules
67-
working-directory: examples/webpack
67+
working-directory: examples/browserify-esm
6868
run: npm install
6969
- name: Run Cypress
70-
working-directory: examples/webpack
70+
working-directory: examples/browserify-esm
7171
run: npx cypress run
7272

73-
esbuild:
73+
browserify-ts:
7474
runs-on: ubuntu-20.04
7575
container:
7676
image: cypress/base:17.3.0
@@ -91,11 +91,191 @@ jobs:
9191
- name: Make checkout sparse
9292
run: |
9393
shopt -s extglob
94-
rm -rf examples/!(esbuild)
94+
rm -rf examples/!(browserify-ts)
9595
rm -rf !(examples)
9696
- name: Install NPM modules
97-
working-directory: examples/esbuild
97+
working-directory: examples/browserify-ts
9898
run: npm install
9999
- name: Run Cypress
100-
working-directory: examples/esbuild
100+
working-directory: examples/browserify-ts
101+
run: npx cypress run
102+
103+
webpack-cjs:
104+
runs-on: ubuntu-20.04
105+
container:
106+
image: cypress/base:17.3.0
107+
steps:
108+
- name: Checkout
109+
uses: actions/checkout@v2
110+
- name: Cache NPM modules
111+
uses: actions/cache@v2
112+
with:
113+
path: ~/.npm
114+
key: npm
115+
- name: Cache Cypress binaries
116+
uses: actions/cache@v2
117+
with:
118+
path: ~/.cache/Cypress
119+
key: cypress
120+
# In lack of native support, https://github.com/actions/checkout/issues/172.
121+
- name: Make checkout sparse
122+
run: |
123+
shopt -s extglob
124+
rm -rf examples/!(webpack-cjs)
125+
rm -rf !(examples)
126+
- name: Install NPM modules
127+
working-directory: examples/webpack-cjs
128+
run: npm install
129+
- name: Run Cypress
130+
working-directory: examples/webpack-cjs
131+
run: npx cypress run
132+
133+
webpack-esm:
134+
runs-on: ubuntu-20.04
135+
container:
136+
image: cypress/base:17.3.0
137+
steps:
138+
- name: Checkout
139+
uses: actions/checkout@v2
140+
- name: Cache NPM modules
141+
uses: actions/cache@v2
142+
with:
143+
path: ~/.npm
144+
key: npm
145+
- name: Cache Cypress binaries
146+
uses: actions/cache@v2
147+
with:
148+
path: ~/.cache/Cypress
149+
key: cypress
150+
# In lack of native support, https://github.com/actions/checkout/issues/172.
151+
- name: Make checkout sparse
152+
run: |
153+
shopt -s extglob
154+
rm -rf examples/!(webpack-esm)
155+
rm -rf !(examples)
156+
- name: Install NPM modules
157+
working-directory: examples/webpack-esm
158+
run: npm install
159+
- name: Run Cypress
160+
working-directory: examples/webpack-esm
161+
run: npx cypress run
162+
163+
webpack-ts:
164+
runs-on: ubuntu-20.04
165+
container:
166+
image: cypress/base:17.3.0
167+
steps:
168+
- name: Checkout
169+
uses: actions/checkout@v2
170+
- name: Cache NPM modules
171+
uses: actions/cache@v2
172+
with:
173+
path: ~/.npm
174+
key: npm
175+
- name: Cache Cypress binaries
176+
uses: actions/cache@v2
177+
with:
178+
path: ~/.cache/Cypress
179+
key: cypress
180+
# In lack of native support, https://github.com/actions/checkout/issues/172.
181+
- name: Make checkout sparse
182+
run: |
183+
shopt -s extglob
184+
rm -rf examples/!(webpack-ts)
185+
rm -rf !(examples)
186+
- name: Install NPM modules
187+
working-directory: examples/webpack-ts
188+
run: npm install
189+
- name: Run Cypress
190+
working-directory: examples/webpack-ts
191+
run: npx cypress run
192+
193+
esbuild-cjs:
194+
runs-on: ubuntu-20.04
195+
container:
196+
image: cypress/base:17.3.0
197+
steps:
198+
- name: Checkout
199+
uses: actions/checkout@v2
200+
- name: Cache NPM modules
201+
uses: actions/cache@v2
202+
with:
203+
path: ~/.npm
204+
key: npm
205+
- name: Cache Cypress binaries
206+
uses: actions/cache@v2
207+
with:
208+
path: ~/.cache/Cypress
209+
key: cypress
210+
# In lack of native support, https://github.com/actions/checkout/issues/172.
211+
- name: Make checkout sparse
212+
run: |
213+
shopt -s extglob
214+
rm -rf examples/!(esbuild-cjs)
215+
rm -rf !(examples)
216+
- name: Install NPM modules
217+
working-directory: examples/esbuild-cjs
218+
run: npm install
219+
- name: Run Cypress
220+
working-directory: examples/esbuild-cjs
221+
run: npx cypress run
222+
223+
esbuild-esm:
224+
runs-on: ubuntu-20.04
225+
container:
226+
image: cypress/base:17.3.0
227+
steps:
228+
- name: Checkout
229+
uses: actions/checkout@v2
230+
- name: Cache NPM modules
231+
uses: actions/cache@v2
232+
with:
233+
path: ~/.npm
234+
key: npm
235+
- name: Cache Cypress binaries
236+
uses: actions/cache@v2
237+
with:
238+
path: ~/.cache/Cypress
239+
key: cypress
240+
# In lack of native support, https://github.com/actions/checkout/issues/172.
241+
- name: Make checkout sparse
242+
run: |
243+
shopt -s extglob
244+
rm -rf examples/!(esbuild-esm)
245+
rm -rf !(examples)
246+
- name: Install NPM modules
247+
working-directory: examples/esbuild-esm
248+
run: npm install
249+
- name: Run Cypress
250+
working-directory: examples/esbuild-esm
251+
run: npx cypress run
252+
253+
esbuild-ts:
254+
runs-on: ubuntu-20.04
255+
container:
256+
image: cypress/base:17.3.0
257+
steps:
258+
- name: Checkout
259+
uses: actions/checkout@v2
260+
- name: Cache NPM modules
261+
uses: actions/cache@v2
262+
with:
263+
path: ~/.npm
264+
key: npm
265+
- name: Cache Cypress binaries
266+
uses: actions/cache@v2
267+
with:
268+
path: ~/.cache/Cypress
269+
key: cypress
270+
# In lack of native support, https://github.com/actions/checkout/issues/172.
271+
- name: Make checkout sparse
272+
run: |
273+
shopt -s extglob
274+
rm -rf examples/!(esbuild-ts)
275+
rm -rf !(examples)
276+
- name: Install NPM modules
277+
working-directory: examples/esbuild-ts
278+
run: npm install
279+
- name: Run Cypress
280+
working-directory: examples/esbuild-ts
101281
run: npx cypress run

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
**/*.js
22
**/*.d.ts
3+
!examples/**/*
34
!features/**/*
45
!cucumber.d.ts
56
!cucumber.js

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## v11.2.0
6+
7+
- Enable `*.mjs` file extension by default, when looking for step definitions.
8+
9+
- Add a default export to `@badeball/cypress-cucumber-preprocessor/esbuild`.
10+
11+
- Add examples for CJS and ESM.
12+
513
## v11.1.0
614

715
- Enable test configuration overrides, such as retrability of a single scenario, fixes [#697](https://github.com/badeball/cypress-cucumber-preprocessor/issues/697).

docs/configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ Every configuration option has a similar key which can be use to override it, sh
5454

5555
## Test configuration
5656

57-
Some of Cypress' [configuration options](https://docs.cypress.io/guides/references/configuration) can be overridden per-test, [Test configuration](test-configuration.md).
57+
Some of Cypress' [configuration options](https://docs.cypress.io/guides/references/configuration) can be overridden per-test, see [Test configuration](test-configuration.md).

docs/quick-start.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,7 @@ export default defineConfig({
1818
});
1919
```
2020

21-
Configure your preferred bundler to process features files, with examples for
22-
23-
* [Browserify](../examples/browserify)
24-
* [Webpack](../examples/webpack)
25-
* [Esbuild](../examples/esbuild)
21+
Then configure your preferred bundler to process features files. See [examples/](../examples) for how-to using Browserify, Esbuild or Webpack. Esbuild is the recommended bundler if you have no particular requirements (it's by far the fastest).
2622

2723
Read more about configuration options at [docs/configuration.md](configuration.md).
2824

esbuild.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@ export function createEsbuildPlugin(
2525
},
2626
};
2727
}
28+
29+
export default createEsbuildPlugin;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
const { defineConfig } = require("cypress");
2+
const preprocessor = require("@badeball/cypress-cucumber-preprocessor");
3+
const browserify = require("@badeball/cypress-cucumber-preprocessor/browserify");
4+
5+
async function setupNodeEvents(on, config) {
6+
await preprocessor.addCucumberPreprocessorPlugin(on, config);
7+
8+
on("file:preprocessor", browserify.default(config));
9+
10+
// Make sure to return the config object as it might have been modified by the plugin.
11+
return config;
12+
}
13+
14+
module.exports = defineConfig({
15+
e2e: {
16+
specPattern: "**/*.feature",
17+
supportFile: false,
18+
setupNodeEvents,
19+
},
20+
});
File renamed without changes.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const { When, Then } = require("@badeball/cypress-cucumber-preprocessor");
2+
3+
When("I visit duckduckgo.com", () => {
4+
cy.visit("https://duckduckgo.com/");
5+
});
6+
7+
Then("I should see a search bar", () => {
8+
cy.get("input").should(
9+
"have.attr",
10+
"placeholder",
11+
"Search the web without being tracked"
12+
);
13+
14+
assert.deepEqual({}, {});
15+
});

0 commit comments

Comments
 (0)