@knapsack-pro/jest 5.2.0 → 5.4.0
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.
- package/README.md +4 -604
- package/lib/knapsack-pro-jest.js +7 -7
- package/package.json +33 -28
- package/CHANGELOG.md +0 -198
package/README.md
CHANGED
|
@@ -12,27 +12,6 @@ Learn about Knapsack Pro Queue Mode in the video [how to run tests with dynamic
|
|
|
12
12
|
## Table of Contents
|
|
13
13
|
|
|
14
14
|
- [Installation](#installation)
|
|
15
|
-
- [How to use](#how-to-use)
|
|
16
|
-
- [Configuration steps](#configuration-steps)
|
|
17
|
-
- [CI steps](#ci-steps)
|
|
18
|
-
- [CircleCI](#circleci)
|
|
19
|
-
- [Travis CI](#travis-ci)
|
|
20
|
-
- [Buildkite.com](#buildkitecom)
|
|
21
|
-
- [Codeship.com](#codeshipcom)
|
|
22
|
-
- [Heroku CI](#heroku-ci)
|
|
23
|
-
- [Solano CI](#solano-ci)
|
|
24
|
-
- [AppVeyor](#appveyor)
|
|
25
|
-
- [GitLab CI](#gitlab-ci)
|
|
26
|
-
- [GitLab CI `>= 11.5`](#gitlab-ci--115)
|
|
27
|
-
- [GitLab CI `< 11.5` (old GitLab CI)](#gitlab-ci--115-old-gitlab-ci)
|
|
28
|
-
- [SemaphoreCI.com](#semaphorecicom)
|
|
29
|
-
- [Semaphore 2.0](#semaphore-20)
|
|
30
|
-
- [Semaphore 1.0](#semaphore-10)
|
|
31
|
-
- [Cirrus-CI.org](#cirrus-ciorg)
|
|
32
|
-
- [Jenkins](#jenkins)
|
|
33
|
-
- [GitHub Actions](#github-actions)
|
|
34
|
-
- [Codefresh.io](#codefreshio)
|
|
35
|
-
- [Other CI provider](#other-ci-provider)
|
|
36
15
|
- [FAQ](#faq)
|
|
37
16
|
- [Development](#development)
|
|
38
17
|
- [Requirements](#requirements)
|
|
@@ -47,585 +26,7 @@ Learn about Knapsack Pro Queue Mode in the video [how to run tests with dynamic
|
|
|
47
26
|
|
|
48
27
|
## Installation
|
|
49
28
|
|
|
50
|
-
|
|
51
|
-
`@knapsack-pro/jest` uses `jest` version installed in your project.
|
|
52
|
-
|
|
53
|
-
For `npm` users:
|
|
54
|
-
|
|
55
|
-
```
|
|
56
|
-
$ npm install --save-dev @knapsack-pro/jest
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
For `yarn` users:
|
|
60
|
-
|
|
61
|
-
```
|
|
62
|
-
$ yarn add --dev @knapsack-pro/jest
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
Whenever you see `npm` in below steps you can use `yarn` there as well.
|
|
66
|
-
|
|
67
|
-
## How to use
|
|
68
|
-
|
|
69
|
-
### Configuration steps
|
|
70
|
-
|
|
71
|
-
1. To get API token just sign up at [KnapsackPro.com](https://knapsackpro.com?utm_source=github&utm_medium=readme&utm_campaign=%40knapsack-pro%2Fjest&utm_content=sign_up). Please add to your CI environment variables `KNAPSACK_PRO_TEST_SUITE_TOKEN_JEST`. You can generate API token in [user dashboard](https://knapsackpro.com/dashboard).
|
|
72
|
-
|
|
73
|
-
Next to your API token, you can find a link "Build metrics" where you can preview recorded CI builds. You will see yellow tips if something is not configured as expected. Refresh the page once you finish running tests to see new tips. You can also click "Show" on CI build to see details about particular CI build. Look for yellow tips suggesting what to change to ensure all works fine for your project.
|
|
74
|
-
|
|
75
|
-
2. (optional) Do you want to use "retry single failed parallel CI node" feature for your CI? For instance some of CI providers like Travis CI, Buildkite or Codeship allows you to retry only one of failed parallel CI node instead of retrying the whole CI build with all parallel CI nodes. If you want to be able to retry only single failed parallel CI node then you need to tell Knapsack Pro API to remember the way how test files where allocated across parallel CI nodes by adding to your CI environment variables `KNAPSACK_PRO_FIXED_QUEUE_SPLIT=true`.
|
|
76
|
-
|
|
77
|
-
The default is `KNAPSACK_PRO_FIXED_QUEUE_SPLIT=false` which means when you want to retry the whole failed CI build then a new dynamic test suite split will happen across all retried parallel CI nodes thanks to Knapsack Pro Queue Mode. Some people may prefer to retry the whole failed CI build with test files allocated across parallel CI nodes in the same order as it happend for the failed CI build - in such case you should set `KNAPSACK_PRO_FIXED_QUEUE_SPLIT=true`.
|
|
78
|
-
|
|
79
|
-
3. (optional) If one of the parallel CI nodes starts work very late after other parallel CI nodes already finished work.
|
|
80
|
-
|
|
81
|
-
Some of CI providers have a problem with starting parallel CI nodes as soon as possible. For instance, you have a fixed pool of parallel CI nodes shared with many CI builds and sometimes CI build has started work even the pool has not enough available parallel CI nodes at the moment. Another case is when the CI provider infrastructure is overloaded which can lead to some parallel CI nodes starting work later than others.
|
|
82
|
-
|
|
83
|
-
Do you have the CI server that does not start all parallel CI nodes at the same time and one of your parallel CI nodes will start work very late after all other parallel CI nodes already finished consuming tests from the Knapsack Pro Queue? In such a case, if you would use default `KNAPSACK_PRO_FIXED_QUEUE_SPLIT=false` then the very late CI node would start running all tests again based on a new Queue which means you would run test suite twice. This problem can happen if your test suite is very small and differences in the start time of parallel CI nodes are very big.
|
|
84
|
-
|
|
85
|
-
You should set `KNAPSACK_PRO_FIXED_QUEUE_SPLIT=true` to ensure the very late parallel CI node won't run tests again if the Queue was already consumed. The downside of this is that you won't be able to run 2nd CI build for the same set of values git commit/branch/ci node total number with a dynamic test suite split way if your CI provider does not expose unique CI build ID. Instead, the tests will be run assigned to the same parallel CI node indexes with the same order as it was recorded for the first time.
|
|
86
|
-
|
|
87
|
-
Knapsack Pro tries to detect CI build ID from the environment variables of your CI provider. Here you can check if your CI provider exposes CI build ID, see function [`ciNodeBuildId`](https://github.com/KnapsackPro/knapsack-pro-core-js/blob/master/src/ci-providers/github-actions.ts#L14) (example for Github Actions). If you CI provider won't provide CI build ID you can set `KNAPSACK_PRO_CI_NODE_BUILD_ID` (see next point).
|
|
88
|
-
|
|
89
|
-
4. (optional) `@knapsack-pro/jest` detects information about CI build from supported CI environment variables. When information like git branch name and git commit hash cannot be detect from CI environment variables then `@knapsack-pro/jest` will try to use git installed on CI machine to detect the infomation. If you don't have git installed then you should set the information using environment variables:
|
|
90
|
-
|
|
91
|
-
- `KNAPSACK_PRO_COMMIT_HASH` - git commit hash (SHA1)
|
|
92
|
-
- `KNAPSACK_PRO_BRANCH` - git branch name
|
|
93
|
-
- `KNAPSACK_PRO_CI_NODE_BUILD_ID` - a unique ID for your CI build. All parallel CI nodes being part of single CI build must have the same node build ID. Example how to generate node build ID: `KNAPSACK_PRO_CI_NODE_BUILD_ID=$(openssl rand - base64 32)`.
|
|
94
|
-
|
|
95
|
-
5. If you have test files in a non-default directory or you specify test files to run in Jest config file then you won't be able to run tests and you may see below error.
|
|
96
|
-
|
|
97
|
-
```
|
|
98
|
-
Response body:
|
|
99
|
-
{ errors: [ { test_files: [ 'parameter is required' ] } ] }
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
Please [adjust `KNAPSACK_PRO_TEST_FILE_PATTERN`](https://knapsackpro.com/faq/question/how-to-run-tests-only-from-specific-directory-in-jest) variable to match your test files directory structure to let Knapsack Pro detect all the test files you want to run in parallel. You can also exclude test files with [`KNAPSACK_PRO_TEST_FILE_EXCLUDE_PATTERN`](https://knapsackpro.com/faq/question/how-to-exclude-tests-to-ignore-them-from-running-in-jest).
|
|
103
|
-
|
|
104
|
-
6. If you want to use [Jest config file with `@knapsack-pro/jest`](https://knapsackpro.com/faq/question/how-to-use-jest-config-file-with-knapsack-pro-jest) check this tip.
|
|
105
|
-
|
|
106
|
-
7. If you use `--coverage` flag for Jest to generate code coverage then to make it work please check [how to generate code coverage for Jest with `@knapsack-pro/jest` in Queue Mode](https://knapsackpro.com/faq/question/how-to-generate-code-coverage-for-jest-with-knapsack-pro-jest-in-queue-mode)?
|
|
107
|
-
|
|
108
|
-
8. If you use `jest-junit` please check [how to generate XML report using `jest-junit` with `@knapsack-pro/jest` in Queue Mode](https://knapsackpro.com/faq/question/how-to-generate-xml-report-using-jest-junit-with-knapsack-pro-jest-in-queue-mode)?
|
|
109
|
-
|
|
110
|
-
9. To run tests faster you should pass option [`--runInBand`](https://jestjs.io/docs/en/cli#--runinband) to Knapsack Pro that will pass it down to Jest:
|
|
111
|
-
|
|
112
|
-
```
|
|
113
|
-
$(npm bin)/knapsack-pro-jest --runInBand
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
You will see where to add the above command in your CI provider config in further steps.
|
|
117
|
-
|
|
118
|
-
`--runInBand` does run all tests serially in the current process, rather than creating a worker pool of child processes. Knapsack Pro starts Jest process for each set of tests fetched from Knapsack Pro Queue API.
|
|
119
|
-
By using `--runInBand` you can save time by not starting the worker pool of child processes for each set of tests fetched from Knapsack Pro Queue API.
|
|
120
|
-
|
|
121
|
-
See [example how test suite can run 2 times faster with `--runInBand`](https://github.com/KnapsackPro/knapsack-pro-jest/issues/24). You can test this option yourself to verify if it helps increase the speed of tests in case of your test suite.
|
|
122
|
-
|
|
123
|
-
10. Please select your CI provider and follow instructions to run tests with `@knapsack-pro/jest`.
|
|
124
|
-
|
|
125
|
-
- [CircleCI](#circleci)
|
|
126
|
-
- [Travis CI](#travis-ci)
|
|
127
|
-
- [Buildkite.com](#buildkitecom)
|
|
128
|
-
- [Codeship.com](#codeshipcom)
|
|
129
|
-
- [Heroku CI](#heroku-ci)
|
|
130
|
-
- [Solano CI](#solano-ci)
|
|
131
|
-
- [AppVeyor](#appveyor)
|
|
132
|
-
- [GitLab CI](#gitlab-ci)
|
|
133
|
-
- [SemaphoreCI.com](#semaphorecicom)
|
|
134
|
-
- [Cirrus-CI.org](#cirrus-ciorg)
|
|
135
|
-
- [Jenkins](#jenkins)
|
|
136
|
-
- [GitHub Actions](#github-actions)
|
|
137
|
-
- [Codefresh.io](#codefreshio)
|
|
138
|
-
- [Other CI provider](#other-ci-provider)
|
|
139
|
-
|
|
140
|
-
### CI steps
|
|
141
|
-
|
|
142
|
-
#### CircleCI
|
|
143
|
-
|
|
144
|
-
Example configuration for CircleCI 2.0 platform.
|
|
145
|
-
|
|
146
|
-
```YAML
|
|
147
|
-
# ~/.circleci/config.yml
|
|
148
|
-
version: 2
|
|
149
|
-
jobs:
|
|
150
|
-
test:
|
|
151
|
-
docker:
|
|
152
|
-
- image: circleci/<language>:<version TAG>
|
|
153
|
-
parallelism: 2 # run 2 parallel CI nodes
|
|
154
|
-
|
|
155
|
-
steps:
|
|
156
|
-
- checkout
|
|
157
|
-
|
|
158
|
-
- run:
|
|
159
|
-
name: Run Jest tests with @knapsack-pro/jest using Knapsack Pro Queue Mode
|
|
160
|
-
command: $(npm bin)/knapsack-pro-jest
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
Please remember to add additional parallel containers for your project in CircleCI settings.
|
|
164
|
-
|
|
165
|
-
#### Travis CI
|
|
166
|
-
|
|
167
|
-
You can parallelize your CI build across virtual machines with [travis matrix feature](https://docs.travis-ci.com/user/speeding-up-the-build/#parallelizing-your-builds-across-virtual-machines).
|
|
168
|
-
|
|
169
|
-
```yaml
|
|
170
|
-
# .travis.yml
|
|
171
|
-
script:
|
|
172
|
-
- '$(npm bin)/knapsack-pro-jest'
|
|
173
|
-
|
|
174
|
-
env:
|
|
175
|
-
global:
|
|
176
|
-
- KNAPSACK_PRO_CI_NODE_TOTAL=2
|
|
177
|
-
# allows to be able to retry failed tests on one of parallel job (CI node)
|
|
178
|
-
- KNAPSACK_PRO_FIXED_QUEUE_SPLIT=true
|
|
179
|
-
|
|
180
|
-
jobs:
|
|
181
|
-
- KNAPSACK_PRO_CI_NODE_INDEX=0
|
|
182
|
-
- KNAPSACK_PRO_CI_NODE_INDEX=1
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
The configuration will generate matrix with 2 parallel jobs (2 parallel CI nodes):
|
|
186
|
-
|
|
187
|
-
```
|
|
188
|
-
# first CI node (first parallel job)
|
|
189
|
-
KNAPSACK_PRO_CI_NODE_TOTAL=2 KNAPSACK_PRO_CI_NODE_INDEX=0
|
|
190
|
-
|
|
191
|
-
# second CI node (second parallel job)
|
|
192
|
-
KNAPSACK_PRO_CI_NODE_TOTAL=2 KNAPSACK_PRO_CI_NODE_INDEX=1
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
More info about global and matrix ENV configuration in [travis docs](https://docs.travis-ci.com/user/customizing-the-build/#build-matrix).
|
|
196
|
-
|
|
197
|
-
#### Buildkite.com
|
|
198
|
-
|
|
199
|
-
The only thing you need to do is to configure the parallelism parameter (number of parallel agents) in your build step and run the below command in your build:
|
|
200
|
-
|
|
201
|
-
```
|
|
202
|
-
$(npm bin)/knapsack-pro-jest
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
If you want to use Buildkite retry single agent feature to retry just failed tests on particular agent (CI node) then you should set `KNAPSACK_PRO_FIXED_QUEUE_SPLIT=true`.
|
|
206
|
-
|
|
207
|
-
**Other useful resources:**
|
|
208
|
-
|
|
209
|
-
Here you can find article [how to set up a new pipeline for your project in Buildkite and configure Knapsack Pro](http://docs.knapsackpro.com/2017/auto-balancing-7-hours-tests-between-100-parallel-jobs-on-ci-buildkite-example) and 2 example repositories for Ruby/Rails projects:
|
|
210
|
-
|
|
211
|
-
- [Buildkite Rails Parallel Example with Knapsack Pro](https://github.com/KnapsackPro/buildkite-rails-parallel-example-with-knapsack_pro)
|
|
212
|
-
- [Buildkite Rails Docker Parallel Example with Knapsack Pro](https://github.com/KnapsackPro/buildkite-rails-docker-parallel-example-with-knapsack_pro)
|
|
213
|
-
|
|
214
|
-
When using the `docker-compose` plugin on Buildkite, you have to tell it which environment variables to pass to the docker container. Thanks to it Knapsack Pro can detect info about CI build like commit, branch name, amount of parallel nodes.
|
|
215
|
-
|
|
216
|
-
```yaml
|
|
217
|
-
steps:
|
|
218
|
-
- label: 'Test'
|
|
219
|
-
parallelism: 2
|
|
220
|
-
plugins:
|
|
221
|
-
- docker-compose#3.0.3:
|
|
222
|
-
run: app
|
|
223
|
-
command: $(npm bin)/knapsack-pro-jest
|
|
224
|
-
config: docker-compose.test.yml
|
|
225
|
-
env:
|
|
226
|
-
- BUILDKITE_PARALLEL_JOB_COUNT
|
|
227
|
-
- BUILDKITE_PARALLEL_JOB
|
|
228
|
-
- BUILDKITE_BUILD_NUMBER
|
|
229
|
-
- BUILDKITE_COMMIT
|
|
230
|
-
- BUILDKITE_BRANCH
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
#### Codeship.com
|
|
234
|
-
|
|
235
|
-
Codeship does not provide parallel jobs environment variables so you will have to define `KNAPSACK_PRO_CI_NODE_TOTAL` and `KNAPSACK_PRO_CI_NODE_INDEX` for each [parallel test pipeline](https://documentation.codeship.com/basic/builds-and-configuration/parallel-tests/#using-parallel-test-pipelines). Below is an example for 2 parallel test pipelines.
|
|
236
|
-
|
|
237
|
-
Configure test pipelines (1/2 used)
|
|
238
|
-
|
|
239
|
-
```
|
|
240
|
-
# first CI node running in parallel
|
|
241
|
-
KNAPSACK_PRO_CI_NODE_TOTAL=2 KNAPSACK_PRO_CI_NODE_INDEX=0 $(npm bin)/knapsack-pro-jest
|
|
242
|
-
```
|
|
243
|
-
|
|
244
|
-
Configure test pipelines (2/2 used)
|
|
245
|
-
|
|
246
|
-
```
|
|
247
|
-
# second CI node running in parallel
|
|
248
|
-
KNAPSACK_PRO_CI_NODE_TOTAL=2 KNAPSACK_PRO_CI_NODE_INDEX=1 $(npm bin)/knapsack-pro-jest
|
|
249
|
-
```
|
|
250
|
-
|
|
251
|
-
Remember to add API token `KNAPSACK_PRO_TEST_SUITE_TOKEN_JEST` to `Environment` page of your project settings in Codeship.
|
|
252
|
-
|
|
253
|
-
CodeShip uses the same build number if you restart a build. Because of that you need to set `KNAPSACK_PRO_FIXED_QUEUE_SPLIT=true` in order to be able to restart CI build.
|
|
254
|
-
|
|
255
|
-
#### Heroku CI
|
|
256
|
-
|
|
257
|
-
You can parallelize your tests on [Heroku CI](https://devcenter.heroku.com/articles/heroku-ci) by configuring `app.json` for your project.
|
|
258
|
-
|
|
259
|
-
You can set how many parallel dynos with tests you want to run with `quantity` value.
|
|
260
|
-
Use `test` key to run tests with `@knapsack-pro/jest` as shown in below example.
|
|
261
|
-
|
|
262
|
-
You need to specify also the environment variable `KNAPSACK_PRO_TEST_SUITE_TOKEN_JEST` with API token for Knapsack Pro.
|
|
263
|
-
For any sensitive environment variables (like Knapsack Pro API token) that you do not want commited in your `app.json` manifest, you can add them to your pipeline’s Heroku CI settings.
|
|
264
|
-
|
|
265
|
-
```
|
|
266
|
-
# app.json
|
|
267
|
-
{
|
|
268
|
-
"environments": {
|
|
269
|
-
"test": {
|
|
270
|
-
"formation": {
|
|
271
|
-
"test": {
|
|
272
|
-
"quantity": 2
|
|
273
|
-
}
|
|
274
|
-
},
|
|
275
|
-
"addons": [
|
|
276
|
-
"heroku-postgresql"
|
|
277
|
-
],
|
|
278
|
-
"scripts": {
|
|
279
|
-
"test": "$(npm bin)/knapsack-pro-jest"
|
|
280
|
-
},
|
|
281
|
-
"env": {
|
|
282
|
-
"KNAPSACK_PRO_TEST_SUITE_TOKEN_JEST": "example"
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
```
|
|
288
|
-
|
|
289
|
-
If you would like to [run multiple Knapsack Pro commands for different test runners on Heroku CI](https://knapsackpro.com/faq/question/how-to-run-multiple-test-suite-commands-in-heroku-ci) please follow tips.
|
|
290
|
-
|
|
291
|
-
Note the [Heroku CI Parallel Test Runs](https://devcenter.heroku.com/articles/heroku-ci-parallel-test-runs) are in Beta and you may need to ask Heroku support to enable it for your project.
|
|
292
|
-
|
|
293
|
-
You can learn more about [Heroku CI](https://devcenter.heroku.com/articles/heroku-ci).
|
|
294
|
-
|
|
295
|
-
#### Solano CI
|
|
296
|
-
|
|
297
|
-
[Solano CI](https://www.solanolabs.com) does not provide parallel jobs environment variables so you will have to define `KNAPSACK_PRO_CI_NODE_TOTAL` and `KNAPSACK_PRO_CI_NODE_INDEX` for each parallel job running as part of the same CI build.
|
|
298
|
-
|
|
299
|
-
```
|
|
300
|
-
# Step for first CI node
|
|
301
|
-
KNAPSACK_PRO_CI_NODE_TOTAL=2 KNAPSACK_PRO_CI_NODE_INDEX=0 $(npm bin)/knapsack-pro-jest
|
|
302
|
-
|
|
303
|
-
# Step for second CI node
|
|
304
|
-
KNAPSACK_PRO_CI_NODE_TOTAL=2 KNAPSACK_PRO_CI_NODE_INDEX=1 $(npm bin)/knapsack-pro-jest
|
|
305
|
-
```
|
|
306
|
-
|
|
307
|
-
Please remember to set up API token `KNAPSACK_PRO_TEST_SUITE_TOKEN_JEST` as global environment.
|
|
308
|
-
|
|
309
|
-
#### AppVeyor
|
|
310
|
-
|
|
311
|
-
[AppVeyor](https://www.appveyor.com) does not provide parallel jobs environment variables so you will have to define `KNAPSACK_PRO_CI_NODE_TOTAL` and `KNAPSACK_PRO_CI_NODE_INDEX` for each parallel job running as part of the same CI build.
|
|
312
|
-
|
|
313
|
-
```
|
|
314
|
-
# Step for first CI node
|
|
315
|
-
KNAPSACK_PRO_CI_NODE_TOTAL=2 KNAPSACK_PRO_CI_NODE_INDEX=0 $(npm bin)/knapsack-pro-jest
|
|
316
|
-
|
|
317
|
-
# Step for second CI node
|
|
318
|
-
KNAPSACK_PRO_CI_NODE_TOTAL=2 KNAPSACK_PRO_CI_NODE_INDEX=1 $(npm bin)/knapsack-pro-jest
|
|
319
|
-
```
|
|
320
|
-
|
|
321
|
-
Please remember to set up API token `KNAPSACK_PRO_TEST_SUITE_TOKEN_JEST` as global environment.
|
|
322
|
-
|
|
323
|
-
#### GitLab CI
|
|
324
|
-
|
|
325
|
-
Remember to add API token `KNAPSACK_PRO_TEST_SUITE_TOKEN_JEST` to [Secret Variables](https://gitlab.com/help/ci/variables/README.md#secret-variables) in `Gitlab CI Settings -> CI/CD Pipelines -> Secret Variables`.
|
|
326
|
-
|
|
327
|
-
##### GitLab CI `>= 11.5`
|
|
328
|
-
|
|
329
|
-
```yaml
|
|
330
|
-
test:
|
|
331
|
-
parallel: 2
|
|
332
|
-
script: $(npm bin)/knapsack-pro-jest
|
|
333
|
-
```
|
|
334
|
-
|
|
335
|
-
Here you can find info [how to configure the GitLab parallel CI nodes](https://docs.gitlab.com/ee/ci/yaml/#parallel).
|
|
336
|
-
|
|
337
|
-
##### GitLab CI `< 11.5` (old GitLab CI)
|
|
338
|
-
|
|
339
|
-
GitLab CI does not provide parallel jobs environment variables so you will have to define `KNAPSACK_PRO_CI_NODE_TOTAL` and `KNAPSACK_PRO_CI_NODE_INDEX` for each parallel job running as part of the same `test` stage. Below is relevant part of `.gitlab-ci.yml` configuration for 2 parallel jobs.
|
|
340
|
-
|
|
341
|
-
```
|
|
342
|
-
# .gitlab-ci.yml
|
|
343
|
-
stages:
|
|
344
|
-
- test
|
|
345
|
-
|
|
346
|
-
variables:
|
|
347
|
-
KNAPSACK_PRO_CI_NODE_TOTAL: 2
|
|
348
|
-
|
|
349
|
-
# first CI node running in parallel
|
|
350
|
-
test_ci_node_0:
|
|
351
|
-
stage: test
|
|
352
|
-
script:
|
|
353
|
-
- export KNAPSACK_PRO_CI_NODE_INDEX=0
|
|
354
|
-
- $(npm bin)/knapsack-pro-jest
|
|
355
|
-
|
|
356
|
-
# second CI node running in parallel
|
|
357
|
-
test_ci_node_1:
|
|
358
|
-
stage: test
|
|
359
|
-
script:
|
|
360
|
-
- export KNAPSACK_PRO_CI_NODE_INDEX=1
|
|
361
|
-
- $(npm bin)/knapsack-pro-jest
|
|
362
|
-
```
|
|
363
|
-
|
|
364
|
-
#### SemaphoreCI.com
|
|
365
|
-
|
|
366
|
-
##### Semaphore 2.0
|
|
367
|
-
|
|
368
|
-
`@knapsack-pro/jest` supports environment variables provided by Semaphore CI 2.0 to run your tests. You will have to define a few things in `.semaphore/semaphore.yml` config file.
|
|
369
|
-
|
|
370
|
-
- You need to set `KNAPSACK_PRO_TEST_SUITE_TOKEN_JEST`. If you don't want to commit secrets in yml file then you can [follow this guide](https://docs.semaphoreci.com/article/66-environment-variables-and-secrets).
|
|
371
|
-
- You should create as many parallel jobs as you need with `parallelism` property. If your test suite is slow you should use more parallel jobs.
|
|
372
|
-
|
|
373
|
-
Below you can find example part of Semaphore CI 2.0 config.
|
|
374
|
-
|
|
375
|
-
```yaml
|
|
376
|
-
blocks:
|
|
377
|
-
- name: Jest tests
|
|
378
|
-
task:
|
|
379
|
-
env_vars:
|
|
380
|
-
- name: KNAPSACK_PRO_TEST_SUITE_TOKEN_JEST
|
|
381
|
-
value: your_api_token_here
|
|
382
|
-
prologue:
|
|
383
|
-
commands:
|
|
384
|
-
- checkout
|
|
385
|
-
- nvm install --lts carbon
|
|
386
|
-
- sem-version node --lts carbon
|
|
387
|
-
|
|
388
|
-
jobs:
|
|
389
|
-
- name: Run tests with Knapsack Pro
|
|
390
|
-
parallelism: 2
|
|
391
|
-
commands:
|
|
392
|
-
- $(npm bin)/knapsack-pro-jest
|
|
393
|
-
```
|
|
394
|
-
|
|
395
|
-
##### Semaphore 1.0
|
|
396
|
-
|
|
397
|
-
The only thing you need to do is set up `@knapsack-pro/jest` for as many parallel threads as you need. Here is an example:
|
|
398
|
-
|
|
399
|
-
```
|
|
400
|
-
# Thread 1
|
|
401
|
-
$(npm bin)/knapsack-pro-jest
|
|
402
|
-
|
|
403
|
-
# Thread 2
|
|
404
|
-
$(npm bin)/knapsack-pro-jest
|
|
405
|
-
```
|
|
406
|
-
|
|
407
|
-
Tests will be split across 2 parallel threads.
|
|
408
|
-
|
|
409
|
-
Please remember to set up API token `KNAPSACK_PRO_TEST_SUITE_TOKEN_JEST` as global environment.
|
|
410
|
-
|
|
411
|
-
#### Cirrus-CI.org
|
|
412
|
-
|
|
413
|
-
The only thing you need to do is to configure number of parallel CI nodes for your project by using [matrix modification](https://cirrus-ci.org/guide/writing-tasks/#matrix-modification). See example for 2 parallel CI nodes.
|
|
414
|
-
|
|
415
|
-
```
|
|
416
|
-
# .cirrus.yml
|
|
417
|
-
task:
|
|
418
|
-
matrix:
|
|
419
|
-
name: CI node 0
|
|
420
|
-
name: CI node 1
|
|
421
|
-
test_script: $(npm bin)/knapsack-pro-jest
|
|
422
|
-
```
|
|
423
|
-
|
|
424
|
-
Please remember to set up API token `KNAPSACK_PRO_TEST_SUITE_TOKEN_JEST` as global environment.
|
|
425
|
-
|
|
426
|
-
Here is Ruby example for [`.cirrus.yml` configuration file](https://cirrus-ci.org/examples/#ruby) that you may find useful.
|
|
427
|
-
|
|
428
|
-
#### Jenkins
|
|
429
|
-
|
|
430
|
-
In order to run parallel jobs with Jenkins you should use Jenkins Pipeline.
|
|
431
|
-
You can learn basics about it in the article [Parallelism and Distributed Builds with Jenkins](https://www.cloudbees.com/blog/parallelism-and-distributed-builds-jenkins).
|
|
432
|
-
|
|
433
|
-
Here is example `Jenkinsfile` working with Jenkins Pipeline.
|
|
434
|
-
|
|
435
|
-
```
|
|
436
|
-
timeout(time: 60, unit: 'MINUTES') {
|
|
437
|
-
node() {
|
|
438
|
-
stage('Checkout') {
|
|
439
|
-
checkout([/* checkout code from git */])
|
|
440
|
-
|
|
441
|
-
// determine git commit hash because we need to pass it to Knapsack Pro
|
|
442
|
-
COMMIT_HASH = sh(returnStdout: true, script: 'git rev-parse HEAD').trim()
|
|
443
|
-
|
|
444
|
-
stash 'source'
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
def num_nodes = 4; // define your total number of CI nodes (how many parallel jobs will be executed)
|
|
449
|
-
def nodes = [:]
|
|
450
|
-
|
|
451
|
-
for (int i = 0; i < num_nodes; i++) {
|
|
452
|
-
def index = i;
|
|
453
|
-
nodes["ci_node_${i}"] = {
|
|
454
|
-
node() {
|
|
455
|
-
stage('Setup') {
|
|
456
|
-
unstash 'source'
|
|
457
|
-
// other setup steps
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
def knapsack_options = """\
|
|
461
|
-
KNAPSACK_PRO_CI_NODE_TOTAL=${num_nodes}\
|
|
462
|
-
KNAPSACK_PRO_CI_NODE_INDEX=${index}\
|
|
463
|
-
KNAPSACK_PRO_COMMIT_HASH=${COMMIT_HASH}\
|
|
464
|
-
KNAPSACK_PRO_BRANCH=${env.BRANCH_NAME}\
|
|
465
|
-
KNAPSACK_PRO_CI_NODE_BUILD_ID=${env.BUILD_TAG}\
|
|
466
|
-
"""
|
|
467
|
-
|
|
468
|
-
// example how to run tests with Knapsack Pro
|
|
469
|
-
stage('Run tests') {
|
|
470
|
-
sh """${knapsack_options} $(npm bin)/knapsack-pro-jest"""
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
parallel nodes // run CI nodes in parallel
|
|
477
|
-
}
|
|
478
|
-
```
|
|
479
|
-
|
|
480
|
-
Remember to set environment variable `KNAPSACK_PRO_TEST_SUITE_TOKEN_JEST` in Jenkins configuration with your API token.
|
|
481
|
-
|
|
482
|
-
#### GitHub Actions
|
|
483
|
-
|
|
484
|
-
`@knapsack-pro/jest` supports environment variables provided by GitHub Actions to run your tests. You have to define a few things in `.github/workflows/main.yaml` config file.
|
|
485
|
-
|
|
486
|
-
- You need to set `KNAPSACK_PRO_TEST_SUITE_TOKEN_JEST` environment variable in GitHub repository Settings -> Secrets. See [creating and using secrets in GitHub Actions](https://help.github.com/en/articles/virtual-environments-for-github-actions#creating-and-using-secrets-encrypted-variables).
|
|
487
|
-
- You should create as many parallel jobs as you need with `matrix.ci_node_total` and `matrix.ci_node_index` properties. If your test suite is slow you should use more parallel jobs.
|
|
488
|
-
|
|
489
|
-
Below you can find config for GitHub Actions.
|
|
490
|
-
|
|
491
|
-
```yaml
|
|
492
|
-
# .github/workflows/main.yaml
|
|
493
|
-
name: Main
|
|
494
|
-
|
|
495
|
-
on: [push]
|
|
496
|
-
|
|
497
|
-
jobs:
|
|
498
|
-
build:
|
|
499
|
-
runs-on: ubuntu-latest
|
|
500
|
-
|
|
501
|
-
strategy:
|
|
502
|
-
fail-fast: false
|
|
503
|
-
matrix:
|
|
504
|
-
node-version: [8.x]
|
|
505
|
-
# Set N number of parallel jobs you want to run tests on.
|
|
506
|
-
# Use higher number if you have slow tests to split them on more parallel jobs.
|
|
507
|
-
# Remember to update ci_node_index below to 0..N-1
|
|
508
|
-
ci_node_total: [2]
|
|
509
|
-
# set N-1 indexes for parallel jobs
|
|
510
|
-
# When you run 2 parallel jobs then first job will have index 0, the second job will have index 1 etc
|
|
511
|
-
ci_node_index: [0, 1]
|
|
512
|
-
|
|
513
|
-
steps:
|
|
514
|
-
- uses: actions/checkout@v1
|
|
515
|
-
|
|
516
|
-
- name: Use Node.js ${{ matrix.node-version }}
|
|
517
|
-
uses: actions/setup-node@v1
|
|
518
|
-
with:
|
|
519
|
-
node-version: ${{ matrix.node-version }}
|
|
520
|
-
|
|
521
|
-
- name: npm install and build
|
|
522
|
-
run: |
|
|
523
|
-
npm install
|
|
524
|
-
npm run build --if-present
|
|
525
|
-
|
|
526
|
-
- name: Run tests with Knapsack Pro
|
|
527
|
-
env:
|
|
528
|
-
KNAPSACK_PRO_TEST_SUITE_TOKEN_JEST: ${{ secrets.KNAPSACK_PRO_TEST_SUITE_TOKEN_JEST }}
|
|
529
|
-
KNAPSACK_PRO_CI_NODE_TOTAL: ${{ matrix.ci_node_total }}
|
|
530
|
-
KNAPSACK_PRO_CI_NODE_INDEX: ${{ matrix.ci_node_index }}
|
|
531
|
-
# allows rerun parallel jobs with the same set of tests
|
|
532
|
-
# that were consumed from Queue in the very first CI build run
|
|
533
|
-
KNAPSACK_PRO_FIXED_QUEUE_SPLIT: true
|
|
534
|
-
run: |
|
|
535
|
-
$(npm bin)/knapsack-pro-jest
|
|
536
|
-
```
|
|
537
|
-
|
|
538
|
-
#### Codefresh.io
|
|
539
|
-
|
|
540
|
-
`@knapsack-pro/jest` supports environment variables provided by Codefresh.io to run your tests. You have to define a few things in `.codefresh/codefresh.yml` config file.
|
|
541
|
-
|
|
542
|
-
- You need to set an API token `KNAPSACK_PRO_TEST_SUITE_TOKEN_JEST` in Codefresh dashboard, see left menu Pipelines -> settings (cog icon next to the pipeline) -> Variables tab (see a vertical menu on the right side).
|
|
543
|
-
- Set where Codefresh YAML file can be found. In Codefresh dashboard, see left menu Pipelines -> settings (cog icon next to pipeline) -> Workflow tab (horizontal menu on the top) -> Path to YAML (set there `./.codefresh/codefresh.yml`).
|
|
544
|
-
- Set how many parallel jobs (parallel CI nodes) you want to run with `KNAPSACK_PRO_CI_NODE_TOTAL` environment variable in `.codefresh/codefresh.yml` file.
|
|
545
|
-
- Ensure in the `matrix` section you listed all `KNAPSACK_PRO_CI_NODE_INDEX` environment variables with a value from `0` to `KNAPSACK_PRO_CI_NODE_TOTAL-1`. Codefresh will generate a matrix of parallel jobs where each job has a different value for `KNAPSACK_PRO_CI_NODE_INDEX`. Thanks to that Knapsack Pro knows what tests should be run on each parallel job.
|
|
546
|
-
|
|
547
|
-
Below you can find Codefresh YAML config and `Test.Dockerfile` used by Codefresh to run the project and Jest test suite inside of Docker container.
|
|
548
|
-
|
|
549
|
-
```yaml
|
|
550
|
-
# .codefresh/codefresh.yml
|
|
551
|
-
version: '1.0'
|
|
552
|
-
|
|
553
|
-
stages:
|
|
554
|
-
- 'clone'
|
|
555
|
-
- 'build'
|
|
556
|
-
- 'tests'
|
|
557
|
-
|
|
558
|
-
steps:
|
|
559
|
-
main_clone:
|
|
560
|
-
type: 'git-clone'
|
|
561
|
-
description: 'Cloning main repository...'
|
|
562
|
-
repo: '${{CF_REPO_OWNER}}/${{CF_REPO_NAME}}'
|
|
563
|
-
revision: '${{CF_BRANCH}}'
|
|
564
|
-
stage: 'clone'
|
|
565
|
-
BuildTestDockerImage:
|
|
566
|
-
title: Building Test Docker image
|
|
567
|
-
type: build
|
|
568
|
-
arguments:
|
|
569
|
-
image_name: '${{CF_ACCOUNT}}/${{CF_REPO_NAME}}-test'
|
|
570
|
-
tag: '${{CF_BRANCH_TAG_NORMALIZED}}-${{CF_SHORT_REVISION}}'
|
|
571
|
-
dockerfile: Test.Dockerfile
|
|
572
|
-
stage: 'build'
|
|
573
|
-
|
|
574
|
-
run_tests:
|
|
575
|
-
stage: 'tests'
|
|
576
|
-
image: '${{BuildTestDockerImage}}'
|
|
577
|
-
working_directory: /src
|
|
578
|
-
fail_fast: false
|
|
579
|
-
environment:
|
|
580
|
-
# set how many parallel jobs you want to run
|
|
581
|
-
- KNAPSACK_PRO_CI_NODE_TOTAL=2
|
|
582
|
-
matrix:
|
|
583
|
-
environment:
|
|
584
|
-
# please ensure you have here listed N-1 indexes
|
|
585
|
-
# where N is KNAPSACK_PRO_CI_NODE_TOTAL
|
|
586
|
-
- KNAPSACK_PRO_CI_NODE_INDEX=0
|
|
587
|
-
- KNAPSACK_PRO_CI_NODE_INDEX=1
|
|
588
|
-
commands:
|
|
589
|
-
- $(npm bin)/knapsack-pro-jest
|
|
590
|
-
```
|
|
591
|
-
|
|
592
|
-
Add `Test.Dockerfile` to your project repository.
|
|
593
|
-
|
|
594
|
-
```Dockerfile
|
|
595
|
-
FROM node:10.13
|
|
596
|
-
|
|
597
|
-
RUN apt-get update && \
|
|
598
|
-
apt-get install -y \
|
|
599
|
-
python3-dev \
|
|
600
|
-
python3-pip
|
|
601
|
-
|
|
602
|
-
# Install AWS CLI
|
|
603
|
-
RUN pip3 install awscli
|
|
604
|
-
|
|
605
|
-
# Install Codefresh CLI
|
|
606
|
-
RUN wget https://github.com/codefresh-io/cli/releases/download/v0.31.1/codefresh-v0.31.1-alpine-x64.tar.gz
|
|
607
|
-
RUN tar -xf codefresh-v0.31.1-alpine-x64.tar.gz -C /usr/local/bin/
|
|
608
|
-
|
|
609
|
-
COPY . /src
|
|
610
|
-
|
|
611
|
-
WORKDIR /src
|
|
612
|
-
|
|
613
|
-
RUN npm install
|
|
614
|
-
```
|
|
615
|
-
|
|
616
|
-
#### Other CI provider
|
|
617
|
-
|
|
618
|
-
You have to define `KNAPSACK_PRO_CI_NODE_TOTAL` and `KNAPSACK_PRO_CI_NODE_INDEX` for each parallel job running as part of the same CI build.
|
|
619
|
-
|
|
620
|
-
```
|
|
621
|
-
# Step for first CI node
|
|
622
|
-
KNAPSACK_PRO_CI_NODE_TOTAL=2 KNAPSACK_PRO_CI_NODE_INDEX=0 $(npm bin)/knapsack-pro-jest
|
|
623
|
-
|
|
624
|
-
# Step for second CI node
|
|
625
|
-
KNAPSACK_PRO_CI_NODE_TOTAL=2 KNAPSACK_PRO_CI_NODE_INDEX=1 $(npm bin)/knapsack-pro-jest
|
|
626
|
-
```
|
|
627
|
-
|
|
628
|
-
Please remember to set up API token `KNAPSACK_PRO_TEST_SUITE_TOKEN_JEST` as global environment variable.
|
|
29
|
+
See the [docs](https://docs.knapsackpro.com/jest/guide/) to get started.
|
|
629
30
|
|
|
630
31
|
## FAQ
|
|
631
32
|
|
|
@@ -639,7 +40,7 @@ Please remember to set up API token `KNAPSACK_PRO_TEST_SUITE_TOKEN_JEST` as glob
|
|
|
639
40
|
|
|
640
41
|
You can use [NVM](https://github.com/nvm-sh/nvm) to manage Node version in development.
|
|
641
42
|
|
|
642
|
-
- `>= Node
|
|
43
|
+
- `>= Node 18.13.0 LTS`
|
|
643
44
|
|
|
644
45
|
### Dependencies
|
|
645
46
|
|
|
@@ -683,14 +84,13 @@ You can use [NVM](https://github.com/nvm-sh/nvm) to manage Node version in devel
|
|
|
683
84
|
|
|
684
85
|
- [Prettier - Code formatter](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
|
|
685
86
|
- [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
|
|
686
|
-
- [TypeScript TSLint Plugin](https://marketplace.visualstudio.com/items?itemName=ms-vscode.vscode-typescript-tslint-plugin)
|
|
687
87
|
- [EditorConfig for VS Code](https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig)
|
|
688
88
|
|
|
689
89
|
- Go to `File > Preferences > Settings > Text Editor > Formatting`
|
|
690
90
|
|
|
691
91
|
Turn on `Format On Save` checkbox.
|
|
692
92
|
|
|
693
|
-
From now on every change in code base will be automatically formatted by [Prettier](https://prettier.io/). [ESLint](https://eslint.org/)
|
|
93
|
+
From now on, every change in code base will be automatically formatted by [Prettier](https://prettier.io/). [ESLint](https://eslint.org/) shows errors and warnings in VSCode.
|
|
694
94
|
|
|
695
95
|
7. Write some code.
|
|
696
96
|
|
|
@@ -791,4 +191,4 @@ If your feature requires code change in [@knapsack-pro/core](https://github.com/
|
|
|
791
191
|
To test `@knapsack-pro/jest` against real test suite we use:
|
|
792
192
|
|
|
793
193
|
- [jest-example-test-suite](https://github.com/KnapsackPro/jest-example-test-suite) project.
|
|
794
|
-
- [react](https://github.com/KnapsackPro/react)
|
|
194
|
+
- (deprecated) [react](https://github.com/KnapsackPro/react)
|
package/lib/knapsack-pro-jest.js
CHANGED
|
@@ -48,16 +48,16 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
50
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
|
-
var _a = require('../package.json'), clientName = _a.name, clientVersion = _a.version;
|
|
52
|
-
var jest = require('jest');
|
|
53
|
-
var uuidv4 = require('uuid').v4;
|
|
54
51
|
var core_1 = require("@knapsack-pro/core");
|
|
55
52
|
var env_config_1 = require("./env-config");
|
|
56
53
|
var test_files_finder_1 = require("./test-files-finder");
|
|
57
54
|
var jest_cli_1 = require("./jest-cli");
|
|
55
|
+
var jest = require('jest');
|
|
56
|
+
var uuidv4 = require('uuid').v4;
|
|
57
|
+
var _a = require('../package.json'), clientName = _a.name, clientVersion = _a.version;
|
|
58
58
|
var jestCLIOptions = jest_cli_1.JestCLI.argvToOptions();
|
|
59
59
|
var knapsackProLogger = new core_1.KnapsackProLogger();
|
|
60
|
-
knapsackProLogger.debug("Jest CLI options:\n"
|
|
60
|
+
knapsackProLogger.debug("Jest CLI options:\n".concat(core_1.KnapsackProLogger.objectInspect(jestCLIOptions)));
|
|
61
61
|
env_config_1.EnvConfig.loadEnvironmentVariables();
|
|
62
62
|
var projectPath = process.cwd();
|
|
63
63
|
var allTestFiles = test_files_finder_1.TestFilesFinder.allTestFiles();
|
|
@@ -69,7 +69,7 @@ var onSuccess = function (queueTestFiles) { return __awaiter(void 0, void 0, voi
|
|
|
69
69
|
case 0:
|
|
70
70
|
testFilePaths = queueTestFiles.map(function (testFile) { return testFile.path; });
|
|
71
71
|
jestCLICoverage = env_config_1.EnvConfig.coverageDirectory
|
|
72
|
-
? { coverageDirectory: env_config_1.EnvConfig.coverageDirectory
|
|
72
|
+
? { coverageDirectory: "".concat(env_config_1.EnvConfig.coverageDirectory, "/").concat(uuidv4()) }
|
|
73
73
|
: {};
|
|
74
74
|
return [4, jest.runCLI(__assign(__assign(__assign({}, jestCLIOptions), jestCLICoverage), { runTestsByPath: true, _: testFilePaths }), [projectPath])];
|
|
75
75
|
case 1:
|
|
@@ -77,8 +77,8 @@ var onSuccess = function (queueTestFiles) { return __awaiter(void 0, void 0, voi
|
|
|
77
77
|
recordedTestFiles = testResults.map(function (_a) {
|
|
78
78
|
var testFilePath = _a.testFilePath, _b = _a.perfStats, start = _b.start, end = _b.end;
|
|
79
79
|
var path = process.platform === 'win32'
|
|
80
|
-
? testFilePath.replace(projectPath
|
|
81
|
-
: testFilePath.replace(projectPath
|
|
80
|
+
? testFilePath.replace("".concat(projectPath, "\\"), '').replace(/\\/g, '/')
|
|
81
|
+
: testFilePath.replace("".concat(projectPath, "/"), '');
|
|
82
82
|
var timeExecutionMiliseconds = end - start;
|
|
83
83
|
var timeExecution = timeExecutionMiliseconds > 0 ? timeExecutionMiliseconds / 1000 : 0.0;
|
|
84
84
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knapsack-pro/jest",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.4.0",
|
|
4
4
|
"description": "Knapsack Pro Jest splits Jest tests across CI nodes and makes sure that tests will run in optimal time on each CI node.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"knapsack",
|
|
@@ -31,10 +31,11 @@
|
|
|
31
31
|
"scripts": {
|
|
32
32
|
"start": "gulp",
|
|
33
33
|
"build": "gulp build",
|
|
34
|
-
"lint": "npm run
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
34
|
+
"lint": "npm run eslint:check && npm run prettier:check",
|
|
35
|
+
"eslint:check": "eslint . --ext .ts",
|
|
36
|
+
"eslint:format": "eslint . --ext .ts --fix",
|
|
37
|
+
"prettier:check": "prettier --check .",
|
|
38
|
+
"prettier:format": "prettier --config .prettierrc.json 'src/**/*.ts' --write",
|
|
38
39
|
"doctoc": "doctoc --title \"## Table of Contents\" README.md"
|
|
39
40
|
},
|
|
40
41
|
"files": [
|
|
@@ -52,34 +53,38 @@
|
|
|
52
53
|
"knapsack-pro-jest": "lib/knapsack-pro-jest.js"
|
|
53
54
|
},
|
|
54
55
|
"dependencies": {
|
|
55
|
-
"@knapsack-pro/core": "^3.
|
|
56
|
-
"glob": "^
|
|
57
|
-
"minimatch": "^
|
|
58
|
-
"minimist": "^1.2.
|
|
59
|
-
"uuid": "^8.3.
|
|
56
|
+
"@knapsack-pro/core": "^3.3.1",
|
|
57
|
+
"glob": "^8.0.3",
|
|
58
|
+
"minimatch": "^5.1.0",
|
|
59
|
+
"minimist": "^1.2.6",
|
|
60
|
+
"uuid": "^8.3.2"
|
|
60
61
|
},
|
|
61
62
|
"peerDependencies": {
|
|
62
|
-
"jest": ">=22.0.0 <
|
|
63
|
+
"jest": ">=22.0.0 <29.0.0"
|
|
63
64
|
},
|
|
64
65
|
"devDependencies": {
|
|
65
|
-
"
|
|
66
|
-
"@babel/
|
|
67
|
-
"@babel/
|
|
68
|
-
"@
|
|
69
|
-
"@types/glob": "^7.
|
|
70
|
-
"@types/node": "^
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"eslint
|
|
76
|
-
"eslint-
|
|
77
|
-
"prettier": "
|
|
78
|
-
"
|
|
79
|
-
"
|
|
66
|
+
"@babel/core": "^7.18.2",
|
|
67
|
+
"@babel/preset-env": "^7.18.2",
|
|
68
|
+
"@babel/register": "^7.17.7",
|
|
69
|
+
"@types/jest": "^28.1.1",
|
|
70
|
+
"@types/glob": "^7.2.0",
|
|
71
|
+
"@types/node": "^17.0.41",
|
|
72
|
+
"@typescript-eslint/eslint-plugin": "^5.27.1",
|
|
73
|
+
"@typescript-eslint/parser": "^5.27.1",
|
|
74
|
+
"del": "^6.1.1",
|
|
75
|
+
"doctoc": "^2.2.0",
|
|
76
|
+
"eslint": "^7.32.0",
|
|
77
|
+
"eslint-config-airbnb-base": "^15.0.0",
|
|
78
|
+
"eslint-config-prettier": "^8.5.0",
|
|
79
|
+
"eslint-plugin-import": "^2.26.0",
|
|
80
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
80
81
|
"gulp": "^4.0.2",
|
|
82
|
+
"gulp-typescript": "^5.0.1",
|
|
81
83
|
"gulp-chmod": "^3.0.0",
|
|
82
|
-
"gulp-filter": "^
|
|
83
|
-
"
|
|
84
|
+
"gulp-filter": "^7.0.0",
|
|
85
|
+
"jest": "^28.1.0",
|
|
86
|
+
"prettier": "^2.6.2",
|
|
87
|
+
"ts-jest": "^28.0.4",
|
|
88
|
+
"typescript": "^4.7.3"
|
|
84
89
|
}
|
|
85
90
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## [v5.2.0](https://github.com/KnapsackPro/knapsack-pro-jest/tree/v5.2.0) (2021-04-18)
|
|
4
|
-
|
|
5
|
-
[Full Changelog](https://github.com/KnapsackPro/knapsack-pro-jest/compare/v5.1.1...v5.2.0)
|
|
6
|
-
|
|
7
|
-
**Implemented enhancements:**
|
|
8
|
-
|
|
9
|
-
- Use 0 seconds as a default test file time execution [\#36](https://github.com/KnapsackPro/knapsack-pro-jest/pull/36) ([ArturT](https://github.com/ArturT))
|
|
10
|
-
|
|
11
|
-
**Closed issues:**
|
|
12
|
-
|
|
13
|
-
- Force exit doesn't work [\#31](https://github.com/KnapsackPro/knapsack-pro-jest/issues/31)
|
|
14
|
-
|
|
15
|
-
**Merged pull requests:**
|
|
16
|
-
|
|
17
|
-
- Remove FAQ questions from readme [\#35](https://github.com/KnapsackPro/knapsack-pro-jest/pull/35) ([ArturT](https://github.com/ArturT))
|
|
18
|
-
- Add links to FAQ answers [\#34](https://github.com/KnapsackPro/knapsack-pro-jest/pull/34) ([ArturT](https://github.com/ArturT))
|
|
19
|
-
- Bump y18n from 3.2.1 to 3.2.2 [\#33](https://github.com/KnapsackPro/knapsack-pro-jest/pull/33) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
20
|
-
|
|
21
|
-
## [v5.1.1](https://github.com/KnapsackPro/knapsack-pro-jest/tree/v5.1.1) (2021-01-07)
|
|
22
|
-
|
|
23
|
-
[Full Changelog](https://github.com/KnapsackPro/knapsack-pro-jest/compare/v5.1.0...v5.1.1)
|
|
24
|
-
|
|
25
|
-
**Merged pull requests:**
|
|
26
|
-
|
|
27
|
-
- Bump ini from 1.3.5 to 1.3.8 [\#30](https://github.com/KnapsackPro/knapsack-pro-jest/pull/30) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
28
|
-
- Update @knapsack-pro/core to 3.1.1 [\#29](https://github.com/KnapsackPro/knapsack-pro-jest/pull/29) ([ArturT](https://github.com/ArturT))
|
|
29
|
-
- Bump node-notifier from 8.0.0 to 8.0.1 [\#28](https://github.com/KnapsackPro/knapsack-pro-jest/pull/28) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
30
|
-
- Bump ini from 1.3.5 to 1.3.7 [\#27](https://github.com/KnapsackPro/knapsack-pro-jest/pull/27) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
31
|
-
|
|
32
|
-
## [v5.1.0](https://github.com/KnapsackPro/knapsack-pro-jest/tree/v5.1.0) (2020-11-28)
|
|
33
|
-
|
|
34
|
-
[Full Changelog](https://github.com/KnapsackPro/knapsack-pro-jest/compare/v5.0.0...v5.1.0)
|
|
35
|
-
|
|
36
|
-
**Implemented enhancements:**
|
|
37
|
-
|
|
38
|
-
- Update @knapsack-pro/core 3.1.0 - Add support for an attempt to connect to existing Queue on API side to reduce slow requests number [\#26](https://github.com/KnapsackPro/knapsack-pro-jest/pull/26) ([ArturT](https://github.com/ArturT))
|
|
39
|
-
|
|
40
|
-
**Closed issues:**
|
|
41
|
-
|
|
42
|
-
- Recommend runInBand [\#24](https://github.com/KnapsackPro/knapsack-pro-jest/issues/24)
|
|
43
|
-
|
|
44
|
-
**Merged pull requests:**
|
|
45
|
-
|
|
46
|
-
- Recommend option --runInBand to run tests faster \(update installation steps\) [\#25](https://github.com/KnapsackPro/knapsack-pro-jest/pull/25) ([ArturT](https://github.com/ArturT))
|
|
47
|
-
|
|
48
|
-
## [v5.0.0](https://github.com/KnapsackPro/knapsack-pro-jest/tree/v5.0.0) (2020-10-30)
|
|
49
|
-
|
|
50
|
-
[Full Changelog](https://github.com/KnapsackPro/knapsack-pro-jest/compare/v4.0.1...v5.0.0)
|
|
51
|
-
|
|
52
|
-
**Merged pull requests:**
|
|
53
|
-
|
|
54
|
-
- Default NODE\_ENV to 'test' [\#23](https://github.com/KnapsackPro/knapsack-pro-jest/pull/23) ([haines](https://github.com/haines))
|
|
55
|
-
|
|
56
|
-
## [v4.0.1](https://github.com/KnapsackPro/knapsack-pro-jest/tree/v4.0.1) (2020-09-18)
|
|
57
|
-
|
|
58
|
-
[Full Changelog](https://github.com/KnapsackPro/knapsack-pro-jest/compare/v4.0.0...v4.0.1)
|
|
59
|
-
|
|
60
|
-
**Merged pull requests:**
|
|
61
|
-
|
|
62
|
-
- Update @knapsack-pro/core 3.0.1 [\#22](https://github.com/KnapsackPro/knapsack-pro-jest/pull/22) ([ArturT](https://github.com/ArturT))
|
|
63
|
-
|
|
64
|
-
## [v4.0.0](https://github.com/KnapsackPro/knapsack-pro-jest/tree/v4.0.0) (2020-08-26)
|
|
65
|
-
|
|
66
|
-
[Full Changelog](https://github.com/KnapsackPro/knapsack-pro-jest/compare/v3.0.0...v4.0.0)
|
|
67
|
-
|
|
68
|
-
**Implemented enhancements:**
|
|
69
|
-
|
|
70
|
-
- Add jest \>=22.0.0 \<27.0.0 to peerDependencies [\#21](https://github.com/KnapsackPro/knapsack-pro-jest/pull/21) ([ArturT](https://github.com/ArturT))
|
|
71
|
-
|
|
72
|
-
**Merged pull requests:**
|
|
73
|
-
|
|
74
|
-
- Update packages [\#20](https://github.com/KnapsackPro/knapsack-pro-jest/pull/20) ([ArturT](https://github.com/ArturT))
|
|
75
|
-
- Update formatting related configs \(prettier etc\) [\#19](https://github.com/KnapsackPro/knapsack-pro-jest/pull/19) ([ArturT](https://github.com/ArturT))
|
|
76
|
-
- Use @knapsack-pro/core 3.0.0 [\#18](https://github.com/KnapsackPro/knapsack-pro-jest/pull/18) ([ArturT](https://github.com/ArturT))
|
|
77
|
-
- Use Node 12.18.3 LTS in development and update README requirements [\#17](https://github.com/KnapsackPro/knapsack-pro-jest/pull/17) ([ArturT](https://github.com/ArturT))
|
|
78
|
-
- Bump lodash from 4.17.15 to 4.17.19 [\#16](https://github.com/KnapsackPro/knapsack-pro-jest/pull/16) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
79
|
-
|
|
80
|
-
## [v3.0.0](https://github.com/KnapsackPro/knapsack-pro-jest/tree/v3.0.0) (2020-06-27)
|
|
81
|
-
|
|
82
|
-
[Full Changelog](https://github.com/KnapsackPro/knapsack-pro-jest/compare/v2.7.0...v3.0.0)
|
|
83
|
-
|
|
84
|
-
**Implemented enhancements:**
|
|
85
|
-
|
|
86
|
-
- \[breaking change\] Update to @knapsack-pro/core 2.0.0 - read PR description how to migrate for Github Actions [\#15](https://github.com/KnapsackPro/knapsack-pro-jest/pull/15) ([ArturT](https://github.com/ArturT))
|
|
87
|
-
|
|
88
|
-
**Closed issues:**
|
|
89
|
-
|
|
90
|
-
- Saving coverage data [\#12](https://github.com/KnapsackPro/knapsack-pro-jest/issues/12)
|
|
91
|
-
|
|
92
|
-
**Merged pull requests:**
|
|
93
|
-
|
|
94
|
-
- Bump minimist from 1.2.0 to 1.2.3 [\#14](https://github.com/KnapsackPro/knapsack-pro-jest/pull/14) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
95
|
-
|
|
96
|
-
## [v2.7.0](https://github.com/KnapsackPro/knapsack-pro-jest/tree/v2.7.0) (2020-01-31)
|
|
97
|
-
|
|
98
|
-
[Full Changelog](https://github.com/KnapsackPro/knapsack-pro-jest/compare/v2.6.0...v2.7.0)
|
|
99
|
-
|
|
100
|
-
**Implemented enhancements:**
|
|
101
|
-
|
|
102
|
-
- Add KNAPSACK\_PRO\_COVERAGE\_DIRECTORY to generate unique directory name with code coverage reports for each batch of tests fetched from Queue [\#13](https://github.com/KnapsackPro/knapsack-pro-jest/pull/13) ([ArturT](https://github.com/ArturT))
|
|
103
|
-
|
|
104
|
-
## [v2.6.0](https://github.com/KnapsackPro/knapsack-pro-jest/tree/v2.6.0) (2019-11-22)
|
|
105
|
-
|
|
106
|
-
[Full Changelog](https://github.com/KnapsackPro/knapsack-pro-jest/compare/v2.5.0...v2.6.0)
|
|
107
|
-
|
|
108
|
-
**Implemented enhancements:**
|
|
109
|
-
|
|
110
|
-
- Run tests only when they are detected on the disk. Do not run tests when the test file pattern is invalid. Require to set KNAPSACK\_PRO\_TEST\_FILE\_PATTERN [\#11](https://github.com/KnapsackPro/knapsack-pro-jest/pull/11) ([ArturT](https://github.com/ArturT))
|
|
111
|
-
|
|
112
|
-
## [v2.5.0](https://github.com/KnapsackPro/knapsack-pro-jest/tree/v2.5.0) (2019-10-25)
|
|
113
|
-
|
|
114
|
-
[Full Changelog](https://github.com/KnapsackPro/knapsack-pro-jest/compare/v2.4.0...v2.5.0)
|
|
115
|
-
|
|
116
|
-
**Implemented enhancements:**
|
|
117
|
-
|
|
118
|
-
- Add separate parameter for ignored file pattern [\#10](https://github.com/KnapsackPro/knapsack-pro-jest/pull/10) ([andrcuns](https://github.com/andrcuns))
|
|
119
|
-
|
|
120
|
-
## [v2.4.0](https://github.com/KnapsackPro/knapsack-pro-jest/tree/v2.4.0) (2019-10-18)
|
|
121
|
-
|
|
122
|
-
[Full Changelog](https://github.com/KnapsackPro/knapsack-pro-jest/compare/v2.3.0...v2.4.0)
|
|
123
|
-
|
|
124
|
-
**Implemented enhancements:**
|
|
125
|
-
|
|
126
|
-
- Add support for Codefresh.io CI provider [\#9](https://github.com/KnapsackPro/knapsack-pro-jest/pull/9) ([ArturT](https://github.com/ArturT))
|
|
127
|
-
|
|
128
|
-
## [v2.3.0](https://github.com/KnapsackPro/knapsack-pro-jest/tree/v2.3.0) (2019-09-15)
|
|
129
|
-
|
|
130
|
-
[Full Changelog](https://github.com/KnapsackPro/knapsack-pro-jest/compare/v2.2.1...v2.3.0)
|
|
131
|
-
|
|
132
|
-
**Implemented enhancements:**
|
|
133
|
-
|
|
134
|
-
- Update @knapsack-pro/core 1.5.0 to add support for GitHub Actions [\#8](https://github.com/KnapsackPro/knapsack-pro-jest/pull/8) ([ArturT](https://github.com/ArturT))
|
|
135
|
-
|
|
136
|
-
## [v2.2.1](https://github.com/KnapsackPro/knapsack-pro-jest/tree/v2.2.1) (2019-09-04)
|
|
137
|
-
|
|
138
|
-
[Full Changelog](https://github.com/KnapsackPro/knapsack-pro-jest/compare/v2.2.0...v2.2.1)
|
|
139
|
-
|
|
140
|
-
**Fixed bugs:**
|
|
141
|
-
|
|
142
|
-
- Update @knapsack-pro/core 1.4.1 [\#7](https://github.com/KnapsackPro/knapsack-pro-jest/pull/7) ([ArturT](https://github.com/ArturT))
|
|
143
|
-
|
|
144
|
-
## [v2.2.0](https://github.com/KnapsackPro/knapsack-pro-jest/tree/v2.2.0) (2019-08-23)
|
|
145
|
-
|
|
146
|
-
[Full Changelog](https://github.com/KnapsackPro/knapsack-pro-jest/compare/v2.1.0...v2.2.0)
|
|
147
|
-
|
|
148
|
-
**Implemented enhancements:**
|
|
149
|
-
|
|
150
|
-
- Add support for Jest CLI options [\#6](https://github.com/KnapsackPro/knapsack-pro-jest/pull/6) ([ArturT](https://github.com/ArturT))
|
|
151
|
-
|
|
152
|
-
## [v2.1.0](https://github.com/KnapsackPro/knapsack-pro-jest/tree/v2.1.0) (2019-08-23)
|
|
153
|
-
|
|
154
|
-
[Full Changelog](https://github.com/KnapsackPro/knapsack-pro-jest/compare/v2.0.0...v2.1.0)
|
|
155
|
-
|
|
156
|
-
**Implemented enhancements:**
|
|
157
|
-
|
|
158
|
-
- Update @knapsack-pro/core 1.4.0 and update docs for Semaphore 2.0 [\#5](https://github.com/KnapsackPro/knapsack-pro-jest/pull/5) ([ArturT](https://github.com/ArturT))
|
|
159
|
-
|
|
160
|
-
## [v2.0.0](https://github.com/KnapsackPro/knapsack-pro-jest/tree/v2.0.0) (2019-07-06)
|
|
161
|
-
|
|
162
|
-
[Full Changelog](https://github.com/KnapsackPro/knapsack-pro-jest/compare/v1.2.0...v2.0.0)
|
|
163
|
-
|
|
164
|
-
**Implemented enhancements:**
|
|
165
|
-
|
|
166
|
-
- Security update Jest dependency from ^23.6 to ^24.8 [\#4](https://github.com/KnapsackPro/knapsack-pro-jest/pull/4) ([ArturT](https://github.com/ArturT))
|
|
167
|
-
|
|
168
|
-
**Fixed bugs:**
|
|
169
|
-
|
|
170
|
-
- Update @knapsack-pro/core 1.3.1 [\#3](https://github.com/KnapsackPro/knapsack-pro-jest/pull/3) ([ArturT](https://github.com/ArturT))
|
|
171
|
-
|
|
172
|
-
## [v1.2.0](https://github.com/KnapsackPro/knapsack-pro-jest/tree/v1.2.0) (2019-04-14)
|
|
173
|
-
|
|
174
|
-
[Full Changelog](https://github.com/KnapsackPro/knapsack-pro-jest/compare/v1.1.0...v1.2.0)
|
|
175
|
-
|
|
176
|
-
**Implemented enhancements:**
|
|
177
|
-
|
|
178
|
-
- Reduce data transfer and speed up usage of Knapsack Pro API for Queue Mode [\#2](https://github.com/KnapsackPro/knapsack-pro-jest/pull/2) ([ArturT](https://github.com/ArturT))
|
|
179
|
-
|
|
180
|
-
## [v1.1.0](https://github.com/KnapsackPro/knapsack-pro-jest/tree/v1.1.0) (2019-03-15)
|
|
181
|
-
|
|
182
|
-
[Full Changelog](https://github.com/KnapsackPro/knapsack-pro-jest/compare/v1.0.0...v1.1.0)
|
|
183
|
-
|
|
184
|
-
**Implemented enhancements:**
|
|
185
|
-
|
|
186
|
-
- Add support for Semaphore CI 2.0 [\#1](https://github.com/KnapsackPro/knapsack-pro-jest/pull/1) ([ArturT](https://github.com/ArturT))
|
|
187
|
-
|
|
188
|
-
## [v1.0.0](https://github.com/KnapsackPro/knapsack-pro-jest/tree/v1.0.0) (2019-01-10)
|
|
189
|
-
|
|
190
|
-
[Full Changelog](https://github.com/KnapsackPro/knapsack-pro-jest/compare/v0.1.0...v1.0.0)
|
|
191
|
-
|
|
192
|
-
## [v0.1.0](https://github.com/KnapsackPro/knapsack-pro-jest/tree/v0.1.0) (2019-01-06)
|
|
193
|
-
|
|
194
|
-
[Full Changelog](https://github.com/KnapsackPro/knapsack-pro-jest/compare/2b61b43cfe89059e8ac93eaebffc7918989c09af...v0.1.0)
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
|