From bede37872e437c3711a4010b37095c3f8ec7f24d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 Mar 2023 10:37:23 +0000 Subject: [PATCH 01/14] chore(deps): bump json5 from 1.0.1 to 1.0.2 Bumps [json5](https://github.com/json5/json5) from 1.0.1 to 1.0.2. - [Release notes](https://github.com/json5/json5/releases) - [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md) - [Commits](https://github.com/json5/json5/compare/v1.0.1...v1.0.2) --- updated-dependencies: - dependency-name: json5 dependency-type: indirect ... Signed-off-by: dependabot[bot] --- yarn.lock | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/yarn.lock b/yarn.lock index 0a244a8..d9183c4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1680,18 +1680,16 @@ json-stable-stringify-without-jsonify@^1.0.1: integrity sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE= json5@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.1.tgz#779fb0018604fa854eacbf6252180d83543e3dbe" - integrity sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow== + version "1.0.2" + resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.2.tgz#63d98d60f21b313b77c4d6da18bfa69d80e1d593" + integrity sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA== dependencies: minimist "^1.2.0" json5@^2.1.2: - version "2.2.0" - resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.0.tgz#2dfefe720c6ba525d9ebd909950f0515316c89a3" - integrity sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA== - dependencies: - minimist "^1.2.5" + version "2.2.3" + resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" + integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== jsonc-parser@~3.0.0: version "3.0.0" @@ -1953,7 +1951,7 @@ minimist@0.0.8: resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= -minimist@^1.2.0, minimist@^1.2.5, minimist@~1.2.5: +minimist@^1.2.0, minimist@~1.2.5: version "1.2.5" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== From b65a5a7f77ce107f908ebb58e84024355008cc64 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 Mar 2023 10:37:23 +0000 Subject: [PATCH 02/14] chore(deps): bump ansi-regex from 3.0.0 to 3.0.1 Bumps [ansi-regex](https://github.com/chalk/ansi-regex) from 3.0.0 to 3.0.1. - [Release notes](https://github.com/chalk/ansi-regex/releases) - [Commits](https://github.com/chalk/ansi-regex/compare/v3.0.0...v3.0.1) --- updated-dependencies: - dependency-name: ansi-regex dependency-type: indirect ... Signed-off-by: dependabot[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 0a244a8..415dcbc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -327,9 +327,9 @@ ansi-colors@4.1.1, ansi-colors@^4.1.1: integrity sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA== ansi-regex@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" - integrity sha1-7QMXwyIGT3lGbAKWa922Bas32Zg= + version "3.0.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.1.tgz#123d6479e92ad45ad897d4054e3c7ca7db4944e1" + integrity sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw== ansi-regex@^5.0.1: version "5.0.1" From 9b37eb51ce933d9c0f7e3f9de029962c768a6d6c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 Mar 2023 10:37:24 +0000 Subject: [PATCH 03/14] chore(deps): bump lodash from 4.17.15 to 4.17.21 Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.21. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.21) --- updated-dependencies: - dependency-name: lodash dependency-type: indirect ... Signed-off-by: dependabot[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 0a244a8..201c59e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1822,9 +1822,9 @@ lodash.truncate@^4.4.2: integrity sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM= lodash@^4.17.14: - version "4.17.15" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" - integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== + version "4.17.21" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" + integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== log-symbols@4.0.0: version "4.0.0" From 5eb29b505f16ca46ff00aa3e815fa1d1268c4901 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 12 Jul 2023 15:26:09 +0000 Subject: [PATCH 04/14] chore(deps): bump semver from 5.7.1 to 5.7.2 Bumps [semver](https://github.com/npm/node-semver) from 5.7.1 to 5.7.2. - [Release notes](https://github.com/npm/node-semver/releases) - [Changelog](https://github.com/npm/node-semver/blob/v5.7.2/CHANGELOG.md) - [Commits](https://github.com/npm/node-semver/compare/v5.7.1...v5.7.2) --- updated-dependencies: - dependency-name: semver dependency-type: indirect ... Signed-off-by: dependabot[bot] --- yarn.lock | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/yarn.lock b/yarn.lock index 0a244a8..ec29c38 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2486,19 +2486,19 @@ safe-json-stringify@^1.2.0: integrity sha512-gH8eh2nZudPQO6TytOvbxnuhYBOvDBBLW52tz5q6X58lJcd/tkmqFR+5Z9adS8aJtURSXWThWy/xJtJwixErvg== "semver@2 || 3 || 4 || 5": - version "5.7.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" - integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== + version "5.7.2" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.2.tgz#48d55db737c3287cd4835e17fa13feace1c41ef8" + integrity sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g== semver@^6.0.0, semver@^6.3.0: - version "6.3.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" - integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== + version "6.3.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" + integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== semver@^7.2.1: - version "7.3.5" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.5.tgz#0b621c879348d8998e4b0e4be94b3f12e6018ef7" - integrity sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ== + version "7.5.4" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" + integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA== dependencies: lru-cache "^6.0.0" From 41fe5a3d850cbdeeea84673b04483e2782abc4f0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 19 Jul 2023 04:27:23 +0000 Subject: [PATCH 05/14] chore(deps): bump word-wrap from 1.2.3 to 1.2.4 Bumps [word-wrap](https://github.com/jonschlinkert/word-wrap) from 1.2.3 to 1.2.4. - [Release notes](https://github.com/jonschlinkert/word-wrap/releases) - [Commits](https://github.com/jonschlinkert/word-wrap/compare/1.2.3...1.2.4) --- updated-dependencies: - dependency-name: word-wrap dependency-type: indirect ... Signed-off-by: dependabot[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 0a244a8..4a36cdd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2862,9 +2862,9 @@ wide-align@1.1.3: string-width "^1.0.2 || 2" word-wrap@^1.2.3: - version "1.2.3" - resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" - integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ== + version "1.2.4" + resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.4.tgz#cb4b50ec9aca570abd1f52f33cd45b6c61739a9f" + integrity sha512-2V81OA4ugVo5pRo46hAoD2ivUJx8jXmWXfUkY4KFNw0hEptvN0QfH3K4nHiwzGeKl5rFKedV48QVoqYavy4YpA== workerpool@6.1.0: version "6.1.0" From 6bfa25e714b0aa3686748c38fc361f731018b8cd Mon Sep 17 00:00:00 2001 From: Francois Ferrand Date: Fri, 10 May 2024 15:05:38 +0200 Subject: [PATCH 06/14] Bump gha actions - checkout@v4 - setup-node@v4 - Cleanup branch selection rules Issue: WRLGS-9 --- .github/workflows/tests.yaml | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 59d7320..e861033 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -2,24 +2,19 @@ name: Tests on: push: - branches: - - 'feature/**' - - 'documentation/**' - - 'improvement/**' - - 'bugfix/**' - - 'w/**' - - 'q/**' - - 'hotfix/**' + branches-ignore: + - development/** + - q/*/** jobs: tests: runs-on: ubuntu-latest steps: - name: Checkokut - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install deps run: sudo apt-get update -q - - uses: actions/setup-node@v2 + - uses: actions/setup-node@v4 with: node-version: '16' - name: Install Yarn From 10af7a165a71112cb1b6e2d517a3588cd1b2877f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 10 May 2024 14:48:44 +0000 Subject: [PATCH 07/14] chore(deps): bump @babel/traverse from 7.15.4 to 7.24.5 Bumps [@babel/traverse](https://github.com/babel/babel/tree/HEAD/packages/babel-traverse) from 7.15.4 to 7.24.5. - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.24.5/packages/babel-traverse) --- updated-dependencies: - dependency-name: "@babel/traverse" dependency-type: indirect ... Signed-off-by: dependabot[bot] --- yarn.lock | 172 ++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 141 insertions(+), 31 deletions(-) diff --git a/yarn.lock b/yarn.lock index 602096c..c73166c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -16,6 +16,14 @@ dependencies: "@babel/highlight" "^7.14.5" +"@babel/code-frame@^7.23.5", "@babel/code-frame@^7.24.2": + version "7.24.2" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.24.2.tgz#718b4b19841809a58b29b68cde80bc5e1aa6d9ae" + integrity sha512-y5+tLQyV8pg3fsiln67BVLD1P13Eg4lh5RW9mF0zUuvLrv9uIQ4MCL+CRT+FTsBlBjcIan6PGsLcBN0m3ClUyQ== + dependencies: + "@babel/highlight" "^7.24.2" + picocolors "^1.0.0" + "@babel/compat-data@^7.15.0": version "7.15.0" resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.15.0.tgz#2dbaf8b85334796cafbb0f5793a90a2fc010b176" @@ -51,6 +59,16 @@ jsesc "^2.5.1" source-map "^0.5.0" +"@babel/generator@^7.24.5": + version "7.24.5" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.24.5.tgz#e5afc068f932f05616b66713e28d0f04e99daeb3" + integrity sha512-x32i4hEXvr+iI0NEoEfDKzlemF8AmtOP8CcrRaEcpzysWuoEb1KknpcvMsHKPONoKZiDuItklgWhB18xEhr9PA== + dependencies: + "@babel/types" "^7.24.5" + "@jridgewell/gen-mapping" "^0.3.5" + "@jridgewell/trace-mapping" "^0.3.25" + jsesc "^2.5.1" + "@babel/helper-compilation-targets@^7.15.4": version "7.15.4" resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.15.4.tgz#cf6d94f30fbefc139123e27dd6b02f65aeedb7b9" @@ -61,28 +79,25 @@ browserslist "^4.16.6" semver "^6.3.0" -"@babel/helper-function-name@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.15.4.tgz#845744dafc4381a4a5fb6afa6c3d36f98a787ebc" - integrity sha512-Z91cOMM4DseLIGOnog+Z8OI6YseR9bua+HpvLAQ2XayUGU+neTtX+97caALaLdyu53I/fjhbeCnWnRH1O3jFOw== - dependencies: - "@babel/helper-get-function-arity" "^7.15.4" - "@babel/template" "^7.15.4" - "@babel/types" "^7.15.4" +"@babel/helper-environment-visitor@^7.22.20": + version "7.22.20" + resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz#96159db61d34a29dba454c959f5ae4a649ba9167" + integrity sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA== -"@babel/helper-get-function-arity@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.15.4.tgz#098818934a137fce78b536a3e015864be1e2879b" - integrity sha512-1/AlxSF92CmGZzHnC515hm4SirTxtpDnLEJ0UyEMgTMZN+6bxXKg04dKhiRx5Enel+SUA1G1t5Ed/yQia0efrA== +"@babel/helper-function-name@^7.23.0": + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz#1f9a3cdbd5b2698a670c30d2735f9af95ed52759" + integrity sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw== dependencies: - "@babel/types" "^7.15.4" + "@babel/template" "^7.22.15" + "@babel/types" "^7.23.0" -"@babel/helper-hoist-variables@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.15.4.tgz#09993a3259c0e918f99d104261dfdfc033f178df" - integrity sha512-VTy085egb3jUGVK9ycIxQiPbquesq0HUQ+tPO0uv5mPEBZipk+5FkRKiWq5apuyTE9FUrjENB0rCf8y+n+UuhA== +"@babel/helper-hoist-variables@^7.22.5": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz#c01a007dac05c085914e8fb652b339db50d823bb" + integrity sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw== dependencies: - "@babel/types" "^7.15.4" + "@babel/types" "^7.22.5" "@babel/helper-member-expression-to-functions@^7.15.4": version "7.15.4" @@ -143,11 +158,28 @@ dependencies: "@babel/types" "^7.15.4" +"@babel/helper-split-export-declaration@^7.24.5": + version "7.24.5" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.24.5.tgz#b9a67f06a46b0b339323617c8c6213b9055a78b6" + integrity sha512-5CHncttXohrHk8GWOFCcCl4oRD9fKosWlIRgWm4ql9VYioKm52Mk2xsmoohvm7f3JoiLSM5ZgJuRaf5QZZYd3Q== + dependencies: + "@babel/types" "^7.24.5" + +"@babel/helper-string-parser@^7.24.1": + version "7.24.1" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.24.1.tgz#f99c36d3593db9540705d0739a1f10b5e20c696e" + integrity sha512-2ofRCjnnA9y+wk8b9IAREroeUP02KHp431N2mhKniy2yKIDKpbrHv9eXwm8cBeWQYcJmzv5qKCu65P47eCF7CQ== + "@babel/helper-validator-identifier@^7.14.5", "@babel/helper-validator-identifier@^7.14.9", "@babel/helper-validator-identifier@^7.15.7": version "7.15.7" resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.15.7.tgz#220df993bfe904a4a6b02ab4f3385a5ebf6e2389" integrity sha512-K4JvCtQqad9OY2+yTU8w+E82ywk/fe+ELNlt1G8z3bVGlZfn/hOcQQsUhGhW/N+tb3fxK800wLtKOE/aM0m72w== +"@babel/helper-validator-identifier@^7.24.5": + version "7.24.5" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.5.tgz#918b1a7fa23056603506370089bd990d8720db62" + integrity sha512-3q93SSKX2TWCG30M2G2kwaKeTYgEUp5Snjuj8qm729SObL6nbtUldAi37qbxkD5gg3xnBio+f9nqpSepGZMvxA== + "@babel/helper-validator-option@^7.14.5": version "7.14.5" resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.14.5.tgz#6e72a1fff18d5dfcb878e1e62f1a021c4b72d5a3" @@ -171,11 +203,26 @@ chalk "^2.0.0" js-tokens "^4.0.0" +"@babel/highlight@^7.24.2": + version "7.24.5" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.24.5.tgz#bc0613f98e1dd0720e99b2a9ee3760194a704b6e" + integrity sha512-8lLmua6AVh/8SLJRRVD6V8p73Hir9w5mJrhE+IPpILG31KKlI9iz5zmBYKcWPS59qSfgP9RaSBQSHHE81WKuEw== + dependencies: + "@babel/helper-validator-identifier" "^7.24.5" + chalk "^2.4.2" + js-tokens "^4.0.0" + picocolors "^1.0.0" + "@babel/parser@^7.15.4", "@babel/parser@^7.15.5": version "7.15.7" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.15.7.tgz#0c3ed4a2eb07b165dfa85b3cc45c727334c4edae" integrity sha512-rycZXvQ+xS9QyIcJ9HXeDWf1uxqlbVFAUq0Rq0dbc50Zb/+wUe/ehyfzGfm9KZZF0kBejYgxltBXocP+gKdL2g== +"@babel/parser@^7.24.0", "@babel/parser@^7.24.5": + version "7.24.5" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.24.5.tgz#4a4d5ab4315579e5398a82dcf636ca80c3392790" + integrity sha512-EOv5IK8arwh3LI47dz1b0tKUb/1uhHAnHJOrjgtQMIpu1uXd9mlFrJg9IUgGUgZ41Ch0K8REPTYpO7B76b4vJg== + "@babel/parser@^7.4.4": version "7.5.5" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.5.5.tgz#02f077ac8817d3df4a832ef59de67565e71cca4b" @@ -205,19 +252,29 @@ "@babel/parser" "^7.15.4" "@babel/types" "^7.15.4" -"@babel/traverse@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.15.4.tgz#ff8510367a144bfbff552d9e18e28f3e2889c22d" - integrity sha512-W6lQD8l4rUbQR/vYgSuCAE75ADyyQvOpFVsvPPdkhf6lATXAsQIG9YdtOcu8BB1dZ0LKu+Zo3c1wEcbKeuhdlA== +"@babel/template@^7.22.15": + version "7.24.0" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.24.0.tgz#c6a524aa93a4a05d66aaf31654258fae69d87d50" + integrity sha512-Bkf2q8lMB0AFpX0NFEqSbx1OkTHf0f+0j82mkw+ZpzBnkk7e9Ql0891vlfgi+kHwOk8tQjiQHpqh4LaSa0fKEA== dependencies: - "@babel/code-frame" "^7.14.5" - "@babel/generator" "^7.15.4" - "@babel/helper-function-name" "^7.15.4" - "@babel/helper-hoist-variables" "^7.15.4" - "@babel/helper-split-export-declaration" "^7.15.4" - "@babel/parser" "^7.15.4" - "@babel/types" "^7.15.4" - debug "^4.1.0" + "@babel/code-frame" "^7.23.5" + "@babel/parser" "^7.24.0" + "@babel/types" "^7.24.0" + +"@babel/traverse@^7.15.4": + version "7.24.5" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.24.5.tgz#972aa0bc45f16983bf64aa1f877b2dd0eea7e6f8" + integrity sha512-7aaBLeDQ4zYcUFDUD41lJc1fG8+5IU9DaNSJAgal866FGvmD5EbWQgnEC6kO1gGLsX0esNkfnJSndbTXA3r7UA== + dependencies: + "@babel/code-frame" "^7.24.2" + "@babel/generator" "^7.24.5" + "@babel/helper-environment-visitor" "^7.22.20" + "@babel/helper-function-name" "^7.23.0" + "@babel/helper-hoist-variables" "^7.22.5" + "@babel/helper-split-export-declaration" "^7.24.5" + "@babel/parser" "^7.24.5" + "@babel/types" "^7.24.5" + debug "^4.3.1" globals "^11.1.0" "@babel/types@^7.15.4", "@babel/types@^7.15.6": @@ -228,6 +285,15 @@ "@babel/helper-validator-identifier" "^7.14.9" to-fast-properties "^2.0.0" +"@babel/types@^7.22.5", "@babel/types@^7.23.0", "@babel/types@^7.24.0", "@babel/types@^7.24.5": + version "7.24.5" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.24.5.tgz#7661930afc638a5383eb0c4aee59b74f38db84d7" + integrity sha512-6mQNsaLeXTw0nxYUYu+NSa4Hx4BlF1x1x8/PMFbiR+GBSr+2DkECc69b8hgy2frEodNcvPffeH8YfWd3LI6jhQ== + dependencies: + "@babel/helper-string-parser" "^7.24.1" + "@babel/helper-validator-identifier" "^7.24.5" + to-fast-properties "^2.0.0" + "@eslint/eslintrc@^0.4.3": version "0.4.3" resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.4.3.tgz#9e42981ef035beb3dd49add17acb96e8ff6f394c" @@ -273,6 +339,38 @@ resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.3.tgz#e45e384e4b8ec16bce2fd903af78450f6bf7ec98" integrity sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA== +"@jridgewell/gen-mapping@^0.3.5": + version "0.3.5" + resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz#dcce6aff74bdf6dad1a95802b69b04a2fcb1fb36" + integrity sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg== + dependencies: + "@jridgewell/set-array" "^1.2.1" + "@jridgewell/sourcemap-codec" "^1.4.10" + "@jridgewell/trace-mapping" "^0.3.24" + +"@jridgewell/resolve-uri@^3.1.0": + version "3.1.2" + resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz#7a0ee601f60f99a20c7c7c5ff0c80388c1189bd6" + integrity sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw== + +"@jridgewell/set-array@^1.2.1": + version "1.2.1" + resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.2.1.tgz#558fb6472ed16a4c850b889530e6b36438c49280" + integrity sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A== + +"@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14": + version "1.4.15" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32" + integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== + +"@jridgewell/trace-mapping@^0.3.24", "@jridgewell/trace-mapping@^0.3.25": + version "0.3.25" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz#15f190e98895f3fc23276ee14bc76b675c2e50f0" + integrity sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ== + dependencies: + "@jridgewell/resolve-uri" "^3.1.0" + "@jridgewell/sourcemap-codec" "^1.4.14" + "@types/json5@^0.0.29": version "0.0.29" resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" @@ -531,7 +629,7 @@ catharsis@^0.8.11: dependencies: lodash "^4.17.14" -chalk@^2.0.0: +chalk@^2.0.0, chalk@^2.4.2: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== @@ -691,6 +789,13 @@ debug@^4.0.1, debug@^4.1.0, debug@^4.1.1: dependencies: ms "2.1.2" +debug@^4.3.1: + version "4.3.4" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" + integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== + dependencies: + ms "2.1.2" + decamelize@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" @@ -2280,6 +2385,11 @@ path-type@^3.0.0: dependencies: pify "^3.0.0" +picocolors@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" + integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== + picomatch@^2.0.4, picomatch@^2.2.1: version "2.3.0" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.0.tgz#f1f061de8f6a4bf022892e2d128234fb98302972" From dd2d71175dae11ece235d17b2301b7d4e537271a Mon Sep 17 00:00:00 2001 From: Mickael Bourgois Date: Mon, 24 Jun 2024 09:52:00 +0200 Subject: [PATCH 08/14] WRLGS-11: Generic function for timestamp in stderr --- index.js | 37 ++++++++++++++++ lib/stderrUtils.js | 106 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 143 insertions(+) create mode 100644 lib/stderrUtils.js diff --git a/index.js b/index.js index 95b4001..9cbb0ea 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,5 @@ const API = require('./lib/api.js'); +const stderrUtils = require('./lib/stderrUtils'); /* * For convenience purposes, we provide an already instanciated API; so that @@ -11,4 +12,40 @@ module.exports = { Logger: werelogs.Logger, configure: werelogs.reconfigure.bind(werelogs), Werelogs: API, + /** + * Timestamp logs going to stderr + * + * @example Simplest usage + * ``` + * const { stderrUtils } = require('werelogs'); + * stderrUtils.catchAndTimestampStderr(); + * ``` + * + * @example Manage process exit + * ``` + * const { stderrUtils } = require('werelogs'); + * // set exitCode to null to keep process running on uncaughtException + * stderrUtils.catchAndTimestampStderr(undefined, null); + * // application init + * process.on('uncaughtException', (err) => { + * // custom handling, close connections, files + * this.worker.kill(); // or process.exit(1); + * }); + * // Note you could use prependListener to execute your callback first + * // and then let stderrUtils exit the process. + * ``` + * + * @example Custom listener + * ``` + * const { stderrUtils } = require('werelogs'); + * stderrUtils.catchAndTimestampWarning(); + * // application init + * process.on('uncaughtException', (err, origin) => { + * stderrUtils.printErrorWithTimestamp(err, origin); + * // close and stop everything + * process.exit(1); + * }); + * ``` + */ + stderrUtils, }; diff --git a/lib/stderrUtils.js b/lib/stderrUtils.js new file mode 100644 index 0000000..df3e1e0 --- /dev/null +++ b/lib/stderrUtils.js @@ -0,0 +1,106 @@ +/** + * @returns {string} a timestamp in ISO format YYYY-MM-DDThh:mm:ss.sssZ + */ +const defaultTimestamp = () => new Date().toISOString(); + +/** + * Prints on stderr a timestamp, the origin and the error + * + * If no other instructions are needed on uncaughtException, + * consider using `catchAndTimestampStderr` directly. + * + * @example + * process.on('uncaughtException', (err, origin) => { + * printErrorWithTimestamp(err, origin); + * // server.close(); + * // file.close(); + * process.nextTick(() => process.exit(1)); + * }); + * // Don't forget to timestamp warning + * catchAndTimestampWarning(); + * @param {Error} err see process event uncaughtException + * @param {uncaughtException|unhandledRejection} origin see process event + * @param {string} [date=`defaultTimestamp()`] Date to print + * @returns {boolean} see process.stderr.write + */ +function printErrorWithTimestamp( + err, origin, date = defaultTimestamp(), +) { + return process.stderr.write(`${date}: ${origin}:\n${err.stack}\n`); +} + +/** + * Prefer using `catchAndTimestampStderr` instead of this function. + * + * Adds listener for uncaughtException to print with timestamp. + * + * If you want to manage the end of the process, you can set exitCode to null. + * Or use `printErrorWithTimestamp` in your own uncaughtException listener. + * + * @param {Function} [dateFct=`defaultTimestamp`] Fct returning a formatted date + * @param {*} [exitCode=1] On uncaughtException, if not null, `process.exit` + * will be called with this value + * @returns {undefined} + */ +function catchAndTimestampUncaughtException( + dateFct = defaultTimestamp, exitCode = 1, +) { + process.on('uncaughtException', (err, origin) => { + printErrorWithTimestamp(err, origin, dateFct()); + if (exitCode !== null) { + process.nextTick(() => process.exit(exitCode)); + } + }); +} + +/** + * Forces the use of `--trace-warnings` and adds a date in warning.detail + * The warning will be printed by the default `onWarning` + * + * @param {string} [dateFct=`defaultTimestamp`] Fct returning a formatted date + * @returns {undefined} + */ +function catchAndTimestampWarning(dateFct = defaultTimestamp) { + process.traceProcessWarnings = true; + // must be executed first, before the default `onWarning` + process.prependListener('warning', warning => { + if (warning.detail) { + // eslint-disable-next-line no-param-reassign + warning.detail += `\nAbove Warning Date: ${dateFct()}`; + } else { + // eslint-disable-next-line no-param-reassign + warning.detail = `Above Warning Date: ${dateFct()}`; + } + }); +} + +/** + * Adds listener for uncaughtException and warning to print them with timestamp. + * + * If you want to manage the end of the process, you can set exitCode to null. + * Or use `printErrorWithTimestamp` in your own uncaughtException listener. + * + * @example + * const { stderrUtils } = require('werelogs'); + * // first instruction in your index.js or entrypoint + * stderrUtils.catchAndTimestampStderr(); + * + * @param {Function} [dateFct=`defaultTimestamp`] Fct returning a formatted date + * @param {*} [exitCode=1] On uncaughtException, if not null, `process.exit` + * will be called with this value + * @returns {undefined} + */ +function catchAndTimestampStderr( + dateFct = defaultTimestamp, exitCode = 1, +) { + catchAndTimestampUncaughtException(dateFct, exitCode); + catchAndTimestampWarning(dateFct); +} + +module.exports = { + defaultTimestamp, + printErrorWithTimestamp, + catchAndTimestampUncaughtException, + catchAndTimestampWarning, + catchAndTimestampStderr, +}; From da2224fbf7766f38812d980bc8183f8fd7bbc8ad Mon Sep 17 00:00:00 2001 From: Mickael Bourgois Date: Wed, 26 Jun 2024 14:58:30 +0200 Subject: [PATCH 09/14] WRLGS-11: Test stderrUtils --- .../unit/fixtures/stderrUtils/catchStderr.js | 17 ++ .../stderrUtils/catchUncaughtException.js | 23 ++ .../unit/fixtures/stderrUtils/catchWarning.js | 38 +++ tests/unit/stderrUtils.js | 276 ++++++++++++++++++ 4 files changed, 354 insertions(+) create mode 100755 tests/unit/fixtures/stderrUtils/catchStderr.js create mode 100755 tests/unit/fixtures/stderrUtils/catchUncaughtException.js create mode 100755 tests/unit/fixtures/stderrUtils/catchWarning.js create mode 100644 tests/unit/stderrUtils.js diff --git a/tests/unit/fixtures/stderrUtils/catchStderr.js b/tests/unit/fixtures/stderrUtils/catchStderr.js new file mode 100755 index 0000000..9262e9c --- /dev/null +++ b/tests/unit/fixtures/stderrUtils/catchStderr.js @@ -0,0 +1,17 @@ +#!/usr/bin/env node +// Convert string args into primitive value +const fromStr = (str, primitive) => (str === `${primitive}` ? primitive : str); +const date = fromStr(process.argv[2], undefined); +const exitCode = fromStr(fromStr(process.argv[3], null), undefined); + +const { stderrUtils } = require('../../../../index'); + +stderrUtils.catchAndTimestampStderr( + date ? () => date : undefined, + exitCode, +); + +process.emitWarning('TestWarningMessage'); +// This will print warning after printing error before exit +throw new Error('TestingError'); + diff --git a/tests/unit/fixtures/stderrUtils/catchUncaughtException.js b/tests/unit/fixtures/stderrUtils/catchUncaughtException.js new file mode 100755 index 0000000..1271a6b --- /dev/null +++ b/tests/unit/fixtures/stderrUtils/catchUncaughtException.js @@ -0,0 +1,23 @@ +#!/usr/bin/env node +// Convert string args into primitive value +const fromStr = (str, primitive) => (str === `${primitive}` ? primitive : str); +const date = fromStr(process.argv[2], undefined); +const exitCode = fromStr(fromStr(process.argv[3], null), undefined); +const promise = fromStr(process.argv[4], true); + +const { stderrUtils } = require('../../../../index'); + +stderrUtils.catchAndTimestampUncaughtException( + date ? () => date : undefined, + exitCode, +); + +// Executed if process does not exit, process is in undefined behavior (bad) +// eslint-disable-next-line no-console +setTimeout(() => console.log('EXECUTED AFTER UNCAUGHT EXCEPTION'), 1); + +if (promise === true) { + Promise.reject(); +} else { + throw new Error('TestingError'); +} diff --git a/tests/unit/fixtures/stderrUtils/catchWarning.js b/tests/unit/fixtures/stderrUtils/catchWarning.js new file mode 100755 index 0000000..75fc865 --- /dev/null +++ b/tests/unit/fixtures/stderrUtils/catchWarning.js @@ -0,0 +1,38 @@ +#!/usr/bin/env node +// Convert string args into primitive value +const fromStr = (str, primitive) => (str === `${primitive}` ? primitive : str); +const date = fromStr(process.argv[2], undefined); +const name = fromStr(process.argv[3], undefined); +const code = fromStr(process.argv[4], undefined); +const detail = fromStr(process.argv[5], undefined); + +const { stderrUtils } = require('../../../../index'); + +stderrUtils.catchAndTimestampWarning( + date ? () => date : undefined, +); + +const warning = new Error('TestWarningMessage'); + +if (name) warning.name = name; +if (code) warning.code = code; +if (detail) warning.detail = detail; + +process.emitWarning(warning); + +/* +Examples: + +(node:203831) Error: TestWarningMessage + at Object. (catchWarning.js:15:17) + ... + at node:internal/main/run_main_module:22:47 +Above Warning Date: 2024-06-26T16:32:55.505Z + +(node:205151) [TEST01] CUSTOM: TestWarningMessage + at Object. (catchWarning.js:15:17) + ... + at node:internal/main/run_main_module:22:47 +Some additional detail +Above Warning Date: Tue, 31 Dec 2024 10:20:30 GMT +*/ diff --git a/tests/unit/stderrUtils.js b/tests/unit/stderrUtils.js new file mode 100644 index 0000000..4f8a5bb --- /dev/null +++ b/tests/unit/stderrUtils.js @@ -0,0 +1,276 @@ +const assert = require('assert'); +const { execFile } = require('child_process'); + +const stderrUtils = require('../../lib/stderrUtils'); + +/** Simple regex for ISO YYYY-MM-DDThh:mm:ss.sssZ */ +// eslint-disable-next-line max-len +const defaultDateRegex = /\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+(?:[+-][0-2]\d:[0-5]\d|Z)/; + +// eslint-disable-next-line valid-jsdoc +/** another format: Tue, 31 Dec 2024 10:20:30 GMT */ +const customDate = () => new Date('2024-12-31T10:20:30.444Z').toUTCString(); + +describe('stderrUtils', () => { + const errStackRegex = /Error: TestingError\n(?:.*\sat\s.*\n)+/; + + describe('defaultTimestamp', () => { + it('should match ISO format', () => { + assert.match(stderrUtils.defaultTimestamp(), defaultDateRegex); + }); + }); + + describe('printErrorWithTimestamp', () => { + let stderrText; + const originalStderrWrite = process.stderr.write; + const mockedStderrWrite = text => { stderrText = text; return true; }; + const err = new Error('TestingError'); + const origin = 'uncaughtException'; + + beforeEach(() => { + stderrText = undefined; + process.stderr.write = mockedStderrWrite; + }); + + afterEach(() => { + process.stderr.write = originalStderrWrite; + stderrText = undefined; + }); + + it( + 'should write to stderr with current date, origin and stacktrace', + () => { + const written = stderrUtils + .printErrorWithTimestamp(err, origin); + + assert.strictEqual(written, true); + const [firstLine, errStack] = stderrText.split(':\n'); + const [errDate, errOrigin] = firstLine.split(': '); + + assert.match(errDate, defaultDateRegex); + assert.strictEqual(errOrigin, origin); + assert.strictEqual(errStack, `${err.stack}\n`); + }, + ); + + it( + 'should write to stderr with custom date, origin and stacktrace', + () => { + const written = stderrUtils + .printErrorWithTimestamp(err, origin, customDate()); + + assert.strictEqual(written, true); + const [firstLine, errStack] = stderrText.split(':\n'); + const [errDate, errOrigin] = firstLine.split(': '); + + assert.strictEqual(errDate, customDate()); + assert.strictEqual(errOrigin, origin); + assert.strictEqual(errStack, `${err.stack}\n`); + }, + ); + }); + + const execOptions = { + cwd: __dirname, + // Subprocess should always stop alone + // But just in case, kill subprocess after 500ms. + // Leave enough time for `nyc` that runs slower. + timeout: 500, + }; + + // Execute in another process to notice the process exit + // Therefore, looks more like a functional test + + describe('catchAndTimestampUncaughtException', () => { + [ + { desc: 'with default date' }, + { desc: 'with custom date', date: customDate() }, + { desc: 'with custom exitCode 42', exitCode: 42 }, + { desc: 'without exit on uncaught exception', exitCode: null }, + { desc: 'for unhandled promise', promise: true }, + ].forEach(({ + desc, date, exitCode, promise, + }) => describe(desc, () => { + let err; + let stdout; + let stderr; + let errStack; + let errDate; + let errOrigin; + + before('run process catchUncaughtException', done => { + execFile( + './fixtures/stderrUtils/catchUncaughtException.js', + [`${date}`, `${exitCode}`, `${promise}`], + execOptions, + (subErr, subStdout, subStderr) => { + err = subErr; + stdout = subStdout; + stderr = subStderr; + let firstLine; + [firstLine, errStack] = stderr.split(':\n'); + [errDate, errOrigin] = firstLine.split(': '); + done(); + }, + ); + }); + + if (exitCode === null) { + it('should not be an error (or timeout)', + () => assert.ifError(err)); + it('should have stdout (printed after uncaught exception)', + () => assert.match(stdout, + /^.*EXECUTED AFTER UNCAUGHT EXCEPTION(?:.|\n)*$/)); + } else { + it('should be an error', + () => assert.ok(err)); + it(`should have exitCode ${exitCode || 1}`, + () => assert.strictEqual(err.code, exitCode || 1)); + it('should have empty stdout', + () => assert.strictEqual(stdout, '')); + } + + it('should have stderr', + () => assert.ok(stderr)); + it('should have date in stderr first line', + () => (date + ? assert.strictEqual(errDate, date) + : assert.match(errDate, defaultDateRegex))); + + it('should have origin in stderr first line', + () => (promise === true + ? assert.strictEqual(errOrigin, 'unhandledRejection') + : assert.strictEqual(errOrigin, 'uncaughtException'))); + + if (!promise) { + it('should have stack trace on stderr', + () => assert.match(errStack, errStackRegex)); + } + })); + }); + + describe('catchAndTimestampWarning (also tests node onWarning)', () => { + [ + { desc: 'with default date' }, + { desc: 'with custom date', date: customDate() }, + { desc: 'with deprecation warning', name: 'DeprecationWarning' }, + { + desc: 'with custom warning', + name: 'CUSTOM', + code: 'TEST01', + detail: 'Some additional detail', + }, + ].forEach(({ + desc, date, name, code, detail, + }) => describe(desc, () => { + let err; + let stdout; + let stderr; + + before('run process catchWarning', done => { + execFile( + './fixtures/stderrUtils/catchWarning.js', + [`${date}`, `${name}`, `${code}`, `${detail}`], + execOptions, + (subErr, subStdout, subStderr) => { + err = subErr; + stdout = subStdout; + stderr = subStderr; + done(); + }, + ); + }); + + it('should not be an error (or timeout)', + () => assert.ifError(err)); + it('should have empty stdout', + () => assert.strictEqual(stdout, '')); + it('should have stderr', + () => assert.ok(stderr)); + it('should have message on stderr first line, then stack trace', + () => assert.match(stderr, + /^.*TestWarningMessage\n(?:\s+at\s.*\n)+/)); + + if (code) { + it('should have code on stderr first line', + () => assert.match(stderr, new RegExp(`^.*[${code}]`))); + } + + if (name) { + it('should have name on stderr first line', + () => assert.match(stderr, new RegExp(`^.*${name}:`))); + } + + if (detail) { + it('should have detail on stderr', + () => assert.match(stderr, new RegExp(`.*${detail}.*`))); + } + + it(`should have ${date ? 'custom' : 'default'} date on stderr`, + () => assert.match(stderr, new RegExp( + `\nAbove Warning Date: ${ + date || defaultDateRegex.source}\n`, + ))); + })); + }); + + describe('catchAndTimestampStderr', () => { + [ + { desc: 'with default date' }, + { desc: 'with custom date', date: customDate() }, + { desc: 'with exit code', exitCode: 42 }, + + ].forEach(({ + desc, date, exitCode, + }) => describe(desc, () => { + let err; + let stdout; + let stderr; + + before('run process catchStderr', done => { + execFile( + './fixtures/stderrUtils/catchStderr.js', + [`${date}`, `${exitCode}`], + execOptions, + (subErr, subStdout, subStderr) => { + err = subErr; + stdout = subStdout; + stderr = subStderr; + done(); + }, + ); + }); + + it('should be an error', + () => assert.ok(err)); + it(`should have exitCode ${exitCode || 1}`, + () => assert.strictEqual(err.code, exitCode || 1)); + it('should have empty stdout', + () => assert.strictEqual(stdout, '')); + + it('should have stderr', + () => assert.ok(stderr)); + + // 2024-06-26T15:04:55.364Z: uncaughtException: + // Error: TestingError + // at Object. (catchStderr.js:16:7) + // at node:internal/main/run_main_module:22:47 + it('should have error date, origin and stacktrace in stderr', + () => assert.match(stderr, + new RegExp(`${date || defaultDateRegex.source + }: uncaughtException:\n${errStackRegex.source}`))); + + // (node:171245) Warning: TestWarningMessage + // at Object. (catchStderr.js:14:9) + // at node:internal/main/run_main_module:22:47 + // Above Warning Date: 2024-06-26T15:04:55.365Z + it('should have warning with stacktrace in stderr', () => { + const trace = 'Warning: TestWarningMessage\n(?:\\s+at\\s.*\n)+'; + const detail = `(?:.|\n)*?(?<=\n)Above Warning Date: ${ + date || defaultDateRegex.source}\n`; + assert.match(stderr, + new RegExp(`${trace}${detail}`)); + }); + })); + }); +}); From 68df3de3e928e2c78918a13c06b636b17df2e8f9 Mon Sep 17 00:00:00 2001 From: Mickael Bourgois Date: Wed, 26 Jun 2024 21:05:57 +0200 Subject: [PATCH 10/14] WRLGS-11: update dev deps for nyc coverage --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index dae0cd2..a3389db 100644 --- a/yarn.lock +++ b/yarn.lock @@ -520,9 +520,9 @@ camelcase@^6.0.0: integrity sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg== caniuse-lite@^1.0.30001259: - version "1.0.30001261" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001261.tgz#96d89813c076ea061209a4e040d8dcf0c66a1d01" - integrity sha512-vM8D9Uvp7bHIN0fZ2KQ4wnmYFpJo/Etb4Vwsuc+ka0tfGDHvOPrFm6S/7CCNLSOkAUjenT2HnUPESdOIL91FaA== + version "1.0.30001637" + resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001637.tgz" + integrity sha512-1x0qRI1mD1o9e+7mBI7XtzFAP4XszbHaVWsMiGbSPLYekKTJF7K+FNk6AsXH4sUpc+qrsI3pVgf1Jdl/uGkuSQ== catharsis@^0.8.11: version "0.8.11" From b40a74ea3921cbdc45075f13d2e4a3d76d5a94fd Mon Sep 17 00:00:00 2001 From: Mickael Bourgois Date: Fri, 28 Jun 2024 11:57:54 +0200 Subject: [PATCH 11/14] WRLGS-11: Fix coverage test in latest branch nyc coverage seems to slow down the process on first run The slow seems to vary between branches (due to nyc version) --- tests/unit/stderrUtils.js | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/tests/unit/stderrUtils.js b/tests/unit/stderrUtils.js index 4f8a5bb..007ab2f 100644 --- a/tests/unit/stderrUtils.js +++ b/tests/unit/stderrUtils.js @@ -80,6 +80,9 @@ describe('stderrUtils', () => { // Execute in another process to notice the process exit // Therefore, looks more like a functional test + const timeoutHint = (ms, retries) => + `Test fixture process timed out after ${ms}ms with ${retries} retries.\n` + + 'Due to nyc coverage first run slowing down process.\nIncrease execOptions.timeout to fix'; describe('catchAndTimestampUncaughtException', () => { [ @@ -91,6 +94,8 @@ describe('stderrUtils', () => { ].forEach(({ desc, date, exitCode, promise, }) => describe(desc, () => { + /** for before all hook that doesn't support this.retries */ + let retries = 4; let err; let stdout; let stderr; @@ -98,12 +103,20 @@ describe('stderrUtils', () => { let errDate; let errOrigin; - before('run process catchUncaughtException', done => { + before('run process catchUncaughtException', function beforeAllHook(done) { execFile( './fixtures/stderrUtils/catchUncaughtException.js', [`${date}`, `${exitCode}`, `${promise}`], execOptions, (subErr, subStdout, subStderr) => { + if (subErr?.killed) { + retries--; + if (retries <= 0) { + assert.fail(timeoutHint(execOptions.timeout, retries)); + } + execOptions.timeout *= 2; + return beforeAllHook(done); + } err = subErr; stdout = subStdout; stderr = subStderr; @@ -163,16 +176,26 @@ describe('stderrUtils', () => { ].forEach(({ desc, date, name, code, detail, }) => describe(desc, () => { + /** for before all hook that doesn't support this.retries */ + let retries = 4; let err; let stdout; let stderr; - before('run process catchWarning', done => { + before('run process catchWarning', function beforeAllHook(done) { execFile( './fixtures/stderrUtils/catchWarning.js', [`${date}`, `${name}`, `${code}`, `${detail}`], execOptions, (subErr, subStdout, subStderr) => { + if (subErr?.killed) { + retries--; + if (retries <= 0) { + assert.fail(timeoutHint(execOptions.timeout, retries)); + } + execOptions.timeout *= 2; + return beforeAllHook(done); + } err = subErr; stdout = subStdout; stderr = subStderr; @@ -223,16 +246,26 @@ describe('stderrUtils', () => { ].forEach(({ desc, date, exitCode, }) => describe(desc, () => { + /** for before all hook that doesn't support this.retries */ + let retries = 4; let err; let stdout; let stderr; - before('run process catchStderr', done => { + before('run process catchStderr', function beforeAllHook(done) { execFile( './fixtures/stderrUtils/catchStderr.js', [`${date}`, `${exitCode}`], execOptions, (subErr, subStdout, subStderr) => { + if (subErr?.killed) { + retries--; + if (retries <= 0) { + assert.fail(timeoutHint(execOptions.timeout, retries)); + } + execOptions.timeout *= 2; + return beforeAllHook(done); + } err = subErr; stdout = subStdout; stderr = subStderr; From 4984e5be3cc385b5b2ebd2f3b5d2ab226f1ef4a2 Mon Sep 17 00:00:00 2001 From: Mickael Bourgois Date: Wed, 26 Jun 2024 20:14:40 +0200 Subject: [PATCH 12/14] WRLGS-11: Fix and bump package version All tags from 7.4.10 and 7.10.1.0 to 7.10.4.10 are all the same commit 23dfe7c --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fd28787..3969fac 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "engines": { "node": ">=10" }, - "version": "7.4.1", + "version": "7.10.5", "description": "An efficient raw JSON logging library aimed at micro-services architectures.", "main": "index.js", "scripts": { From cff31143151294e3d107ed8293851faf149ab2fb Mon Sep 17 00:00:00 2001 From: Mickael Bourgois Date: Fri, 28 Jun 2024 12:18:02 +0200 Subject: [PATCH 13/14] WRLGS-11: Bump package.json version 8.0.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2265190..8b27b26 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "engines": { "node": ">=10" }, - "version": "8.0.0", + "version": "8.0.1", "description": "An efficient raw JSON logging library aimed at micro-services architectures.", "main": "index.js", "scripts": { From 4131abec824a336eeb68b531e6c91f2748a0644a Mon Sep 17 00:00:00 2001 From: Mickael Bourgois Date: Fri, 28 Jun 2024 12:24:59 +0200 Subject: [PATCH 14/14] WRLGS-11: Bump package.json version 8.1.5 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 06209f5..67aff07 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "engines": { "node": ">=10" }, - "version": "8.1.4", + "version": "8.1.5", "description": "An efficient raw JSON logging library aimed at micro-services architectures.", "main": "index.js", "scripts": {