forked from cypress-io/cypress-react-unit-test
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcircle.yml
314 lines (297 loc) Β· 10.9 KB
/
circle.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
version: 2.1
orbs:
cypress: cypress-io/[email protected]
executors:
base-12-16-2:
docker:
- image: 'cypress/base:12.16.2'
environment:
DEBUG: find-webpack,cypress-react-unit-test
workflows:
build:
jobs:
# install and cache dependencies in this job
# AND build the library once
# then the workspace will be passed to other jobs
- cypress/install:
name: Install
executor: cypress/base-12
build: npm run transpile
post-steps:
- run:
name: Show info πΊ
command: npx cypress info
- run:
name: Linting code π§Ή
command: npm run lint
- run:
name: Check markdown links βοΈ
command: npm run check:links
- run:
name: Build folder π
command: npm run build
- cypress/run:
name: Example A11y
requires:
- Install
# each example installs "cypress-react-unit-test" as a local dependency (symlink)
install-command: npm install
verify-command: echo 'Already verified'
no-workspace: true
working_directory: examples/a11y
command: npm test
store_artifacts: true
- cypress/run:
name: Example Babel
requires:
- Install
# each example installs "cypress-react-unit-test" as a local dependency (symlink)
install-command: npm install
verify-command: echo 'Already verified'
no-workspace: true
working_directory: examples/using-babel
command: npm test
store_artifacts: true
- cypress/run:
name: Example React Scripts
requires:
- Install
# each example installs "cypress-react-unit-test" as a local dependency (symlink)
install-command: npm install
verify-command: echo 'Already verified'
no-workspace: true
working_directory: examples/react-scripts
command: npm test
store_artifacts: true
post-steps:
- run:
name: Check coverage π
command: |
npm run check-coverage
npm run only-covered
working_directory: examples/react-scripts
- cypress/run:
# react-scripts example with component tests not in "src" folder
# but in "cypress/component" folder
name: Example Component Folder
executor: cypress/base-12
requires:
- Install
# each example installs "cypress-react-unit-test" as a local dependency (symlink)
install-command: npm install
verify-command: echo 'Already verified'
no-workspace: true
working_directory: examples/react-scripts-folder
command: npm test
store_artifacts: true
post-steps:
- run:
name: Check coverage π
command: |
npm run check-coverage
npm run only-covered
working_directory: examples/react-scripts-folder
- cypress/run:
name: Example Tailwind
requires:
- Install
# each example installs "cypress-react-unit-test" as a local dependency (symlink)
install-command: npm install
verify-command: echo 'Already verified'
no-workspace: true
working_directory: examples/tailwind
command: |
DEBUG=cypress-react-unit-test,find-webpack npm test
store_artifacts: true
post-steps:
- run:
name: Check coverage π
command: |
ls -la
npm run check-coverage
npm run only-covered
working_directory: examples/tailwind
- cypress/run:
name: Example Webpack file
executor: base-12-16-2
requires:
- Install
# each example installs "cypress-react-unit-test" as a local dependency (symlink)
install-command: npm install
verify-command: echo 'Already verified'
no-workspace: true
working_directory: examples/webpack-file
command: npm test
store_artifacts: true
post-steps:
- run:
name: Check coverage π
command: |
npm run check-coverage
npm run only-covered
working_directory: examples/webpack-file
- cypress/run:
name: Example Webpack options
executor: cypress/base-12
requires:
- Install
# each example installs "cypress-react-unit-test" as a local dependency (symlink)
install-command: npm install
verify-command: echo 'Already verified'
no-workspace: true
working_directory: examples/webpack-options
command: npm test
store_artifacts: true
post-steps:
- run:
name: Check coverage π
command: |
npm run check-coverage
npm run only-covered
working_directory: examples/webpack-options
- cypress/run:
name: Example Sass
requires:
- Install
# we need the same OS version as in install job
# because we will use native Sass dependency
executor: cypress/base-12
# each example installs "cypress-react-unit-test" as a local dependency (symlink)
install-command: npm install
verify-command: echo 'Already verified'
no-workspace: true
working_directory: examples/sass-and-ts
command: npm test
store_artifacts: true
post-steps:
- run:
name: Check coverage π
command: |
npm run check-coverage
npm run only-covered
working_directory: examples/sass-and-ts
- cypress/run:
name: Example Snapshots
requires:
- Install
executor: cypress/base-12
# each example installs "cypress-react-unit-test" as a local dependency (symlink)
install-command: npm install
verify-command: echo 'Already verified'
no-workspace: true
working_directory: examples/snapshots
command: npm test
store_artifacts: true
- cypress/run:
name: Visual Sudoku
executor: cypress/base-12
requires:
- Install
# each example installs "cypress-react-unit-test" as a local dependency (symlink)
install-command: npm install
verify-command: echo 'Already verified'
no-workspace: true
working_directory: examples/visual-sudoku
command: npm test
store_artifacts: true
post-steps:
- store_artifacts:
path: examples/visual-sudoku/cypress/snapshots
- cypress/run:
name: Visual with Applitools
executor: base-12-16-2
requires:
- Install
# each example installs "cypress-react-unit-test" as a local dependency (symlink)
install-command: npm install
verify-command: echo 'Already verified'
no-workspace: true
working_directory: examples/visual-testing-with-applitools
command: npm test
store_artifacts: true
- cypress/run:
name: Visual with Percy
executor: base-12-16-2
requires:
- Install
# each example installs "cypress-react-unit-test" as a local dependency (symlink)
install-command: npm install
verify-command: echo 'Already verified'
no-workspace: true
working_directory: examples/visual-testing-with-percy
# run Percy agent and then run Cypress component tests
# https://docs.percy.io/docs/cypress
command: npx percy exec -- npm test
store_artifacts: true
- cypress/run:
name: Visual with Happo
executor: cypress/base-12
requires:
- Install
# each example installs "cypress-react-unit-test" as a local dependency (symlink)
install-command: npm install
verify-command: echo 'Already verified'
no-workspace: true
working_directory: examples/visual-testing-with-happo
command: npm test
store_artifacts: true
- cypress/run:
name: Test
executor: cypress/base-12
parallelism: 4
requires:
- Install
# notice a trick to avoid re-installing dependencies
# in this job - a do-nothing "install-command" parameter
install-command: echo 'Nothing to install in this job'
# we are not going to use results from this job anywhere else
no-workspace: true
record: false
store_artifacts: true
# following examples from
# https://circleci.com/docs/2.0/parallelism-faster-jobs/
command: |
TESTFILES=$(circleci tests glob "cypress/{component,integration}/**/*spec.{js,jsx,ts,tsx}" | circleci tests split --total=4)
echo "Test files for this machine are $TESTFILES"
npx cypress run --spec $TESTFILES
# this job attaches the workspace left by the install job
# so it is ready to run Cypress tests
# only we will run semantic release script instead
- cypress/run:
name: NPM release
# only run NPM release from specific branch(es)
filters:
branches:
only:
- master
# we need newer Node for semantic release
executor: cypress/base-12
requires:
- Install
- Test
- Example A11y
- Example Babel
- Example Component Folder
- Example React Scripts
- Example Sass
- Example Snapshots
- Example Tailwind
- Example Webpack file
- Example Webpack options
- Visual Sudoku
- Visual with Percy
- Visual with Happo
- Visual with Applitools
install-command: echo 'Already installed'
verify-command: echo 'Already verified'
no-workspace: true
# instead of "cypress run" do NPM release π
# clear environment variables to trick semantic-release
# into thinking this is NOT a pull request.
# (under the hood the module env-ci is used to check if this is a PR)
command: |
npm run build
CIRCLE_PR_NUMBER= \
CIRCLE_PULL_REQUEST= \
CI_PULL_REQUEST= \
npm run semantic-release