@mojaloop/ml-testing-toolkit-client-lib 1.9.1 → 1.10.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.
@@ -1,941 +1,12 @@
1
- # CircleCI v2.1 Config
2
1
  version: 2.1
3
-
4
- ##
5
- # orbs
6
- #
7
- # Orbs used in this pipeline
8
- ##
2
+ setup: true
9
3
  orbs:
10
- slack: circleci/slack@4.12.5 # Ref: https://github.com/mojaloop/ci-config/tree/master/slack-templates
11
- pr-tools: mojaloop/pr-tools@0.1.10 # Ref: https://github.com/mojaloop/ci-config/
12
- gh: circleci/github-cli@2.2.0
13
- anchore: anchore/anchore-engine@1.9.0
14
-
15
- ##
16
- # defaults
17
- #
18
- # YAML defaults templates, in alphabetical order
19
- ##
20
- defaults_docker_Dependencies: &defaults_docker_Dependencies |
21
- apk --no-cache add bash
22
- apk --no-cache add git
23
- apk --no-cache add ca-certificates
24
- apk --no-cache add curl
25
- apk --no-cache add openssh-client
26
- apk add --no-cache -t build-dependencies make gcc g++ python3 libtool autoconf automake jq
27
- apk add --no-cache -t openssl ncurses coreutils libgcc linux-headers grep util-linux binutils findutils
28
- apk --no-cache add librdkafka-dev
29
-
30
- defaults_awsCliDependencies: &defaults_awsCliDependencies |
31
- apk --no-cache add aws-cli
32
-
33
- defaults_license_scanner: &defaults_license_scanner
34
- name: Install and set up license-scanner
35
- command: |
36
- git clone https://github.com/mojaloop/license-scanner /tmp/license-scanner
37
- cd /tmp/license-scanner && make build default-files set-up
38
-
39
- defaults_npm_auth: &defaults_npm_auth
40
- name: Update NPM registry auth token
41
- command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc
42
-
43
- defaults_npm_publish_release: &defaults_npm_publish_release
44
- name: Publish NPM $RELEASE_TAG artifact
45
- command: |
46
- source $BASH_ENV
47
- echo "Publishing tag $RELEASE_TAG"
48
- npm publish --tag $RELEASE_TAG --access public
49
-
50
- defaults_export_version_from_package: &defaults_export_version_from_package
51
- name: Format the changelog into the github release body and get release tag
52
- command: |
53
- git diff --no-indent-heuristic main~1 HEAD CHANGELOG.md | sed -n '/^+[^+]/ s/^+//p' > /tmp/changes
54
- echo 'export RELEASE_CHANGES=`cat /tmp/changes`' >> $BASH_ENV
55
- echo 'export RELEASE_TAG=`cat package-lock.json | jq -r .version`' >> $BASH_ENV
56
-
57
- defaults_configure_git: &defaults_configure_git
58
- name: Configure git
59
- command: |
60
- git config user.email ${GIT_CI_EMAIL}
61
- git config user.name ${GIT_CI_USER}
62
-
63
- defaults_configure_nvmrc: &defaults_configure_nvmrc
64
- name: Configure NVMRC
65
- command: |
66
- if [ -z "$NVMRC_VERSION" ]; then
67
- echo "==> Configuring NVMRC_VERSION!"
68
-
69
- export ENV_DOT_PROFILE=$HOME/.profile
70
- touch $ENV_DOT_PROFILE
71
-
72
- export NVMRC_VERSION=$(cat $CIRCLE_WORKING_DIRECTORY/.nvmrc)
73
- echo "export NVMRC_VERSION=$NVMRC_VERSION" >> $ENV_DOT_PROFILE
74
- fi
75
- echo "NVMRC_VERSION=$NVMRC_VERSION"
76
-
77
- defaults_configure_nvm: &defaults_configure_nvm
78
- name: Configure NVM
79
- command: |
80
- cd $HOME
81
- export ENV_DOT_PROFILE=$HOME/.profile
82
- touch $ENV_DOT_PROFILE
83
- echo "1. Check/Set NVM_DIR env variable"
84
- if [ -z "$NVM_DIR" ]; then
85
- export NVM_DIR="$HOME/.nvm"
86
- echo "==> NVM_DIR has been exported - $NVM_DIR"
87
- else
88
- echo "==> NVM_DIR already exists - $NVM_DIR"
89
- fi
90
- echo "2. Check/Set NVMRC_VERSION env variable"
91
- if [ -z "$NVMRC_VERSION" ]; then
92
- echo "==> Configuring NVMRC_VERSION!"
93
- export NVMRC_VERSION=$(cat $CIRCLE_WORKING_DIRECTORY/.nvmrc)
94
- echo "export NVMRC_VERSION=$NVMRC_VERSION" >> $ENV_DOT_PROFILE
95
- fi
96
- echo "3. Configure NVM"
97
- ## Lets check if an existing NVM_DIR exists, if it does lets skil
98
- if [ -e "$NVM_DIR" ]; then
99
- echo "==> $NVM_DIR exists. Skipping steps 3!"
100
- # echo "5. Executing $NVM_DIR/nvm.sh"
101
- # [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
102
- else
103
- echo "==> $NVM_DIR does not exists. Executing steps 4-5!"
104
- echo "4. Installing NVM"
105
- curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
106
- echo "5. Executing $NVM_DIR/nvm.sh"
107
- [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
108
- fi
109
- ## Ref: https://github.com/nvm-sh/nvm/issues/1102#issuecomment-550572252
110
- if [ ! -z "$NVM_ARCH_UNOFFICIAL_OVERRIDE" ]; then
111
- echo "==> Handle NVM_ARCH_UNOFFICIAL_OVERRIDE=$NVM_ARCH_UNOFFICIAL_OVERRIDE!"
112
- echo "nvm_get_arch() { nvm_echo \"${NVM_ARCH_UNOFFICIAL_OVERRIDE}\"; }" >> $ENV_DOT_PROFILE
113
- echo "export NVM_NODEJS_ORG_MIRROR=https://unofficial-builds.nodejs.org/download/release" >> $ENV_DOT_PROFILE
114
- source $ENV_DOT_PROFILE
115
- fi
116
- echo "6. Setup Node version"
117
- if [ -n "$NVMRC_VERSION" ]; then
118
- echo "==> Installing Node version: $NVMRC_VERSION"
119
- nvm install $NVMRC_VERSION
120
- nvm alias default $NVMRC_VERSION
121
- nvm use $NVMRC_VERSION
122
- cd $CIRCLE_WORKING_DIRECTORY
123
- else
124
- echo "==> ERROR - NVMRC_VERSION has not been set! - NVMRC_VERSION: $NVMRC_VERSION"
125
- exit 1
126
- fi
127
-
128
- defaults_display_versions: &defaults_display_versions
129
- name: Display Versions
130
- command: |
131
- echo "What is the active version of Nodejs?"
132
- echo "node: $(node --version)"
133
- echo "yarn: $(yarn --version)"
134
- echo "npm: $(npm --version)"
135
- echo "nvm: $(nvm --version)"
136
-
137
- defaults_environment: &defaults_environment
138
- ## env var for nx to set main branch
139
- MAIN_BRANCH_NAME: main
140
- ## Disable LIBRDKAFKA build since we install it via general dependencies
141
- # BUILD_LIBRDKAFKA: 0
142
-
143
- ##
144
- # Executors
145
- #
146
- # CircleCI Executors
147
- ##
148
- executors:
149
- default-docker:
150
- working_directory: &WORKING_DIR /home/circleci/project
151
- shell: "/bin/sh -leo pipefail" ## Ref: https://circleci.com/docs/env-vars/#alpine-linux
152
- environment:
153
- BASH_ENV: /etc/profile ## Ref: https://circleci.com/docs/env-vars/#alpine-linux
154
- NVM_ARCH_UNOFFICIAL_OVERRIDE: x64-musl ## Ref: https://github.com/nvm-sh/nvm/issues/1102#issuecomment-550572252
155
- docker:
156
- - image: node:lts-alpine # Ref: https://hub.docker.com/_/node?tab=tags&page=1&name=alpine
157
-
158
- default-machine:
159
- working_directory: *WORKING_DIR
160
- shell: "/bin/bash -leo pipefail"
161
- machine:
162
- image: ubuntu-2204:2023.04.2 # Ref: https://circleci.com/developer/machine/image/ubuntu-2204
163
-
164
- ##
165
- # Jobs
166
- #
167
- # A map of CircleCI jobs
168
- ##
169
- jobs:
170
- setup:
171
- executor: default-docker
172
- environment:
173
- <<: *defaults_environment
174
- steps:
175
- - run:
176
- name: Install general dependencies
177
- command: *defaults_docker_Dependencies
178
- - checkout
179
- - run:
180
- <<: *defaults_configure_nvm
181
- - run:
182
- <<: *defaults_display_versions
183
- - run:
184
- name: Update NPM install
185
- command: npm ci
186
- - save_cache:
187
- key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
188
- paths:
189
- - node_modules
190
-
191
- test-dependencies:
192
- executor: default-docker
193
- environment:
194
- <<: *defaults_environment
195
- steps:
196
- - run:
197
- name: Install general dependencies
198
- command: *defaults_docker_Dependencies
199
- - checkout
200
- - run:
201
- <<: *defaults_configure_nvm
202
- - run:
203
- <<: *defaults_display_versions
204
- - restore_cache:
205
- key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
206
- - run:
207
- name: Execute dependency tests
208
- command: npm run dep:check
209
-
210
- test-lint:
211
- executor: default-docker
212
- environment:
213
- <<: *defaults_environment
214
- steps:
215
- - run:
216
- name: Install general dependencies
217
- command: *defaults_docker_Dependencies
218
- - checkout
219
- - run:
220
- <<: *defaults_configure_nvm
221
- - run:
222
- <<: *defaults_display_versions
223
- - restore_cache:
224
- key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
225
- - run:
226
- name: Execute lint tests
227
- command: npm run lint
228
-
229
- test-unit:
230
- executor: default-docker
231
- environment:
232
- <<: *defaults_environment
233
- steps:
234
- - run:
235
- name: Install general dependencies
236
- command: *defaults_docker_Dependencies
237
- - checkout
238
- - run:
239
- <<: *defaults_configure_nvm
240
- - run:
241
- <<: *defaults_display_versions
242
- - restore_cache:
243
- key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
244
- - run:
245
- name: Install jest
246
- command: npm install jest
247
- - run:
248
- name: Create dir for test results
249
- command: mkdir -p ./test/results
250
- - run:
251
- name: Execute unit tests
252
- command: npm -s run test:junit
253
- - store_artifacts:
254
- path: ./test/results
255
- destination: test
256
- - store_test_results:
257
- path: ./test/results
258
-
259
- test-coverage:
260
- executor: default-docker
261
- environment:
262
- <<: *defaults_environment
263
- steps:
264
- - run:
265
- name: Install general dependencies
266
- command: *defaults_docker_Dependencies
267
- - run:
268
- name: Install AWS CLI dependencies
269
- command: *defaults_awsCliDependencies
270
- - checkout
271
- - run:
272
- <<: *defaults_configure_nvm
273
- - run:
274
- <<: *defaults_display_versions
275
- - restore_cache:
276
- key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
277
- - run:
278
- name: Execute code coverage check
279
- command: npm -s run test:coverage-check
280
- - store_artifacts:
281
- path: coverage
282
- destination: test
283
-
284
- vulnerability-check:
285
- executor: default-docker
286
- environment:
287
- <<: *defaults_environment
288
- steps:
289
- - run:
290
- name: Install general dependencies
291
- command: *defaults_docker_Dependencies
292
- - checkout
293
- - run:
294
- <<: *defaults_configure_nvm
295
- - run:
296
- <<: *defaults_display_versions
297
- - restore_cache:
298
- key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
299
- - run:
300
- name: Create dir for test results
301
- command: mkdir -p ./audit/results
302
- - run:
303
- name: Check for new npm vulnerabilities
304
- command: npm run audit:check -- -o json > ./audit/results/auditResults.json
305
- - store_artifacts:
306
- path: ./audit/results
307
- destination: audit
308
-
309
- audit-licenses:
310
- executor: default-docker
311
- environment:
312
- <<: *defaults_environment
313
- steps:
314
- - run:
315
- name: Install general dependencies
316
- command: *defaults_docker_Dependencies
317
- - run:
318
- <<: *defaults_license_scanner
319
- - checkout
320
- - restore_cache:
321
- key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
322
- - run:
323
- name: Run the license-scanner
324
- command: cd /tmp/license-scanner && pathToRepo=$CIRCLE_WORKING_DIRECTORY make run
325
- - store_artifacts:
326
- path: /tmp/license-scanner/results
327
- destination: licenses
328
-
329
- build-local:
330
- executor: default-machine
331
- environment:
332
- <<: *defaults_environment
333
- steps:
334
- - checkout
335
- - run:
336
- <<: *defaults_configure_nvmrc
337
- - run:
338
- <<: *defaults_display_versions
339
- - run:
340
- name: Build Docker local image
341
- command: |
342
- source ~/.profile
343
- export DOCKER_NODE_VERSION="$NVMRC_VERSION-alpine"
344
- echo "export DOCKER_NODE_VERSION=$NVMRC_VERSION-alpine" >> $BASH_ENV
345
- echo "Building Docker image: ${DOCKER_ORG:-mojaloop}/$CIRCLE_PROJECT_REPONAME:local --build-arg NODE_VERSION=$DOCKER_NODE_VERSION"
346
- docker build -t ${DOCKER_ORG:-mojaloop}/$CIRCLE_PROJECT_REPONAME:local --build-arg NODE_VERSION=$DOCKER_NODE_VERSION .
347
- - run:
348
- name: Save docker image to workspace
349
- command: docker save -o /tmp/docker-image.tar ${DOCKER_ORG:-mojaloop}/$CIRCLE_PROJECT_REPONAME:local
350
- - persist_to_workspace:
351
- root: /tmp
352
- paths:
353
- - ./docker-image.tar
354
-
355
- license-scan:
356
- executor: default-machine
357
- environment:
358
- <<: *defaults_environment
359
- steps:
360
- - attach_workspace:
361
- at: /tmp
362
- - run:
363
- name: Load the pre-built docker image from workspace
364
- command: docker load -i /tmp/docker-image.tar
365
- - run:
366
- <<: *defaults_license_scanner
367
- - run:
368
- name: Run the license-scanner
369
- command: cd /tmp/license-scanner && mode=docker dockerImages=${DOCKER_ORG:-mojaloop}/$CIRCLE_PROJECT_REPONAME:local make run
370
- - store_artifacts:
371
- path: /tmp/license-scanner/results
372
- destination: licenses
373
-
374
- image-scan:
375
- executor: anchore/anchore_engine
376
- shell: /bin/sh -leo pipefail ## Ref: https://circleci.com/docs/env-vars/#alpine-linux
377
- environment:
378
- <<: *defaults_environment
379
- BASH_ENV: /etc/profile ## Ref: https://circleci.com/docs/env-vars/#alpine-linux
380
- ENV: ~/.profile
381
- NVM_ARCH_UNOFFICIAL_OVERRIDE: x64-musl ## Ref: https://github.com/nvm-sh/nvm/issues/1102#issuecomment-550572252
382
- working_directory: *WORKING_DIR
383
- steps:
384
- - setup_remote_docker
385
- - attach_workspace:
386
- at: /tmp
387
- - run:
388
- name: Install docker dependencies for anchore
389
- command: |
390
- apk add --update py-pip docker python3-dev libffi-dev openssl-dev gcc libc-dev make jq npm curl bash
391
- - run:
392
- name: Install AWS CLI dependencies
393
- command: *defaults_awsCliDependencies
394
- - checkout
395
- - run:
396
- name: Setup Slack config
397
- command: |
398
- echo "export SLACK_PROJECT_NAME=${CIRCLE_PROJECT_REPONAME}" >> $BASH_ENV
399
- echo "export SLACK_RELEASE_TYPE='GitHub Release'" >> $BASH_ENV
400
- echo "export SLACK_RELEASE_TAG='${RELEASE_TAG} on ${CIRCLE_BRANCH} branch'" >> $BASH_ENV
401
- echo "export SLACK_BUILD_ID=${CIRCLE_BUILD_NUM}" >> $BASH_ENV
402
- echo "export SLACK_CI_URL=${CIRCLE_BUILD_URL}" >> $BASH_ENV
403
- echo "export SLACK_CUSTOM_MSG='Anchore Image Scan failed for: \`${DOCKER_ORG}/${CIRCLE_PROJECT_REPONAME}:${CIRCLE_TAG}\`'" >> $BASH_ENV
404
- - run:
405
- <<: *defaults_configure_nvm
406
- - run:
407
- <<: *defaults_display_versions
408
- - run:
409
- name: Install general dependencies
410
- command: *defaults_docker_Dependencies
411
- - run:
412
- name: Load the pre-built docker image from workspace
413
- command: docker load -i /tmp/docker-image.tar
414
- - run:
415
- name: Download the mojaloop/ci-config repo
416
- command: |
417
- git clone https://github.com/mojaloop/ci-config /tmp/ci-config
418
- # Generate the mojaloop anchore-policy
419
- cd /tmp/ci-config/container-scanning && ./mojaloop-policy-generator.js /tmp/mojaloop-policy.json
420
- - run:
421
- name: Pull base image locally
422
- command: |
423
- echo "Pulling docker image: node:$NVMRC_VERSION-alpine"
424
- docker pull node:$NVMRC_VERSION-alpine
425
- ## Analyze the base and derived image
426
- ## Note: It seems images are scanned in parallel, so preloading the base image result doesn't give us any real performance gain
427
- - anchore/analyze_local_image:
428
- # Force the older version, version 0.7.0 was just published, and is broken
429
- anchore_version: v0.6.1
430
- image_name: "docker.io/node:${NVMRC_VERSION}-alpine ${DOCKER_ORG:-mojaloop}/$CIRCLE_PROJECT_REPONAME:local"
431
- policy_failure: false
432
- timeout: '500'
433
- # Note: if the generated policy is invalid, this will fallback to the default policy, which we don't want!
434
- policy_bundle_file_path: /tmp/mojaloop-policy.json
435
- - run:
436
- name: Upload Anchore reports to s3
437
- command: |
438
- aws s3 cp anchore-reports ${AWS_S3_DIR_ANCHORE_REPORTS}/${CIRCLE_PROJECT_REPONAME}/ --recursive
439
- aws s3 rm ${AWS_S3_DIR_ANCHORE_REPORTS}/latest/ --recursive --exclude "*" --include "${CIRCLE_PROJECT_REPONAME}*"
440
- aws s3 cp anchore-reports ${AWS_S3_DIR_ANCHORE_REPORTS}/latest/ --recursive
441
- - run:
442
- name: Evaluate failures
443
- command: /tmp/ci-config/container-scanning/anchore-result-diff.js anchore-reports/node_${NVMRC_VERSION}-alpine-policy.json anchore-reports/${CIRCLE_PROJECT_REPONAME}*-policy.json
444
- - store_artifacts:
445
- path: anchore-reports
446
- - slack/notify:
447
- event: fail
448
- template: SLACK_TEMP_RELEASE_FAILURE
449
-
450
- release:
451
- executor: default-docker
452
- environment:
453
- <<: *defaults_environment
454
- steps:
455
- - run:
456
- name: Install general dependencies
457
- command: *defaults_docker_Dependencies
458
- - checkout
459
- - restore_cache:
460
- keys:
461
- - dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
462
- - run:
463
- <<: *defaults_configure_git
464
- - run:
465
- name: Setup Slack config
466
- command: |
467
- echo "export SLACK_PROJECT_NAME=${CIRCLE_PROJECT_REPONAME}" >> $BASH_ENV
468
- echo "export SLACK_RELEASE_TYPE='GitHub Release'" >> $BASH_ENV
469
- echo "export SLACK_RELEASE_TAG='${RELEASE_TAG} on ${CIRCLE_BRANCH} branch'" >> $BASH_ENV
470
- echo "export SLACK_BUILD_ID=${CIRCLE_BUILD_NUM}" >> $BASH_ENV
471
- echo "export SLACK_CI_URL=${CIRCLE_BUILD_URL}" >> $BASH_ENV
472
- - run:
473
- name: Generate changelog and bump package version
474
- command: npm run release -- --no-verify
475
- - run:
476
- name: Push the release
477
- command: git push --follow-tags origin ${CIRCLE_BRANCH}
478
- - slack/notify:
479
- event: fail
480
- template: SLACK_TEMP_RELEASE_FAILURE
481
-
482
- github-release:
483
- executor: default-machine
484
- shell: "/bin/bash -eo pipefail"
485
- environment:
486
- <<: *defaults_environment
487
- steps:
488
- - run:
489
- name: Install git
490
- command: |
491
- sudo apt-get update && sudo apt-get install -y git
492
- - gh/install
493
- - checkout
494
- - run:
495
- <<: *defaults_configure_git
496
- - run:
497
- name: Fetch updated release branch
498
- command: |
499
- git fetch origin
500
- git checkout origin/${CIRCLE_BRANCH}
501
- - run:
502
- <<: *defaults_export_version_from_package
503
- - run:
504
- name: Check the release changes
505
- command: |
506
- echo "Changes are: ${RELEASE_CHANGES}"
507
- - run:
508
- name: Setup Slack config
509
- command: |
510
- echo "export SLACK_PROJECT_NAME=${CIRCLE_PROJECT_REPONAME}" >> $BASH_ENV
511
- echo "export SLACK_RELEASE_TYPE='Github Release'" >> $BASH_ENV
512
- echo "export SLACK_RELEASE_TAG=v${RELEASE_TAG}" >> $BASH_ENV
513
- echo "export SLACK_RELEASE_URL=https://github.com/mojaloop/${CIRCLE_PROJECT_REPONAME}/releases/tag/v${RELEASE_TAG}" >> $BASH_ENV
514
- echo "export SLACK_BUILD_ID=${CIRCLE_BUILD_NUM}" >> $BASH_ENV
515
- echo "export SLACK_CI_URL=${CIRCLE_BUILD_URL}" >> $BASH_ENV
516
- - run:
517
- name: Create Release
518
- command: |
519
- gh release create "v${RELEASE_TAG}" --title "v${RELEASE_TAG} Release" --draft=false --notes "${RELEASE_CHANGES}" ./CHANGELOG.md
520
- - slack/notify:
521
- event: pass
522
- template: SLACK_TEMP_RELEASE_SUCCESS
523
- - slack/notify:
524
- event: fail
525
- template: SLACK_TEMP_RELEASE_FAILURE
526
-
527
- publish:
528
- executor: default-machine
529
- shell: "/bin/bash -eo pipefail"
530
- environment:
531
- <<: *defaults_environment
532
- steps:
533
- - checkout
534
- - run:
535
- name: Setup for LATEST release
536
- command: |
537
- echo "export RELEASE_TAG=$RELEASE_TAG_PROD" >> $BASH_ENV
538
- echo "RELEASE_TAG=$RELEASE_TAG_PROD"
539
-
540
- PACKAGE_VERSION=$(cat package-lock.json | jq -r .version)
541
- echo "export PACKAGE_VERSION=${PACKAGE_VERSION}" >> $BASH_ENV
542
- echo "PACKAGE_VERSION=${PACKAGE_VERSION}"
543
- - run:
544
- name: Setup Slack config
545
- command: |
546
- echo "export SLACK_PROJECT_NAME=${CIRCLE_PROJECT_REPONAME}" >> $BASH_ENV
547
- echo "export SLACK_RELEASE_TYPE='Docker Release'" >> $BASH_ENV
548
- echo "export SLACK_RELEASE_TAG=v${CIRCLE_TAG:1}" >> $BASH_ENV
549
- echo "export SLACK_BUILD_ID=${CIRCLE_BUILD_NUM}" >> $BASH_ENV
550
- echo "export SLACK_CI_URL=${CIRCLE_BUILD_URL}" >> $BASH_ENV
551
- - attach_workspace:
552
- at: /tmp
553
- - run:
554
- name: Load the pre-built docker image from workspace
555
- command: |
556
- docker load -i /tmp/docker-image.tar
557
- - run:
558
- name: Login to Docker Hub
559
- command: docker login -u $DOCKER_USER -p $DOCKER_PASS
560
- - run:
561
- name: Re-tag pre built image
562
- command: |
563
- docker tag ${DOCKER_ORG:-mojaloop}/$CIRCLE_PROJECT_REPONAME:local ${DOCKER_ORG:-mojaloop}/$CIRCLE_PROJECT_REPONAME:$CIRCLE_TAG
564
- docker tag ${DOCKER_ORG:-mojaloop}/$CIRCLE_PROJECT_REPONAME:local ${DOCKER_ORG:-mojaloop}/$CIRCLE_PROJECT_REPONAME:$RELEASE_TAG
565
- - run:
566
- name: Publish Docker image $CIRCLE_TAG & Latest tag to Docker Hub
567
- command: |
568
- echo "Publishing ${DOCKER_ORG:-mojaloop}/$CIRCLE_PROJECT_REPONAME:$CIRCLE_TAG"
569
- docker push ${DOCKER_ORG:-mojaloop}/$CIRCLE_PROJECT_REPONAME:$CIRCLE_TAG
570
- echo "Publishing ${DOCKER_ORG:-mojaloop}/$CIRCLE_PROJECT_REPONAME:$RELEASE_TAG"
571
- docker push ${DOCKER_ORG:-mojaloop}/$CIRCLE_PROJECT_REPONAME:$RELEASE_TAG
572
- - run:
573
- name: Set Image Digest
574
- command: |
575
- IMAGE_DIGEST=$(docker inspect ${DOCKER_ORG:-mojaloop}/$CIRCLE_PROJECT_REPONAME:v${CIRCLE_TAG:1} | jq '.[0].RepoDigests | .[]')
576
- echo "IMAGE_DIGEST=${IMAGE_DIGEST}"
577
- echo "export IMAGE_DIGEST=${IMAGE_DIGEST}" >> $BASH_ENV
578
- - run:
579
- name: Update Slack config
580
- command: |
581
- echo "export SLACK_RELEASE_URL='https://hub.docker.com/layers/${CIRCLE_PROJECT_REPONAME}/${DOCKER_ORG}/${CIRCLE_PROJECT_REPONAME}/v${CIRCLE_TAG:1}/images/${IMAGE_DIGEST}?context=explore'" | sed -r "s/${DOCKER_ORG}\/${CIRCLE_PROJECT_REPONAME}@sha256:/sha256-/g" >> $BASH_ENV
582
- - slack/notify:
583
- event: pass
584
- template: SLACK_TEMP_RELEASE_SUCCESS
585
- - slack/notify:
586
- event: fail
587
- template: SLACK_TEMP_RELEASE_FAILURE
588
-
589
- publish-snapshot:
590
- executor: default-machine
591
- shell: "/bin/bash -eo pipefail"
592
- environment:
593
- <<: *defaults_environment
594
- steps:
595
- - checkout
596
- - run:
597
- name: Setup for SNAPSHOT release
598
- command: |
599
- echo "export RELEASE_TAG=$RELEASE_TAG_SNAPSHOT" >> $BASH_ENV
600
- echo "RELEASE_TAG=$RELEASE_TAG_SNAPSHOT"
601
-
602
- PACKAGE_VERSION=$(cat package-lock.json | jq -r .version)
603
- echo "export PACKAGE_VERSION=${PACKAGE_VERSION}" >> $BASH_ENV
604
- echo "PACKAGE_VERSION=${PACKAGE_VERSION}"
605
- - run:
606
- name: Setup Slack config
607
- command: |
608
- echo "export SLACK_PROJECT_NAME=${CIRCLE_PROJECT_REPONAME}" >> $BASH_ENV
609
- echo "export SLACK_RELEASE_TYPE='Docker Release'" >> $BASH_ENV
610
- echo "export SLACK_RELEASE_TAG=v${CIRCLE_TAG:1}" >> $BASH_ENV
611
- echo "export SLACK_BUILD_ID=${CIRCLE_BUILD_NUM}" >> $BASH_ENV
612
- echo "export SLACK_CI_URL=${CIRCLE_BUILD_URL}" >> $BASH_ENV
613
- - attach_workspace:
614
- at: /tmp
615
- - run:
616
- name: Load the pre-built docker image from workspace
617
- command: |
618
- docker load -i /tmp/docker-image.tar
619
- - run:
620
- name: Login to Docker Hub
621
- command: docker login -u $DOCKER_USER -p $DOCKER_PASS
622
- - run:
623
- name: Re-tag pre built image
624
- command: |
625
- docker tag ${DOCKER_ORG:-mojaloop}/$CIRCLE_PROJECT_REPONAME:local ${DOCKER_ORG:-mojaloop}/$CIRCLE_PROJECT_REPONAME:$CIRCLE_TAG
626
- docker tag ${DOCKER_ORG:-mojaloop}/$CIRCLE_PROJECT_REPONAME:local ${DOCKER_ORG:-mojaloop}/$CIRCLE_PROJECT_REPONAME:$RELEASE_TAG
627
- - run:
628
- name: Publish Docker image $CIRCLE_TAG & Latest tag to Docker Hub
629
- command: |
630
- echo "Publishing ${DOCKER_ORG:-mojaloop}/$CIRCLE_PROJECT_REPONAME:$CIRCLE_TAG"
631
- docker push ${DOCKER_ORG:-mojaloop}/$CIRCLE_PROJECT_REPONAME:$CIRCLE_TAG
632
- echo "Publishing ${DOCKER_ORG:-mojaloop}/$CIRCLE_PROJECT_REPONAME:$RELEASE_TAG"
633
- docker push ${DOCKER_ORG:-mojaloop}/$CIRCLE_PROJECT_REPONAME:$RELEASE_TAG
634
- - run:
635
- name: Set Image Digest
636
- command: |
637
- IMAGE_DIGEST=$(docker inspect ${DOCKER_ORG:-mojaloop}/$CIRCLE_PROJECT_REPONAME:v${CIRCLE_TAG:1} | jq '.[0].RepoDigests | .[]')
638
- echo "IMAGE_DIGEST=${IMAGE_DIGEST}"
639
- echo "export IMAGE_DIGEST=${IMAGE_DIGEST}" >> $BASH_ENV
640
- - run:
641
- name: Update Slack config
642
- command: |
643
- echo "export SLACK_RELEASE_URL='https://hub.docker.com/layers/${CIRCLE_PROJECT_REPONAME}/${DOCKER_ORG}/${CIRCLE_PROJECT_REPONAME}/v${CIRCLE_TAG:1}/images/${IMAGE_DIGEST}?context=explore'" | sed -r "s/${DOCKER_ORG}\/${CIRCLE_PROJECT_REPONAME}@sha256:/sha256-/g" >> $BASH_ENV
644
- - slack/notify:
645
- event: pass
646
- template: SLACK_TEMP_RELEASE_SUCCESS
647
- - slack/notify:
648
- event: fail
649
- template: SLACK_TEMP_RELEASE_FAILURE
650
-
651
- publish-npm:
652
- executor: default-docker
653
- steps:
654
- - run:
655
- name: Install general dependencies
656
- command: *defaults_docker_Dependencies
657
- - checkout
658
- - restore_cache:
659
- key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
660
- - run:
661
- name: Setup for LATEST release
662
- command: |
663
- echo "export RELEASE_TAG=$RELEASE_TAG_PROD" >> $BASH_ENV
664
- echo "RELEASE_TAG=$RELEASE_TAG_PROD"
665
- PACKAGE_VERSION=$(cat package-lock.json | jq -r .version)
666
- echo "export PACKAGE_VERSION=${PACKAGE_VERSION}" >> $BASH_ENV
667
- echo "PACKAGE_VERSION=${PACKAGE_VERSION}"
668
- - run:
669
- name: Setup Slack config
670
- command: |
671
- echo "export SLACK_PROJECT_NAME=${CIRCLE_PROJECT_REPONAME}" >> $BASH_ENV
672
- echo "export SLACK_RELEASE_TYPE='NPM Release'" >> $BASH_ENV
673
- echo "export SLACK_RELEASE_TAG=v${CIRCLE_TAG:1}" >> $BASH_ENV
674
- echo "export SLACK_RELEASE_URL=https://www.npmjs.com/package/@mojaloop/${CIRCLE_PROJECT_REPONAME}/v/${CIRCLE_TAG:1}" >> $BASH_ENV
675
- echo "export SLACK_BUILD_ID=${CIRCLE_BUILD_NUM}" >> $BASH_ENV
676
- echo "export SLACK_CI_URL=${CIRCLE_BUILD_URL}" >> $BASH_ENV
677
- - run:
678
- <<: *defaults_npm_auth
679
- - run:
680
- <<: *defaults_npm_publish_release
681
- - slack/notify:
682
- event: pass
683
- template: SLACK_TEMP_RELEASE_SUCCESS
684
- - slack/notify:
685
- event: fail
686
- template: SLACK_TEMP_RELEASE_FAILURE
687
-
688
- publish-npm-snapshot:
689
- executor: default-docker
690
- steps:
691
- - run:
692
- name: Install general dependencies
693
- command: *defaults_docker_Dependencies
694
- - checkout
695
- - restore_cache:
696
- key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
697
- - run:
698
- name: Setup for SNAPSHOT release
699
- command: |
700
- echo "export RELEASE_TAG=${RELEASE_TAG_SNAPSHOT}" >> $BASH_ENV
701
- echo "RELEASE_TAG=${RELEASE_TAG_SNAPSHOT}"
702
- echo "Override package version: ${CIRCLE_TAG:1}"
703
- npx standard-version --skip.tag --skip.commit --skip.changelog --release-as ${CIRCLE_TAG:1}
704
- PACKAGE_VERSION=$(cat package-lock.json | jq -r .version)
705
- echo "export PACKAGE_VERSION=${PACKAGE_VERSION}" >> $BASH_ENV
706
- echo "PACKAGE_VERSION=${PACKAGE_VERSION}"
707
- - run:
708
- name: Setup Slack config
709
- command: |
710
- echo "export SLACK_PROJECT_NAME=${CIRCLE_PROJECT_REPONAME}" >> $BASH_ENV
711
- echo "export SLACK_RELEASE_TYPE='NPM Snapshot'" >> $BASH_ENV
712
- echo "export SLACK_RELEASE_TAG=v${CIRCLE_TAG:1}" >> $BASH_ENV
713
- echo "export SLACK_RELEASE_URL=https://www.npmjs.com/package/@mojaloop/${CIRCLE_PROJECT_REPONAME}/v/${CIRCLE_TAG:1}" >> $BASH_ENV
714
- echo "export SLACK_BUILD_ID=${CIRCLE_BUILD_NUM}" >> $BASH_ENV
715
- echo "export SLACK_CI_URL=${CIRCLE_BUILD_URL}" >> $BASH_ENV
716
- - run:
717
- <<: *defaults_npm_auth
718
- - run:
719
- <<: *defaults_npm_publish_release
720
- - slack/notify:
721
- event: pass
722
- template: SLACK_TEMP_RELEASE_SUCCESS
723
- - slack/notify:
724
- event: fail
725
- template: SLACK_TEMP_RELEASE_FAILURE
726
-
727
- ##
728
- # Workflows
729
- #
730
- # CircleCI Workflow config
731
- ##
4
+ build: mojaloop/build@1.0.66
732
5
  workflows:
733
- build_and_test:
6
+ setup:
734
7
  jobs:
735
- - pr-tools/pr-title-check:
736
- context: org-global
737
- - setup:
738
- context: org-global
739
- filters:
740
- tags:
741
- only: /.*/
742
- branches:
743
- ignore:
744
- - /feature*/
745
- - /bugfix*/
746
- - test-dependencies:
747
- context: org-global
748
- requires:
749
- - setup
750
- filters:
751
- tags:
752
- ignore: /.*/
753
- branches:
754
- ignore:
755
- - main
756
- - test-lint:
757
- context: org-global
758
- requires:
759
- - setup
760
- filters:
761
- tags:
762
- only: /.*/
763
- branches:
764
- ignore:
765
- - /feature*/
766
- - /bugfix*/
767
- - test-unit:
768
- context: org-global
769
- requires:
770
- - setup
771
- filters:
772
- tags:
773
- only: /.*/
774
- branches:
775
- ignore:
776
- - /feature*/
777
- - /bugfix*/
778
- - test-coverage:
779
- context: org-global
780
- requires:
781
- - setup
782
- filters:
783
- tags:
784
- only: /.*/
785
- branches:
786
- ignore:
787
- - /feature*/
788
- - /bugfix*/
789
- - vulnerability-check:
790
- context: org-global
791
- requires:
792
- - setup
793
- filters:
794
- tags:
795
- only: /.*/
796
- branches:
797
- ignore:
798
- - /feature*/
799
- - /bugfix*/
800
- - audit-licenses:
801
- context: org-global
802
- requires:
803
- - setup
804
- filters:
805
- tags:
806
- only: /.*/
807
- branches:
808
- ignore:
809
- - /feature*/
810
- - /bugfix*/
811
- - build-local:
812
- context: org-global
813
- requires:
814
- - setup
815
- - test-lint
816
- - test-unit
817
- - test-coverage
818
- - vulnerability-check
819
- - audit-licenses
820
- filters:
821
- tags:
822
- only: /v[0-9]+(\.[0-9]+)*(\-snapshot(\.[0-9]+)?)?(\-hotfix(\.[0-9]+)?)?(\-perf(\.[0-9]+)?)?/
823
- branches:
824
- ignore:
825
- - /.*/
826
- - license-scan:
827
- context: org-global
828
- requires:
829
- - build-local
830
- filters:
831
- tags:
832
- only: /v[0-9]+(\.[0-9]+)*(\-snapshot(\.[0-9]+)?)?(\-hotfix(\.[0-9]+)?)?(\-perf(\.[0-9]+)?)?/
833
- branches:
834
- ignore:
835
- - /.*/
836
- - image-scan:
837
- context: org-global
838
- requires:
839
- - build-local
840
- filters:
841
- tags:
842
- only: /v[0-9]+(\.[0-9]+)*(\-snapshot(\.[0-9]+)?)?(\-hotfix(\.[0-9]+)?)?(\-perf(\.[0-9]+)?)?/
843
- branches:
844
- ignore:
845
- - /.*/
846
- # New commits to main release automatically
847
- - release:
848
- context: org-global
849
- requires:
850
- - pr-tools/pr-title-check
851
- - test-lint
852
- - test-unit
853
- - test-coverage
854
- - vulnerability-check
855
- - audit-licenses
856
- - license-scan
857
- - image-scan
858
- filters:
859
- branches:
860
- only:
861
- - main
862
- - /release\/v.*/
863
- - github-release:
864
- context: org-global
865
- requires:
866
- - release
867
- filters:
868
- branches:
869
- only:
870
- - main
871
- - /release\/v.*/
872
- - publish:
873
- context: org-global
874
- requires:
875
- - pr-tools/pr-title-check
876
- - test-lint
877
- - test-unit
878
- - test-coverage
879
- - vulnerability-check
880
- - audit-licenses
881
- - license-scan
882
- - image-scan
883
- filters:
884
- tags:
885
- only: /v[0-9]+(\.[0-9]+)*/
886
- branches:
887
- ignore:
888
- - /.*/
889
- - publish-snapshot:
890
- context: org-global
891
- requires:
892
- - pr-tools/pr-title-check
893
- - test-lint
894
- - test-unit
895
- - test-coverage
896
- - vulnerability-check
897
- - audit-licenses
898
- - license-scan
899
- - image-scan
900
- filters:
901
- tags:
902
- only: /v[0-9]+(\.[0-9]+)*\-snapshot+((\.[0-9]+)?)/
903
- branches:
904
- ignore:
905
- - /.*/
906
- - publish-npm:
907
- context: org-global
908
- requires:
909
- - pr-tools/pr-title-check
910
- - test-dependencies
911
- - test-lint
912
- - test-unit
913
- - test-coverage
914
- - vulnerability-check
915
- - audit-licenses
916
- - license-scan
917
- - image-scan
918
- filters:
919
- tags:
920
- only: /v[0-9]+(\.[0-9]+)*/
921
- branches:
922
- ignore:
923
- - /.*/
924
- - publish-npm-snapshot:
8
+ - build/workflow:
925
9
  context: org-global
926
- requires:
927
- - pr-tools/pr-title-check
928
- - test-dependencies
929
- - test-lint
930
- - test-unit
931
- - test-coverage
932
- - vulnerability-check
933
- - audit-licenses
934
- - license-scan
935
- - image-scan
936
10
  filters:
937
11
  tags:
938
- only: /v[0-9]+(\.[0-9]+)*\-snapshot+((\.[0-9]+)?)/
939
- branches:
940
- ignore:
941
- - /.*/
12
+ only: /v\d+(\.\d+){2}(-[a-zA-Z-][0-9a-zA-Z-]*\.\d+)?/
package/.grype.yaml ADDED
@@ -0,0 +1,16 @@
1
+ ignore:
2
+ # Ignore cross-spawn vulnerabilities by CVE ID due to false positive
3
+ # as grype looks at package-lock.json where it shows versions with
4
+ # vulnerabilities, npm ls shows only 7.0.6 verion is used
5
+
6
+
7
+ # Set output format defaults
8
+ output:
9
+ - "table"
10
+ - "json"
11
+
12
+ # Modify your CircleCI job to check critical count
13
+ search:
14
+ scope: "squashed"
15
+ quiet: false
16
+ check-for-app-update: false
package/.nvmrc CHANGED
@@ -1 +1 @@
1
- 18.20.4
1
+ 22.15.1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [1.10.0](https://github.com/mojaloop/ml-testing-toolkit-client-lib/compare/v1.9.1...v1.10.0) (2025-06-01)
6
+
7
+
8
+ ### Features
9
+
10
+ * bump up the node version to v22.15.1 and fix dangling jest test ([#30](https://github.com/mojaloop/ml-testing-toolkit-client-lib/issues/30)) ([ae569bb](https://github.com/mojaloop/ml-testing-toolkit-client-lib/commit/ae569bb43cf210b982fde4ef71be682bd6172327))
11
+
5
12
  ### [1.9.1](https://github.com/mojaloop/ml-testing-toolkit-client-lib/compare/v1.9.0...v1.9.1) (2025-03-25)
6
13
 
7
14
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mojaloop/ml-testing-toolkit-client-lib",
3
3
  "description": "Testing Toolkit Client Library",
4
- "version": "1.9.1",
4
+ "version": "1.10.0",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Vijaya Kumar Guthi, ModusBox Inc. ",
7
7
  "contributors": [
@@ -17,7 +17,7 @@
17
17
  },
18
18
  "bugs": "https://github.com/mojaloop/ml-testing-toolkit-client-lib/issues",
19
19
  "engines": {
20
- "node": ">=18.x"
20
+ "node": ">=22.x"
21
21
  },
22
22
  "config": {},
23
23
  "bin": {
@@ -36,7 +36,10 @@
36
36
  ]
37
37
  },
38
38
  "pre-commit": [
39
- "standard"
39
+ "lint",
40
+ "dep:check",
41
+ "audit:check",
42
+ "test"
40
43
  ],
41
44
  "scripts": {
42
45
  "start": "node src/index.js",
@@ -48,7 +51,10 @@
48
51
  "test:coverage": "jest --coverage --coverageThreshold='{}' --testMatch '**/test/unit/**/*.test.js'",
49
52
  "test:coverage-check": "jest --coverage --testMatch '**/test/unit/**/*.test.js'",
50
53
  "test:junit": "jest --reporters=default --reporters=jest-junit --testMatch '**/test/unit/**/*.test.js'",
51
- "test:integration": "./test/integration-runner.sh ",
54
+ "test:int1": "./test/integration-runner.sh ",
55
+ "test:integration": "echo 'integration tests not defined'",
56
+ "test:functional": "echo 'functional tests not defined'",
57
+ "test:xunit": "npm run test:unit",
52
58
  "cover": "npx nyc --all report --reporter=lcov npm run test",
53
59
  "lint": "npm run standard",
54
60
  "lint:fix": "npm run standard:fix",
@@ -63,16 +69,16 @@
63
69
  "snapshot": "npx standard-version --no-verify --skip.changelog --prerelease snapshot --releaseCommitMessageFormat 'chore(snapshot): {{currentTag}}'"
64
70
  },
65
71
  "dependencies": {
66
- "@mojaloop/central-services-logger": "11.7.0",
67
- "@mojaloop/ml-testing-toolkit-shared-lib": "14.0.4",
68
- "@mojaloop/sdk-standard-components": "19.11.0",
72
+ "@mojaloop/central-services-logger": "11.9.0",
73
+ "@mojaloop/ml-testing-toolkit-shared-lib": "14.0.5",
74
+ "@mojaloop/sdk-standard-components": "19.15.2",
69
75
  "@slack/webhook": "7.0.5",
70
76
  "atob": "2.1.2",
71
77
  "aws-sdk": "2.1692.0",
72
- "axios": "1.8.4",
78
+ "axios": "1.9.0",
73
79
  "cli-table3": "0.6.5",
74
- "commander": "13.1.0",
75
- "dotenv": "16.4.7",
80
+ "commander": "14.0.0",
81
+ "dotenv": "16.5.0",
76
82
  "fs": "0.0.1-security",
77
83
  "lodash": "4.17.21",
78
84
  "mv": "2.1.1",
@@ -87,7 +93,7 @@
87
93
  "audit-ci": "7.1.0",
88
94
  "jest": "29.7.0",
89
95
  "jest-junit": "16.0.0",
90
- "npm-check-updates": "17.1.16",
96
+ "npm-check-updates": "18.0.1",
91
97
  "nyc": "17.1.0",
92
98
  "parse-strings-in-object": "1.6.0",
93
99
  "pre-commit": "1.2.2",
@@ -22,13 +22,15 @@
22
22
  * Mojaloop Foundation
23
23
  - Name Surname <name.surname@mojaloop.io>
24
24
 
25
+ - Shashikant Hirugade <shashi.mojaloop@gmail.com>
26
+
25
27
  * ModusBox
26
28
  * Georgi Logodazhki <georgi.logodazhki@modusbox.com> (Original Author)
27
29
  --------------
28
30
  ******/
29
31
  'use strict'
30
32
 
31
- const spyExit = jest.spyOn(process, 'exit')
33
+ const spyExit = jest.spyOn(process, 'exit').mockImplementation(() => {})
32
34
  const { cli } = require('../../src/router')
33
35
 
34
36
  jest.mock('../../src/utils/listeners')
@@ -36,6 +38,19 @@ jest.mock('../../src/modes/outbound')
36
38
  jest.mock('../../src/modes/testcaseDefinitionReport')
37
39
 
38
40
  describe('Cli client', () => {
41
+ beforeAll(() => {
42
+ jest.useFakeTimers() // use fake timers for testing
43
+ })
44
+
45
+ afterEach(() => {
46
+ jest.clearAllMocks()
47
+ jest.clearAllTimers()
48
+ })
49
+
50
+ afterAll(() => {
51
+ jest.useRealTimers()
52
+ })
53
+
39
54
  describe('running router', () => {
40
55
  it('when mode is monitoring should not throw an error', async () => {
41
56
  const config = {
@@ -44,7 +59,7 @@ describe('Cli client', () => {
44
59
  spyExit.mockImplementationOnce(jest.fn())
45
60
  expect(() => {
46
61
  cli(config)
47
- }).not.toThrowError();
62
+ }).not.toThrowError()
48
63
  })
49
64
  it('when mode is outbound and inputFiles is provided should not throw an error', async () => {
50
65
  const config = {
@@ -54,7 +69,8 @@ describe('Cli client', () => {
54
69
  spyExit.mockImplementationOnce(jest.fn())
55
70
  expect(() => {
56
71
  cli(config)
57
- }).not.toThrowError();
72
+ }).not.toThrowError()
73
+ expect(spyExit).toHaveBeenCalledWith(1)
58
74
  })
59
75
  it('when mode is outbound, inputFiles and environmentFile is provided should not throw an error', async () => {
60
76
  const config = {
@@ -65,7 +81,9 @@ describe('Cli client', () => {
65
81
  spyExit.mockImplementationOnce(jest.fn())
66
82
  expect(() => {
67
83
  cli(config)
68
- }).not.toThrowError();
84
+ }).not.toThrowError()
85
+ jest.advanceTimersByTime(1000 * 60 * 15)
86
+ expect(spyExit).toHaveBeenCalledWith(1)
69
87
  })
70
88
  it('when mode is outbound and inputFile was not provided should not throw an error', async () => {
71
89
  const config = {
@@ -74,7 +92,8 @@ describe('Cli client', () => {
74
92
  spyExit.mockImplementationOnce(jest.fn())
75
93
  expect(() => {
76
94
  cli(config)
77
- }).not.toThrowError();
95
+ }).not.toThrowError()
96
+ expect(spyExit).toHaveBeenCalledWith(1)
78
97
  })
79
98
  it('when mode is testcaseDefinitionReport and inputFile was provided should not throw an error', async () => {
80
99
  const config = {
@@ -84,16 +103,17 @@ describe('Cli client', () => {
84
103
  spyExit.mockImplementationOnce(jest.fn())
85
104
  expect(() => {
86
105
  cli(config)
87
- }).not.toThrowError();
106
+ }).not.toThrowError()
88
107
  })
89
- it('when mode is testcaseDefinitionReport and inputFile was not provided should throw an error', async () => {
108
+ it('when mode is testcaseDefinitionReport and inputFile was not provided should not throw an error', async () => {
90
109
  const config = {
91
110
  "mode": "testcaseDefinitionReport"
92
111
  }
93
112
  spyExit.mockImplementationOnce(jest.fn())
94
113
  expect(() => {
95
114
  cli(config)
96
- }).not.toThrowError();
115
+ }).not.toThrowError()
116
+ expect(spyExit).toHaveBeenCalledWith(1)
97
117
  })
98
118
  it('when mode is not supported should not throw an error', async () => {
99
119
  const config = {
@@ -102,14 +122,16 @@ describe('Cli client', () => {
102
122
  spyExit.mockImplementationOnce(jest.fn())
103
123
  expect(() => {
104
124
  cli(config)
105
- }).not.toThrowError();
125
+ }).not.toThrowError()
126
+ expect(spyExit).toHaveBeenCalledWith(1)
106
127
  })
107
128
  it('when mode is not provided should not throw an error', async () => {
108
129
  const config = {}
109
130
  spyExit.mockImplementationOnce(jest.fn())
110
131
  expect(() => {
111
132
  cli(config)
112
- }).not.toThrowError();
133
+ }).not.toThrowError()
134
+ expect(spyExit).toHaveBeenCalledWith(1)
113
135
  })
114
136
  })
115
- })
137
+ })