From 4c306d624b8a39b881fd3b97e7fa42ee0fc81380 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20Bj=C3=B6rkqvist?= Date: Fri, 25 Oct 2024 11:08:51 +0200 Subject: [PATCH 1/2] chore(KUI-1537): replaced mockery with jest --- package-lock.json | 122 ++++++++++++++++--------------------- package.json | 1 - test/unit/test-MemoCtrl.js | 17 +++--- 3 files changed, 59 insertions(+), 81 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4246e2f2..eb59d3d2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -75,7 +75,6 @@ "jest-extended": "^4.0.2", "lint-staged": "^15.2.5", "mini-css-extract-plugin": "^2.9.0", - "mockery": "^2.1.0", "nock": "^13.5.4", "node-mocks-http": "^1.14.1", "node-notifier": "^10.0.1", @@ -6243,19 +6242,19 @@ "dev": true }, "node_modules/cookie": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.1.tgz", - "integrity": "sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA==", + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", "engines": { "node": ">= 0.6" } }, "node_modules/cookie-parser": { - "version": "1.4.6", - "resolved": "https://registry.npmjs.org/cookie-parser/-/cookie-parser-1.4.6.tgz", - "integrity": "sha512-z3IzaNjdwUC2olLIB5/ITd0/setiaFMLYiZJle7xg5Fe9KWAceil7xszYfHHBtDFYLSgJduS2Ty0P1uJdPDJeA==", + "version": "1.4.7", + "resolved": "https://registry.npmjs.org/cookie-parser/-/cookie-parser-1.4.7.tgz", + "integrity": "sha512-nGUvgXnotP3BsjiLX2ypbQnWoGUPIIfHQNZkkC668ntrzGWEZVW70HDEB1qnNGMicPje6EttlIgzo51YSwNQGw==", "dependencies": { - "cookie": "0.4.1", + "cookie": "0.7.2", "cookie-signature": "1.0.6" }, "engines": { @@ -8105,17 +8104,16 @@ } }, "node_modules/express": { - "version": "4.21.0", - "resolved": "https://registry.npmjs.org/express/-/express-4.21.0.tgz", - "integrity": "sha512-VqcNGcj/Id5ZT1LZ/cfihi3ttTn+NJmkli2eZADigjq29qTlWi/hAQ43t/VLPq8+UX06FCEx3ByOYet6ZFblng==", - "license": "MIT", + "version": "4.21.1", + "resolved": "https://registry.npmjs.org/express/-/express-4.21.1.tgz", + "integrity": "sha512-YSFlK1Ee0/GC8QaO91tHcDxJiE/X4FbpAyQWkxAvG6AXCuR65YzK8ua6D9hvi/TzUfZMpc+BwuM1IPw8fmQBiQ==", "dependencies": { "accepts": "~1.3.8", "array-flatten": "1.1.1", "body-parser": "1.20.3", "content-disposition": "0.5.4", "content-type": "~1.0.4", - "cookie": "0.6.0", + "cookie": "0.7.1", "cookie-signature": "1.0.6", "debug": "2.6.9", "depd": "2.0.0", @@ -8203,12 +8201,12 @@ } }, "node_modules/express-session": { - "version": "1.17.3", - "resolved": "https://registry.npmjs.org/express-session/-/express-session-1.17.3.tgz", - "integrity": "sha512-4+otWXlShYlG1Ma+2Jnn+xgKUZTMJ5QD3YvfilX3AcocOAbIkVylSWEklzALe/+Pu4qV6TYBj5GwOBFfdKqLBw==", + "version": "1.18.1", + "resolved": "https://registry.npmjs.org/express-session/-/express-session-1.18.1.tgz", + "integrity": "sha512-a5mtTqEaZvBCL9A9aqkrtfz+3SMDhOVUnjafjo+s7A9Txkq+SVX2DLvSp1Zrv4uCXa3lMSK3viWnh9Gg07PBUA==", "dependencies": { - "cookie": "0.4.2", - "cookie-signature": "1.0.6", + "cookie": "0.7.2", + "cookie-signature": "1.0.7", "debug": "2.6.9", "depd": "~2.0.0", "on-headers": "~1.0.2", @@ -8220,13 +8218,10 @@ "node": ">= 0.8.0" } }, - "node_modules/express-session/node_modules/cookie": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz", - "integrity": "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==", - "engines": { - "node": ">= 0.6" - } + "node_modules/express-session/node_modules/cookie-signature": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.7.tgz", + "integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA==" }, "node_modules/express-session/node_modules/debug": { "version": "2.6.9", @@ -8242,9 +8237,9 @@ "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" }, "node_modules/express/node_modules/cookie": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", - "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==", + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.1.tgz", + "integrity": "sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w==", "engines": { "node": ">= 0.6" } @@ -13103,12 +13098,6 @@ } } }, - "node_modules/mockery": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mockery/-/mockery-2.1.0.tgz", - "integrity": "sha512-9VkOmxKlWXoDO/h1jDZaS4lH33aWfRiJiNT/tKj+8OGzrcFDLo8d0syGdbsc3Bc4GvRXPb+NMMvojotmuGJTvA==", - "dev": true - }, "node_modules/module-details-from-path": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/module-details-from-path/-/module-details-from-path-1.0.3.tgz", @@ -16044,10 +16033,9 @@ "integrity": "sha512-Eet/eeMhkO6TX8mnUteS9zgPbUMQa4I6Kkp5ORiBD5476/m+PIRiumP5tmh5ioJpH7k51Kehawy2UDfsnxxY8Q==" }, "node_modules/tinymce": { - "version": "6.8.4", - "resolved": "https://registry.npmjs.org/tinymce/-/tinymce-6.8.4.tgz", - "integrity": "sha512-okoJyxuPv1gzASxQDNgQbnUXOdAIyoOSXcXcZZu7tiW0PSKEdf3SdASxPBupRj+64/E3elHwVRnzSdo82Emqbg==", - "license": "MIT" + "version": "6.8.5", + "resolved": "https://registry.npmjs.org/tinymce/-/tinymce-6.8.5.tgz", + "integrity": "sha512-qAL/FxL7cwZHj4BfaF818zeJJizK9jU5IQzTcSLL4Rj5MaJdiVblEj7aDr80VCV1w9h4Lak9hlnALhq/kVtN1g==" }, "node_modules/tmpl": { "version": "1.0.5", @@ -21696,16 +21684,16 @@ "dev": true }, "cookie": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.1.tgz", - "integrity": "sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA==" + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==" }, "cookie-parser": { - "version": "1.4.6", - "resolved": "https://registry.npmjs.org/cookie-parser/-/cookie-parser-1.4.6.tgz", - "integrity": "sha512-z3IzaNjdwUC2olLIB5/ITd0/setiaFMLYiZJle7xg5Fe9KWAceil7xszYfHHBtDFYLSgJduS2Ty0P1uJdPDJeA==", + "version": "1.4.7", + "resolved": "https://registry.npmjs.org/cookie-parser/-/cookie-parser-1.4.7.tgz", + "integrity": "sha512-nGUvgXnotP3BsjiLX2ypbQnWoGUPIIfHQNZkkC668ntrzGWEZVW70HDEB1qnNGMicPje6EttlIgzo51YSwNQGw==", "requires": { - "cookie": "0.4.1", + "cookie": "0.7.2", "cookie-signature": "1.0.6" } }, @@ -23013,16 +23001,16 @@ } }, "express": { - "version": "4.21.0", - "resolved": "https://registry.npmjs.org/express/-/express-4.21.0.tgz", - "integrity": "sha512-VqcNGcj/Id5ZT1LZ/cfihi3ttTn+NJmkli2eZADigjq29qTlWi/hAQ43t/VLPq8+UX06FCEx3ByOYet6ZFblng==", + "version": "4.21.1", + "resolved": "https://registry.npmjs.org/express/-/express-4.21.1.tgz", + "integrity": "sha512-YSFlK1Ee0/GC8QaO91tHcDxJiE/X4FbpAyQWkxAvG6AXCuR65YzK8ua6D9hvi/TzUfZMpc+BwuM1IPw8fmQBiQ==", "requires": { "accepts": "~1.3.8", "array-flatten": "1.1.1", "body-parser": "1.20.3", "content-disposition": "0.5.4", "content-type": "~1.0.4", - "cookie": "0.6.0", + "cookie": "0.7.1", "cookie-signature": "1.0.6", "debug": "2.6.9", "depd": "2.0.0", @@ -23051,9 +23039,9 @@ }, "dependencies": { "cookie": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", - "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==" + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.1.tgz", + "integrity": "sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w==" }, "debug": { "version": "2.6.9", @@ -23111,12 +23099,12 @@ } }, "express-session": { - "version": "1.17.3", - "resolved": "https://registry.npmjs.org/express-session/-/express-session-1.17.3.tgz", - "integrity": "sha512-4+otWXlShYlG1Ma+2Jnn+xgKUZTMJ5QD3YvfilX3AcocOAbIkVylSWEklzALe/+Pu4qV6TYBj5GwOBFfdKqLBw==", + "version": "1.18.1", + "resolved": "https://registry.npmjs.org/express-session/-/express-session-1.18.1.tgz", + "integrity": "sha512-a5mtTqEaZvBCL9A9aqkrtfz+3SMDhOVUnjafjo+s7A9Txkq+SVX2DLvSp1Zrv4uCXa3lMSK3viWnh9Gg07PBUA==", "requires": { - "cookie": "0.4.2", - "cookie-signature": "1.0.6", + "cookie": "0.7.2", + "cookie-signature": "1.0.7", "debug": "2.6.9", "depd": "~2.0.0", "on-headers": "~1.0.2", @@ -23125,10 +23113,10 @@ "uid-safe": "~2.1.5" }, "dependencies": { - "cookie": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz", - "integrity": "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==" + "cookie-signature": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.7.tgz", + "integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA==" }, "debug": { "version": "2.6.9", @@ -26600,12 +26588,6 @@ "use-sync-external-store": "^1.2.0" } }, - "mockery": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mockery/-/mockery-2.1.0.tgz", - "integrity": "sha512-9VkOmxKlWXoDO/h1jDZaS4lH33aWfRiJiNT/tKj+8OGzrcFDLo8d0syGdbsc3Bc4GvRXPb+NMMvojotmuGJTvA==", - "dev": true - }, "module-details-from-path": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/module-details-from-path/-/module-details-from-path-1.0.3.tgz", @@ -28705,9 +28687,9 @@ "integrity": "sha512-Eet/eeMhkO6TX8mnUteS9zgPbUMQa4I6Kkp5ORiBD5476/m+PIRiumP5tmh5ioJpH7k51Kehawy2UDfsnxxY8Q==" }, "tinymce": { - "version": "6.8.4", - "resolved": "https://registry.npmjs.org/tinymce/-/tinymce-6.8.4.tgz", - "integrity": "sha512-okoJyxuPv1gzASxQDNgQbnUXOdAIyoOSXcXcZZu7tiW0PSKEdf3SdASxPBupRj+64/E3elHwVRnzSdo82Emqbg==" + "version": "6.8.5", + "resolved": "https://registry.npmjs.org/tinymce/-/tinymce-6.8.5.tgz", + "integrity": "sha512-qAL/FxL7cwZHj4BfaF818zeJJizK9jU5IQzTcSLL4Rj5MaJdiVblEj7aDr80VCV1w9h4Lak9hlnALhq/kVtN1g==" }, "tmpl": { "version": "1.0.5", diff --git a/package.json b/package.json index af23651f..355a32a8 100644 --- a/package.json +++ b/package.json @@ -99,7 +99,6 @@ "jest-extended": "^4.0.2", "lint-staged": "^15.2.5", "mini-css-extract-plugin": "^2.9.0", - "mockery": "^2.1.0", "nock": "^13.5.4", "node-mocks-http": "^1.14.1", "node-notifier": "^10.0.1", diff --git a/test/unit/test-MemoCtrl.js b/test/unit/test-MemoCtrl.js index 11dd528d..9e35e98c 100644 --- a/test/unit/test-MemoCtrl.js +++ b/test/unit/test-MemoCtrl.js @@ -4,18 +4,15 @@ const { expect } = require('chai') const nock = require('nock') -const mockery = require('mockery') const httpMocks = require('node-mocks-http') -const mockLogger = {} -mockLogger.debug = mockLogger.info = mockLogger.error = mockLogger.warn = () => {} -mockLogger.init = () => {} - -mockery.registerMock('@kth/log', mockLogger) -mockery.enable({ - warnOnReplace: false, - warnOnUnregistered: false, -}) +jest.mock('@kth/log', () => ({ + debug: jest.fn(), + info: jest.fn(), + error: jest.fn(), + warn: jest.fn(), + init: jest.fn(), +})) const paths = require('../mocks/apipaths.json') const api = nock('http://localhost:3001/api/node').get('/_paths').reply(200, paths).get('/_checkAPIkey').reply(200, {}) From 2e3cc396100a8e784ba11b2180ba7d8e3b9bbaae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20Bj=C3=B6rkqvist?= Date: Fri, 25 Oct 2024 13:36:29 +0200 Subject: [PATCH 2/2] chore(KUI-1537): all vulnerabilities handled --- package-lock.json | 35 +++++++++++++++++++---------------- package.json | 5 +++-- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/package-lock.json b/package-lock.json index eb59d3d2..4a30966a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,7 +21,7 @@ "@kth/session": "^3.0.9", "@kth/style": "^1.4.2", "@kth/ug-rest-api-helper": "^1.0.26", - "@tinymce/tinymce-react": "^4.3.2", + "@tinymce/tinymce-react": "^5.1.1", "axios": "^1.7.2", "body-parser": "^1.20.2", "cookie-parser": "^1.4.6", @@ -47,7 +47,8 @@ "react-router-hash-link": "^2.4.3", "react-sticky": "^6.0.3", "reactstrap": "^9.2.2", - "safe-utils": "^1.0.1" + "safe-utils": "^1.0.1", + "tinymce": "^7.4.1" }, "devDependencies": { "@babel/cli": "^7.24.6", @@ -3878,12 +3879,13 @@ } }, "node_modules/@tinymce/tinymce-react": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/@tinymce/tinymce-react/-/tinymce-react-4.3.2.tgz", - "integrity": "sha512-wJHZhPf2Mk3yTtdVC/uIGh+kvDgKuTw/qV13uzdChTNo68JI1l7jYMrSQOpyimDyn5LHAw0E1zFByrm1WHAVeA==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@tinymce/tinymce-react/-/tinymce-react-5.1.1.tgz", + "integrity": "sha512-DQ0wpvnf/9z8RsOEAmrWZ1DN1PKqcQHfU+DpM3llLze7FHmxVtzuN8O+FYh0oAAF4stzAXwiCIVacfqjMwRieQ==", + "license": "MIT", "dependencies": { "prop-types": "^15.6.2", - "tinymce": "^6.0.0 || ^5.5.1" + "tinymce": "^7.0.0 || ^6.0.0 || ^5.5.1" }, "peerDependencies": { "react": "^18.0.0 || ^17.0.1 || ^16.7.0", @@ -16033,9 +16035,10 @@ "integrity": "sha512-Eet/eeMhkO6TX8mnUteS9zgPbUMQa4I6Kkp5ORiBD5476/m+PIRiumP5tmh5ioJpH7k51Kehawy2UDfsnxxY8Q==" }, "node_modules/tinymce": { - "version": "6.8.5", - "resolved": "https://registry.npmjs.org/tinymce/-/tinymce-6.8.5.tgz", - "integrity": "sha512-qAL/FxL7cwZHj4BfaF818zeJJizK9jU5IQzTcSLL4Rj5MaJdiVblEj7aDr80VCV1w9h4Lak9hlnALhq/kVtN1g==" + "version": "7.4.1", + "resolved": "https://registry.npmjs.org/tinymce/-/tinymce-7.4.1.tgz", + "integrity": "sha512-g1Ieaio5YU+jLEQZkQyxTT8EY/im+TC/CFBPlqDBCNdsF8YQOeLMot+K6vmFOAXhNc85KhP1rC9Dn2X+iBFDGg==", + "license": "GPL-2.0-or-later" }, "node_modules/tmpl": { "version": "1.0.5", @@ -19843,12 +19846,12 @@ } }, "@tinymce/tinymce-react": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/@tinymce/tinymce-react/-/tinymce-react-4.3.2.tgz", - "integrity": "sha512-wJHZhPf2Mk3yTtdVC/uIGh+kvDgKuTw/qV13uzdChTNo68JI1l7jYMrSQOpyimDyn5LHAw0E1zFByrm1WHAVeA==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@tinymce/tinymce-react/-/tinymce-react-5.1.1.tgz", + "integrity": "sha512-DQ0wpvnf/9z8RsOEAmrWZ1DN1PKqcQHfU+DpM3llLze7FHmxVtzuN8O+FYh0oAAF4stzAXwiCIVacfqjMwRieQ==", "requires": { "prop-types": "^15.6.2", - "tinymce": "^6.0.0 || ^5.5.1" + "tinymce": "^7.0.0 || ^6.0.0 || ^5.5.1" } }, "@tootallnate/once": { @@ -28687,9 +28690,9 @@ "integrity": "sha512-Eet/eeMhkO6TX8mnUteS9zgPbUMQa4I6Kkp5ORiBD5476/m+PIRiumP5tmh5ioJpH7k51Kehawy2UDfsnxxY8Q==" }, "tinymce": { - "version": "6.8.5", - "resolved": "https://registry.npmjs.org/tinymce/-/tinymce-6.8.5.tgz", - "integrity": "sha512-qAL/FxL7cwZHj4BfaF818zeJJizK9jU5IQzTcSLL4Rj5MaJdiVblEj7aDr80VCV1w9h4Lak9hlnALhq/kVtN1g==" + "version": "7.4.1", + "resolved": "https://registry.npmjs.org/tinymce/-/tinymce-7.4.1.tgz", + "integrity": "sha512-g1Ieaio5YU+jLEQZkQyxTT8EY/im+TC/CFBPlqDBCNdsF8YQOeLMot+K6vmFOAXhNc85KhP1rC9Dn2X+iBFDGg==" }, "tmpl": { "version": "1.0.5", diff --git a/package.json b/package.json index 355a32a8..1825daa3 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "@kth/session": "^3.0.9", "@kth/style": "^1.4.2", "@kth/ug-rest-api-helper": "^1.0.26", - "@tinymce/tinymce-react": "^4.3.2", + "@tinymce/tinymce-react": "^5.1.1", "axios": "^1.7.2", "body-parser": "^1.20.2", "cookie-parser": "^1.4.6", @@ -71,7 +71,8 @@ "react-router-hash-link": "^2.4.3", "react-sticky": "^6.0.3", "reactstrap": "^9.2.2", - "safe-utils": "^1.0.1" + "safe-utils": "^1.0.1", + "tinymce": "^7.4.1" }, "devDependencies": { "@babel/cli": "^7.24.6",