diff --git a/.gitignore b/.gitignore index 65141d6..52084be 100644 --- a/.gitignore +++ b/.gitignore @@ -35,4 +35,11 @@ cache/* !cache/smartcrop/.keepme uploaded-images/* !uploaded-images/keepme -uploaded_files \ No newline at end of file +uploaded_files +/dist-instrumented/ + +# these are autogenerated, no need to version control them +src/back/jdd-components/components.ts +src/back/routes/routes.ts +src/back/routes/urls.ts +src/includes.css \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index aeb30b0..1e733e8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -51,7 +51,8 @@ "eslint-config-prettier": "^7.2.0", "eslint-plugin-prettier": "^3.3.1", "kill-port": "^1.6.1", - "mri": "^1.1.6", + "mocha": "^10.4.0", + "mri": "^1.2.0", "nyc": "^15.1.0", "prettier": "^2.2.1", "ts-loader": "^8.0.14", @@ -2509,6 +2510,12 @@ "node": ">=8" } }, + "node_modules/browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", + "dev": true + }, "node_modules/browserslist": { "version": "4.23.0", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.23.0.tgz", @@ -4495,6 +4502,15 @@ "node": ">=8" } }, + "node_modules/flat": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", + "dev": true, + "bin": { + "flat": "cli.js" + } + }, "node_modules/flat-cache": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz", @@ -4630,6 +4646,19 @@ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, "node_modules/function-bind": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", @@ -5464,6 +5493,15 @@ "node": ">=8" } }, + "node_modules/is-plain-obj": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", + "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/is-regex": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", @@ -5553,6 +5591,18 @@ "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==", "dev": true }, + "node_modules/is-unicode-supported": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-weakref": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", @@ -6484,6 +6534,92 @@ "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", "dev": true }, + "node_modules/log-symbols": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "dev": true, + "dependencies": { + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-symbols/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/log-symbols/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/log-symbols/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/log-symbols/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/log-symbols/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/log-symbols/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/loupe": { "version": "2.3.7", "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.7.tgz", @@ -7275,6 +7411,306 @@ "ufo": "^1.3.2" } }, + "node_modules/mocha": { + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.4.0.tgz", + "integrity": "sha512-eqhGB8JKapEYcC4ytX/xrzKforgEc3j1pGlAXVy3eRwrtAy5/nIfT1SvgGzfN0XZZxeLq0aQWkOUAmqIJiv+bA==", + "dev": true, + "dependencies": { + "ansi-colors": "4.1.1", + "browser-stdout": "1.3.1", + "chokidar": "3.5.3", + "debug": "4.3.4", + "diff": "5.0.0", + "escape-string-regexp": "4.0.0", + "find-up": "5.0.0", + "glob": "8.1.0", + "he": "1.2.0", + "js-yaml": "4.1.0", + "log-symbols": "4.1.0", + "minimatch": "5.0.1", + "ms": "2.1.3", + "serialize-javascript": "6.0.0", + "strip-json-comments": "3.1.1", + "supports-color": "8.1.1", + "workerpool": "6.2.1", + "yargs": "16.2.0", + "yargs-parser": "20.2.4", + "yargs-unparser": "2.0.0" + }, + "bin": { + "_mocha": "bin/_mocha", + "mocha": "bin/mocha.js" + }, + "engines": { + "node": ">= 14.0.0" + } + }, + "node_modules/mocha/node_modules/ansi-colors": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/mocha/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "node_modules/mocha/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/mocha/node_modules/chokidar": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/mocha/node_modules/cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dev": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "node_modules/mocha/node_modules/diff": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", + "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/mocha/node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mocha/node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mocha/node_modules/glob": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", + "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/mocha/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/mocha/node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/mocha/node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mocha/node_modules/minimatch": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", + "integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/mocha/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "node_modules/mocha/node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mocha/node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mocha/node_modules/serialize-javascript": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", + "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", + "dev": true, + "dependencies": { + "randombytes": "^2.1.0" + } + }, + "node_modules/mocha/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/mocha/node_modules/yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dev": true, + "dependencies": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/mocha/node_modules/yargs-parser": { + "version": "20.2.4", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", + "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/mocha/node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/mongodb": { "version": "6.5.0", "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.5.0.tgz", @@ -8271,6 +8707,19 @@ "node": ">=16" } }, + "node_modules/playwright/node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, "node_modules/possible-typed-array-names": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz", @@ -8557,7 +9006,6 @@ "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", "dev": true, - "peer": true, "dependencies": { "safe-buffer": "^5.1.0" } @@ -11211,6 +11659,12 @@ "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", "integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==" }, + "node_modules/workerpool": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz", + "integrity": "sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==", + "dev": true + }, "node_modules/wrap-ansi": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", @@ -11387,6 +11841,45 @@ "node": ">=12" } }, + "node_modules/yargs-unparser": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", + "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", + "dev": true, + "dependencies": { + "camelcase": "^6.0.0", + "decamelize": "^4.0.0", + "flat": "^5.0.2", + "is-plain-obj": "^2.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs-unparser/node_modules/camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/yargs-unparser/node_modules/decamelize": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", + "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/ylru": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/ylru/-/ylru-1.4.0.tgz", diff --git a/package.json b/package.json index a596aa6..8918f3c 100644 --- a/package.json +++ b/package.json @@ -9,19 +9,23 @@ "start-watch": "SEALIOUS_PORT=$SEALIOUS_PORT SEALIOUS_BASE_URL=$SEALIOUS_BASE_URL nodemon --enable-source-maps .", "typecheck:back": "tsc --noEmit --target es6 --lib es2021,dom -p tsconfig-back.json", "typecheck:front": "tsc --noEmit --target es6 --lib es2015,dom -p tsconfig-front.json", + "typecheck": "npm run typecheck:back && npm run typecheck:front", "prewatch": "rm -rf dist/* && npm run build", - "build": "sealgen build", + "build": "rm -rf dist && sealgen build && npm run lint && npm run typecheck", "watch": "multiple-scripts-tmux -p watch", "reset-db": "docker-compose down && docker-compose up -d", "install-test-deps": "npx playwright install firefox", - "pretest-cmd": "rm -rf dist && npm run build", - "test-cmd": "vitest --config ./src/back/vitest.config.ts", - "test-cmd-once": "vitest run --config ./src/back/vitest.config.ts", - "test": "npm run test-cmd -- --ui", - "coverage": "npm run test --coverage", - "postinstall": "sealgen make-env && npm install --prefix webhint && npm run install-test-deps", - "test-reports": "rm -f .xunit && npm run test-cmd-once -- --coverage --reporter=junit --outputFile=.xunit", - "show-coverage": "npm run test-reports; xdg-open coverage/index.html" + "postinstall": "npm run install-test-deps", + "pretest": "npm run build && docker-compose up -d", + "test": "node test.cjs", + "prepare": "npm run build", + "lint": "eslint src", + "preinstrument": "npm run build && rm -fr .xunit coverage dist-instrumented", + "instrument": "npx nyc instrument --exclude \"\" dist dist-instrumented", + "pretest-reports": "npm run instrument && docker-compose up -d", + "test-reports": "npx nyc --exclude \"\" ./node_modules/.bin/mocha --recursive --timeout=10000 --require source-map-support/register --reporter xunit --reporter-option output=.xunit 'dist-instrumented/**/*.test.js' --exit && nyc report --reporter clover --exclude \"\"", + "precover-html": "rm -rf coverate/lcov-report", + "cover-html": "npm run test-reports && nyc report --reporter lcov --exclude \"\" && xdg-open coverage/lcov-report/index.html" }, "tmux-scripts": { "watch": [ @@ -55,8 +59,7 @@ "qs": "^6.12.0", "sealious": "^0.19.6", "stimulus": "^2.0.0", - "tempstream": "^0.3.15", - "vitest": "^1.1.0" + "tempstream": "^0.3.15" }, "devDependencies": { "@sealcode/ansi-html-stream": "^1.0.1", @@ -67,15 +70,13 @@ "@types/uuid": "^9.0.8", "@typescript-eslint/eslint-plugin": "7.4", "@typescript-eslint/parser": "7.4", - "@vitest/coverage-istanbul": "^1.1.0", - "@vitest/coverage-v8": "^1.1.0", - "@vitest/ui": "^1.1.0", "axios": "^1.6.2", "eslint": "8.57", "eslint-config-prettier": "^7.2.0", "eslint-plugin-prettier": "^3.3.1", "kill-port": "^1.6.1", - "mri": "^1.1.6", + "mocha": "^10.4.0", + "mri": "^1.2.0", "nyc": "^15.1.0", "prettier": "^2.2.1", "ts-loader": "^8.0.14", diff --git a/src/back/collections/password-reset-intents.test.ts b/src/back/collections/password-reset-intents.test.ts index cced86f..772ba8f 100644 --- a/src/back/collections/password-reset-intents.test.ts +++ b/src/back/collections/password-reset-intents.test.ts @@ -15,54 +15,46 @@ describe("password-reset-intents", function () { }); } - it( - "tells you if the email address doesn't exist", - async function () { - return withProdApp(async ({ app, base_url }) => { - const email = "fake@example.com"; - try { - await axios.post( - `${base_url}/api/v1/collections/password-reset-intents`, - { - email: email, - } - ); - } catch (e) { - assert.equal( - e.response.data.data.field_messages.email.message, - app.i18n("invalid_existing_value", ["users", "email", email]) - ); - return; - } - throw new Error("it didn't throw"); - }); - }, - LONG_TEST_TIMEOUT - ); - - it( - "allows anyone to create an intent, if the email exists", - async () => - withProdApp(async ({ app, base_url }) => { - await createAUser(app); - const { email, token } = ( - await axios.post( - `${base_url}/api/v1/collections/password-reset-intents`, - { - email: "user@example.com", - } - ) - ).data; - assert.deepEqual( - { email, token }, + it("tells you if the email address doesn't exist", async function () { + return withProdApp(async ({ app, base_url }) => { + const email = "fake@example.com"; + try { + await axios.post( + `${base_url}/api/v1/collections/password-reset-intents`, { - email: "user@example.com", - token: "it's a secret to everybody", + email: email, } ); - }), - LONG_TEST_TIMEOUT - ); + } catch (e) { + assert.equal( + e.response.data.data.field_messages.email.message, + app.i18n("invalid_existing_value", ["users", "email", email]) + ); + return; + } + throw new Error("it didn't throw"); + }); + }).timeout(LONG_TEST_TIMEOUT); + + it("allows anyone to create an intent, if the email exists", async () => + withProdApp(async ({ app, base_url }) => { + await createAUser(app); + const { email, token } = ( + await axios.post( + `${base_url}/api/v1/collections/password-reset-intents`, + { + email: "user@example.com", + } + ) + ).data; + assert.deepEqual( + { email, token }, + { + email: "user@example.com", + token: "it's a secret to everybody", + } + ); + })).timeout(LONG_TEST_TIMEOUT); it("tells you if the email address is malformed", async () => withProdApp(async ({ app, base_url }) => { diff --git a/src/back/collections/user-roles.test.ts b/src/back/collections/user-roles.test.ts index 0a969c0..d62d6bf 100644 --- a/src/back/collections/user-roles.test.ts +++ b/src/back/collections/user-roles.test.ts @@ -7,31 +7,27 @@ import Users from "./users.js"; import { LONG_TEST_TIMEOUT } from "../test_utils/webhint.js"; describe("user-roles", () => { - it( - "rejects when given an empty role", - async () => - withProdApp(async ({ app, rest_api }) => { - const [user, session] = await createAdmin(app, rest_api); - await TestUtils.assertThrowsAsync( - async () => { - return rest_api.post( - `/api/v1/collections/user-roles`, - { - user: user.id, - }, - session - ); - }, - (e) => { - assert.equal( - e?.response.data.data.field_messages.role?.message, - "Missing value for field 'role'." - ); - } - ); - }), - LONG_TEST_TIMEOUT - ); + it("rejects when given an empty role", async () => + withProdApp(async ({ app, rest_api }) => { + const [user, session] = await createAdmin(app, rest_api); + await TestUtils.assertThrowsAsync( + async () => { + return rest_api.post( + `/api/v1/collections/user-roles`, + { + user: user.id, + }, + session + ); + }, + (e) => { + assert.equal( + e?.response.data.data.field_messages.role?.message, + "Missing value for field 'role'." + ); + } + ); + })).timeout(LONG_TEST_TIMEOUT); it("accepts correct dataset", async () => withProdApp(async ({ app, base_url, rest_api }) => { diff --git a/src/back/jdd-components/components.ts b/src/back/jdd-components/components.ts deleted file mode 100644 index 9083292..0000000 --- a/src/back/jdd-components/components.ts +++ /dev/null @@ -1,25 +0,0 @@ -// DO NOT EDIT! This file is generated automaticaly with 'npm run generate-components' -import { Registry } from "@sealcode/jdd"; - -export const registry = new Registry(); - -import { AutoscrollingImages } from "./autoscrolling-images/autoscrolling-images.jdd.js"; -registry.add("autoscrolling-images", AutoscrollingImages); - -import { FaqComponent } from "./faq-component/faq-component.jdd.js"; -registry.add("faq-component", FaqComponent); - -import { HeaderWithImage } from "./header-with-image/header-with-image.jdd.js"; -registry.add("header-with-image", HeaderWithImage); - -import { ImageDemo } from "./image-demo/image-demo.jdd.js"; -registry.add("image-demo", ImageDemo); - -import { MapWithPins } from "./map-with-pins/map-with-pins.jdd.js"; -registry.add("map-with-pins", MapWithPins); - -import { NiceBox } from "./nice-box/nice-box.jdd.js"; -registry.add("nice-box", NiceBox); - -import { Table } from "./table/table.jdd.js"; -registry.add("table", Table); diff --git a/src/back/routes/hello.test.ts b/src/back/routes/hello.test.ts index a030e33..3e09b54 100644 --- a/src/back/routes/hello.test.ts +++ b/src/back/routes/hello.test.ts @@ -3,18 +3,14 @@ import { withProdApp } from "../test_utils/with-prod-app.js"; import { HelloURL } from "./urls.js"; describe("Hello", () => { - it( - "doesn't crash", - async function () { - return withProdApp(async ({ base_url, rest_api }) => { - await rest_api.get(HelloURL); - await webhintURL(base_url + HelloURL); - // alternatively you can use webhintHTML for faster but less precise scans - // or for scanning responses of requests that use some form of authorization: - // const response = await rest_api.get(HelloURL); - // await webhintHTML(response); - }); - }, - VERY_LONG_TEST_TIMEOUT - ); + it("doesn't crash", async function () { + return withProdApp(async ({ base_url, rest_api }) => { + await rest_api.get(HelloURL); + await webhintURL(base_url + HelloURL); + // alternatively you can use webhintHTML for faster but less precise scans + // or for scanning responses of requests that use some form of authorization: + // const response = await rest_api.get(HelloURL); + // await webhintHTML(response); + }); + }).timeout(VERY_LONG_TEST_TIMEOUT); }); diff --git a/src/back/routes/index.test.ts b/src/back/routes/index.test.ts index 4321845..f5aa3a8 100644 --- a/src/back/routes/index.test.ts +++ b/src/back/routes/index.test.ts @@ -2,12 +2,8 @@ import { VERY_LONG_TEST_TIMEOUT, webhintURL } from "../test_utils/webhint.js"; import { withProdApp } from "../test_utils/with-prod-app.js"; describe("homepage", function () { - it( - "passes webhint tests", - () => - withProdApp(async ({ base_url }) => { - await webhintURL(`${base_url}/`); - }), - VERY_LONG_TEST_TIMEOUT - ); + it("passes webhint tests", () => + withProdApp(async ({ base_url }) => { + await webhintURL(`${base_url}/`); + })).timeout(VERY_LONG_TEST_TIMEOUT); }); diff --git a/src/back/routes/logout.test.ts b/src/back/routes/logout.test.ts index eca27b4..4acbc21 100644 --- a/src/back/routes/logout.test.ts +++ b/src/back/routes/logout.test.ts @@ -5,7 +5,7 @@ import { LONG_TEST_TIMEOUT } from "../test_utils/webhint.js"; import { withProdApp } from "../test_utils/with-prod-app.js"; import { LogoutURL, SignInURL } from "./urls.js"; -describe.concurrent("Logout", () => { +describe("Logout", () => { let page: Page; let browser: Browser; let context: BrowserContext; @@ -23,23 +23,19 @@ describe.concurrent("Logout", () => { }); describe("logout test", () => { - it( - "logout", - async function () { - await withProdApp(async ({ base_url }) => { - await page.goto(base_url); - await page.getByRole("link", { name: "Sign in" }).click(); - await page.getByPlaceholder("text").click(); - await page.getByPlaceholder("text").fill(username); - await page.getByPlaceholder("text").press("Tab"); - await page.getByPlaceholder("password").fill(password); - await page.getByPlaceholder("password").press("Enter"); - await page.waitForSelector(`a[href="${LogoutURL}"]`); - await page.getByRole("link", { name: "Logout" }).click(); - await page.waitForSelector(`a[href="${SignInURL}"]`); - }); - }, - LONG_TEST_TIMEOUT - ); + it("logout", async function () { + await withProdApp(async ({ base_url }) => { + await page.goto(base_url); + await page.getByRole("link", { name: "Sign in" }).click(); + await page.getByPlaceholder("text").click(); + await page.getByPlaceholder("text").fill(username); + await page.getByPlaceholder("text").press("Tab"); + await page.getByPlaceholder("password").fill(password); + await page.getByPlaceholder("password").press("Enter"); + await page.waitForSelector(`a[href="${LogoutURL}"]`); + await page.getByRole("link", { name: "Logout" }).click(); + await page.waitForSelector(`a[href="${SignInURL}"]`); + }); + }).timeout(LONG_TEST_TIMEOUT); }); }); diff --git a/src/back/routes/routes.ts b/src/back/routes/routes.ts deleted file mode 100644 index 8825aff..0000000 --- a/src/back/routes/routes.ts +++ /dev/null @@ -1,21 +0,0 @@ -// DO NOT EDIT! This file is generated automaticaly with npm run generate-routes - -import type Router from "@koa/router"; -import { mount } from "@sealcode/sealgen"; -import * as URLs from "./urls.js"; - -import { default as Components } from "./components.sreact.js"; -import { default as Hello } from "./hello.page.js"; -import { default as Logout } from "./logout.redirect.js"; -import { default as SignIn } from "./signIn.form.js"; -import { default as SignUp } from "./signUp.form.js"; -import { default as Todo } from "./todo.form.js"; - -export default function mountAutoRoutes(router: Router) { - mount(router, URLs.ComponentsURL, Components); - mount(router, URLs.HelloURL, Hello); - mount(router, URLs.LogoutURL, Logout); - mount(router, URLs.SignInURL, SignIn); - mount(router, URLs.SignUpURL, SignUp); - mount(router, URLs.TodoURL, Todo); -} diff --git a/src/back/routes/signIn.test.ts b/src/back/routes/signIn.test.ts index 353f2b0..44646d3 100644 --- a/src/back/routes/signIn.test.ts +++ b/src/back/routes/signIn.test.ts @@ -8,105 +8,85 @@ describe("SignIn", () => { const username = ADMIN_CREDENTIALS.username; const password = ADMIN_CREDENTIALS.password; - it( - "doesn't crash", - async function () { - return withProdApp(async ({ base_url, rest_api }) => { - await rest_api.get(SignInURL); - await webhintURL(base_url + SignInURL); - // alternatively you can use webhintHTML for faster but less precise scans - // or for scanning responses of requests that use some form of authorization: - // const response = await rest_api.get(SignInURL); - // await webhintHTML(response); - }); - }, - VERY_LONG_TEST_TIMEOUT - ); + it("doesn't crash", async function () { + return withProdApp(async ({ base_url, rest_api }) => { + await rest_api.get(SignInURL); + await webhintURL(base_url + SignInURL); + // alternatively you can use webhintHTML for faster but less precise scans + // or for scanning responses of requests that use some form of authorization: + // const response = await rest_api.get(SignInURL); + // await webhintHTML(response); + }); + }).timeout(VERY_LONG_TEST_TIMEOUT); describe("can access test", () => { - it( - "access url", - async function () { - await withProdApp(async ({ base_url }) => { - const { context, page } = await getPage(); - await page.goto(base_url); - await page.getByRole("link", { name: "Sign in" }).click(); - await page.getByPlaceholder("text").click(); - await page.getByPlaceholder("text").fill(username); - await page.getByPlaceholder("text").press("Tab"); - await page.getByPlaceholder("password").fill(password); - await page.getByPlaceholder("password").press("Enter"); - await page.waitForSelector(`a[href="${LogoutURL}"]`); - await page.goto(base_url + SignInURL); - await page.waitForSelector('body:has-text("no access")'); - await page.goto(base_url); - await page.getByRole("link", { name: "Logout" }).click(); - await page.waitForSelector(`a[href="${SignInURL}"]`); - await context.close(); - }); - }, - VERY_LONG_TEST_TIMEOUT - ); + it("access url", async function () { + await withProdApp(async ({ base_url }) => { + const { context, page } = await getPage(); + await page.goto(base_url); + await page.getByRole("link", { name: "Sign in" }).click(); + await page.getByPlaceholder("text").click(); + await page.getByPlaceholder("text").fill(username); + await page.getByPlaceholder("text").press("Tab"); + await page.getByPlaceholder("password").fill(password); + await page.getByPlaceholder("password").press("Enter"); + await page.waitForSelector(`a[href="${LogoutURL}"]`); + await page.goto(base_url + SignInURL); + await page.waitForSelector('body:has-text("no access")'); + await page.goto(base_url); + await page.getByRole("link", { name: "Logout" }).click(); + await page.waitForSelector(`a[href="${SignInURL}"]`); + await context.close(); + }); + }).timeout(VERY_LONG_TEST_TIMEOUT); }); describe("sign in test", () => { - it( - "wrong username", - async function () { - await withProdApp(async ({ base_url }) => { - const { context, page } = await getPage(); - await page.goto(base_url); - await page.getByRole("link", { name: "Sign in" }).click(); - await page.getByPlaceholder("text").click(); - await page.getByPlaceholder("text").fill("username20230720722"); - await page.getByPlaceholder("text").press("Tab"); - await page.getByPlaceholder("password").fill("test"); - await page.getByPlaceholder("password").press("Enter"); - await page.waitForSelector(".form-message"); - await context.close(); - }); - }, - VERY_LONG_TEST_TIMEOUT - ); + it("wrong username", async function () { + await withProdApp(async ({ base_url }) => { + const { context, page } = await getPage(); + await page.goto(base_url); + await page.getByRole("link", { name: "Sign in" }).click(); + await page.getByPlaceholder("text").click(); + await page.getByPlaceholder("text").fill("username20230720722"); + await page.getByPlaceholder("text").press("Tab"); + await page.getByPlaceholder("password").fill("test"); + await page.getByPlaceholder("password").press("Enter"); + await page.waitForSelector(".form-message"); + await context.close(); + }); + }).timeout(VERY_LONG_TEST_TIMEOUT); - it( - "correct username and password", - async function () { - await withProdApp(async ({ base_url }) => { - const { context, page } = await getPage(); - await page.goto(base_url); - await page.getByRole("link", { name: "Sign in" }).click(); - await page.getByPlaceholder("text").click(); - await page.getByPlaceholder("text").fill(username); - await page.getByPlaceholder("text").press("Tab"); - await page.getByPlaceholder("password").fill(password); - await page.getByPlaceholder("password").press("Enter"); - await page.waitForSelector(`a[href="${LogoutURL}"]`); - await page.getByRole("link", { name: "Logout" }).click(); - await page.waitForSelector(`a[href="${SignInURL}"]`); - await context.close(); - }); - }, - VERY_LONG_TEST_TIMEOUT - ); + it("correct username and password", async function () { + await withProdApp(async ({ base_url }) => { + const { context, page } = await getPage(); + await page.goto(base_url); + await page.getByRole("link", { name: "Sign in" }).click(); + await page.getByPlaceholder("text").click(); + await page.getByPlaceholder("text").fill(username); + await page.getByPlaceholder("text").press("Tab"); + await page.getByPlaceholder("password").fill(password); + await page.getByPlaceholder("password").press("Enter"); + await page.waitForSelector(`a[href="${LogoutURL}"]`); + await page.getByRole("link", { name: "Logout" }).click(); + await page.waitForSelector(`a[href="${SignInURL}"]`); + await context.close(); + }); + }).timeout(VERY_LONG_TEST_TIMEOUT); - it( - "wrong password", - async function () { - await withProdApp(async ({ base_url }) => { - const { context, page } = await getPage(); - await page.goto(base_url); - await page.getByRole("link", { name: "Sign in" }).click(); - await page.getByPlaceholder("text").click(); - await page.getByPlaceholder("text").fill(username); - await page.getByPlaceholder("text").press("Tab"); - await page.getByPlaceholder("password").fill("asddasads20230720722"); - await page.getByPlaceholder("password").press("Enter"); - await page.waitForSelector(".form-message"); - await context.close(); - }); - }, - VERY_LONG_TEST_TIMEOUT - ); + it("wrong password", async function () { + await withProdApp(async ({ base_url }) => { + const { context, page } = await getPage(); + await page.goto(base_url); + await page.getByRole("link", { name: "Sign in" }).click(); + await page.getByPlaceholder("text").click(); + await page.getByPlaceholder("text").fill(username); + await page.getByPlaceholder("text").press("Tab"); + await page.getByPlaceholder("password").fill("asddasads20230720722"); + await page.getByPlaceholder("password").press("Enter"); + await page.waitForSelector(".form-message"); + await context.close(); + }); + }).timeout(VERY_LONG_TEST_TIMEOUT); }); }); diff --git a/src/back/routes/signUp.test.ts b/src/back/routes/signUp.test.ts index d5d87e8..ba8634f 100644 --- a/src/back/routes/signUp.test.ts +++ b/src/back/routes/signUp.test.ts @@ -6,16 +6,12 @@ import { withProdApp } from "../test_utils/with-prod-app.js"; import { LogoutURL, SignInURL, SignUpURL } from "./urls.js"; describe("SignUp webhint", () => { - it( - "doesn't crash", - async function () { - return withProdApp(async ({ base_url, rest_api }) => { - await rest_api.get(SignUpURL); - await webhintURL(base_url + SignUpURL); - }); - }, - VERY_LONG_TEST_TIMEOUT - ); + it("doesn't crash", async function () { + return withProdApp(async ({ base_url, rest_api }) => { + await rest_api.get(SignUpURL); + await webhintURL(base_url + SignUpURL); + }); + }).timeout(VERY_LONG_TEST_TIMEOUT); }); describe("SignUp", () => { @@ -37,109 +33,85 @@ describe("SignUp", () => { }); describe("signup test", () => { - it( - "username is taken", - async function () { - await withProdApp(async ({ base_url }) => { - await page.goto(base_url); - await page.getByRole("link", { name: "Sign up" }).click(); - await page.getByPlaceholder("text").click(); - await page.getByPlaceholder("text").fill(username); - await page.getByPlaceholder("text").press("Tab"); - await page - .getByPlaceholder("email") - .fill("user0192939@randomsuper.com"); - await page.getByPlaceholder("email").press("Tab"); - await page.getByPlaceholder("password").fill("user12341234"); - await page.getByRole("button", { name: "Wyślij" }).click(); - await page.waitForSelector(".input__error"); - }); - }, - VERY_LONG_TEST_TIMEOUT - ); + it("username is taken", async function () { + await withProdApp(async ({ base_url }) => { + await page.goto(base_url); + await page.getByRole("link", { name: "Sign up" }).click(); + await page.getByPlaceholder("text").click(); + await page.getByPlaceholder("text").fill(username); + await page.getByPlaceholder("text").press("Tab"); + await page.getByPlaceholder("email").fill("user0192939@randomsuper.com"); + await page.getByPlaceholder("email").press("Tab"); + await page.getByPlaceholder("password").fill("user12341234"); + await page.getByRole("button", { name: "Wyślij" }).click(); + await page.waitForSelector(".input__error"); + }); + }).timeout(VERY_LONG_TEST_TIMEOUT); - it( - "password is too shot ", - async function () { - await withProdApp(async ({ base_url }) => { - await page.goto(base_url); - await page.getByRole("link", { name: "Sign up" }).click(); - await page.getByPlaceholder("text").click(); - await page.getByPlaceholder("text").fill("dasdsa"); - await page.getByPlaceholder("email").click(); - await page - .getByPlaceholder("email") - .fill("asasdsdadsadss123asddsa@asdasca.com"); - await page.getByPlaceholder("password").click(); - await page.getByPlaceholder("password").fill("asddsa"); - await page.getByRole("button", { name: "Wyślij" }).click(); - await page.waitForSelector(".form-message.form-message--error"); - }); - }, - VERY_LONG_TEST_TIMEOUT - ); + it("password is too shot ", async function () { + await withProdApp(async ({ base_url }) => { + await page.goto(base_url); + await page.getByRole("link", { name: "Sign up" }).click(); + await page.getByPlaceholder("text").click(); + await page.getByPlaceholder("text").fill("dasdsa"); + await page.getByPlaceholder("email").click(); + await page + .getByPlaceholder("email") + .fill("asasdsdadsadss123asddsa@asdasca.com"); + await page.getByPlaceholder("password").click(); + await page.getByPlaceholder("password").fill("asddsa"); + await page.getByRole("button", { name: "Wyślij" }).click(); + await page.waitForSelector(".form-message.form-message--error"); + }); + }).timeout(VERY_LONG_TEST_TIMEOUT); - it( - "email is taken", - async function () { - await withProdApp(async ({ base_url }) => { - await page.goto(base_url); - await page.getByRole("link", { name: "Sign up" }).click(); - await page.getByPlaceholder("text").click(); - await page.getByPlaceholder("text").fill("ranomusername2023072722"); - await page.getByPlaceholder("text").press("Tab"); - await page.getByPlaceholder("email").fill(email); - await page.getByPlaceholder("email").press("Tab"); - await page.getByPlaceholder("password").fill("asdasdasdasdasd"); - await page.getByRole("button", { name: "Wyślij" }).click(); - await page.waitForSelector(".form-message.form-message--error"); - }); - }, - VERY_LONG_TEST_TIMEOUT - ); + it("email is taken", async function () { + await withProdApp(async ({ base_url }) => { + await page.goto(base_url); + await page.getByRole("link", { name: "Sign up" }).click(); + await page.getByPlaceholder("text").click(); + await page.getByPlaceholder("text").fill("ranomusername2023072722"); + await page.getByPlaceholder("text").press("Tab"); + await page.getByPlaceholder("email").fill(email); + await page.getByPlaceholder("email").press("Tab"); + await page.getByPlaceholder("password").fill("asdasdasdasdasd"); + await page.getByRole("button", { name: "Wyślij" }).click(); + await page.waitForSelector(".form-message.form-message--error"); + }); + }).timeout(VERY_LONG_TEST_TIMEOUT); - it( - "correct", - async function () { - await withProdApp(async ({ base_url }) => { - await page.goto(base_url); - await page.getByRole("link", { name: "Sign up" }).click(); - await page.getByPlaceholder("text").click(); - await page.getByPlaceholder("text").fill("ranomusername20230720722"); - await page.getByPlaceholder("text").press("Tab"); - await page - .getByPlaceholder("email") - .fill("radomemail@emailrandom.com"); - await page.getByPlaceholder("email").press("Tab"); - await page.getByPlaceholder("password").fill("asdasdasdasdasd"); - await page.getByRole("button", { name: "Wyślij" }).click(); - await page.waitForSelector(".success-notify"); - }); - }, - VERY_LONG_TEST_TIMEOUT - ); + it("correct", async function () { + await withProdApp(async ({ base_url }) => { + await page.goto(base_url); + await page.getByRole("link", { name: "Sign up" }).click(); + await page.getByPlaceholder("text").click(); + await page.getByPlaceholder("text").fill("ranomusername20230720722"); + await page.getByPlaceholder("text").press("Tab"); + await page.getByPlaceholder("email").fill("radomemail@emailrandom.com"); + await page.getByPlaceholder("email").press("Tab"); + await page.getByPlaceholder("password").fill("asdasdasdasdasd"); + await page.getByRole("button", { name: "Wyślij" }).click(); + await page.waitForSelector(".success-notify"); + }); + }).timeout(VERY_LONG_TEST_TIMEOUT); }); describe("can access test", () => { - it( - "access url", - async function () { - await withProdApp(async ({ base_url }) => { - await page.goto(base_url); - await page.getByRole("link", { name: "Sign in" }).click(); - await page.getByPlaceholder("text").click(); - await page.getByPlaceholder("text").fill(username); - await page.getByPlaceholder("text").press("Tab"); - await page.getByPlaceholder("password").fill(password); - await page.getByPlaceholder("password").press("Enter"); - await page.waitForSelector(`a[href="${LogoutURL}"]`); - await page.goto(base_url + SignUpURL); - await page.waitForSelector('body:has-text("no access")'); - await page.goto(base_url); - await page.getByRole("link", { name: "Logout" }).click(); - await page.waitForSelector(`a[href="${SignInURL}"]`); - }); - }, - VERY_LONG_TEST_TIMEOUT - ); + it("access url", async function () { + await withProdApp(async ({ base_url }) => { + await page.goto(base_url); + await page.getByRole("link", { name: "Sign in" }).click(); + await page.getByPlaceholder("text").click(); + await page.getByPlaceholder("text").fill(username); + await page.getByPlaceholder("text").press("Tab"); + await page.getByPlaceholder("password").fill(password); + await page.getByPlaceholder("password").press("Enter"); + await page.waitForSelector(`a[href="${LogoutURL}"]`); + await page.goto(base_url + SignUpURL); + await page.waitForSelector('body:has-text("no access")'); + await page.goto(base_url); + await page.getByRole("link", { name: "Logout" }).click(); + await page.waitForSelector(`a[href="${SignInURL}"]`); + }); + }).timeout(VERY_LONG_TEST_TIMEOUT); }); }); diff --git a/src/back/routes/todo.test.ts b/src/back/routes/todo.test.ts index 1373677..6bc1492 100644 --- a/src/back/routes/todo.test.ts +++ b/src/back/routes/todo.test.ts @@ -7,25 +7,21 @@ import { withProdApp } from "../test_utils/with-prod-app.js"; import { SignInURL, TodoURL } from "./urls.js"; describe("Todo webhint", () => { - it( - "doesn't crash", - async function () { - return withProdApp(async ({ rest_api }) => { - await assert.rejects( - async () => { - await rest_api.get(TodoURL); + it("doesn't crash", async function () { + return withProdApp(async ({ rest_api }) => { + await assert.rejects( + async () => { + await rest_api.get(TodoURL); + }, + { + response: { + data: "no access", + status: 403, }, - { - response: { - data: "no access", - status: 403, - }, - } - ); - }); - }, - VERY_LONG_TEST_TIMEOUT - ); + } + ); + }); + }).timeout(VERY_LONG_TEST_TIMEOUT); }); describe("Todo", function () { @@ -46,54 +42,44 @@ describe("Todo", function () { }); describe("todo test", () => { - it( - "create and delete task", - async function () { - await withProdApp(async ({ base_url }) => { - await page.goto(base_url); - await page.getByRole("link", { name: "Sign in" }).click(); - await page.getByPlaceholder("text").click(); - await page.getByPlaceholder("text").fill(username); - await page.getByPlaceholder("text").press("Tab"); - await page.getByPlaceholder("password").fill(password); - await page.getByPlaceholder("password").press("Enter"); - await page.getByRole("link", { name: "To do app" }).click(); - await page.getByPlaceholder("Write an Matrix bot").click(); - await page - .getByPlaceholder("Write an Matrix bot") - .fill("randomtasdk"); - await page.getByRole("button", { name: "Wyślij" }).click(); - await page.waitForSelector(".form-message.form-message--success"); - await page.locator("turbo-frame").getByRole("checkbox").check(); - await page.locator("turbo-frame").getByRole("checkbox").uncheck(); - await page - .locator("turbo-frame") - .getByRole("button", { name: "Delete" }) - .click(); - await page.getByRole("link", { name: "Logout" }).click(); - await page.waitForSelector(`a[href="${SignInURL}"]`); - }); - }, - VERY_LONG_TEST_TIMEOUT - ); + it("create and delete task", async function () { + await withProdApp(async ({ base_url }) => { + await page.goto(base_url); + await page.getByRole("link", { name: "Sign in" }).click(); + await page.getByPlaceholder("text").click(); + await page.getByPlaceholder("text").fill(username); + await page.getByPlaceholder("text").press("Tab"); + await page.getByPlaceholder("password").fill(password); + await page.getByPlaceholder("password").press("Enter"); + await page.getByRole("link", { name: "To do app" }).click(); + await page.getByPlaceholder("Write an Matrix bot").click(); + await page.getByPlaceholder("Write an Matrix bot").fill("randomtasdk"); + await page.getByRole("button", { name: "Wyślij" }).click(); + await page.waitForSelector(".form-message.form-message--success"); + await page.locator("turbo-frame").getByRole("checkbox").check(); + await page.locator("turbo-frame").getByRole("checkbox").uncheck(); + await page + .locator("turbo-frame") + .getByRole("button", { name: "Delete" }) + .click(); + await page.getByRole("link", { name: "Logout" }).click(); + await page.waitForSelector(`a[href="${SignInURL}"]`); + }); + }).timeout(VERY_LONG_TEST_TIMEOUT); }); describe("can access test", () => { - it( - "access url", - async function () { - await withProdApp(async ({ base_url }) => { - await page.goto(base_url); - try { - await page.waitForSelector(`a[href="${SignInURL}"]`); - await page.goto(base_url + TodoURL); - await page.waitForSelector('body:has-text("no access")'); - } catch (error) { - console.error(error); - } - }); - }, - LONG_TEST_TIMEOUT - ); + it("access url", async function () { + await withProdApp(async ({ base_url }) => { + await page.goto(base_url); + try { + await page.waitForSelector(`a[href="${SignInURL}"]`); + await page.goto(base_url + TodoURL); + await page.waitForSelector('body:has-text("no access")'); + } catch (error) { + console.error(error); + } + }); + }).timeout(LONG_TEST_TIMEOUT); }); }); diff --git a/src/back/routes/urls.ts b/src/back/routes/urls.ts deleted file mode 100644 index 72d8c70..0000000 --- a/src/back/routes/urls.ts +++ /dev/null @@ -1,6 +0,0 @@ -export const ComponentsURL = "/components/"; -export const HelloURL = "/hello/"; -export const LogoutURL = "/logout/"; -export const SignInURL = "/signIn/"; -export const SignUpURL = "/signUp/"; -export const TodoURL = "/todo/"; diff --git a/src/back/test-teardown.ts b/src/back/test-teardown.ts deleted file mode 100644 index 09cee6a..0000000 --- a/src/back/test-teardown.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { closeBrowser } from "./test_utils/browser-creator.js"; - -afterAll(async () => { - await closeBrowser(); -}); diff --git a/src/back/test_utils/webhint.ts b/src/back/test_utils/webhint.ts index 663c059..e3112fd 100644 --- a/src/back/test_utils/webhint.ts +++ b/src/back/test_utils/webhint.ts @@ -1,5 +1,6 @@ import _locreq from "locreq"; -const locreq = _locreq(__dirname); +import { module_dirname } from "../utils/module_dirname.js"; +const locreq = _locreq(module_dirname(import.meta.url)); import { spawn } from "child_process"; import { hasShape, is, predicates } from "@sealcode/ts-predicates"; import { promises as fs } from "fs"; diff --git a/src/back/vitest.config.ts b/src/back/vitest.config.ts deleted file mode 100644 index a1b4547..0000000 --- a/src/back/vitest.config.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { defineConfig } from "vitest/config"; - -// we're testing from the build 'dist' directory -const exclude = ["docker_node_modules", "node_modules", "src", "lib", "webhint"]; - -export default defineConfig({ - test: { - testTimeout: 10000, - setupFiles: ["src/back/test-teardown.ts"], - exclude, - globals: true, - coverage: { - exclude, - enabled: true, - all: true, - include: ["dist/**"], - }, - }, -}); diff --git a/src/includes.css b/src/includes.css deleted file mode 100644 index cde892c..0000000 --- a/src/includes.css +++ /dev/null @@ -1,14 +0,0 @@ -/* DO NOT EDIT! This file is generated automaticaly with npx sealgen generate-css-includes */ - -@import "../node_modules/@sealcode/sealgen/src/forms/forms.css"; -@import "back/jdd-components/autoscrolling-images/autoscrolling-images.css"; -@import "back/jdd-components/faq-component/faq-component.css"; -@import "back/jdd-components/header-with-image/header-with-image.css"; -@import "back/jdd-components/image-demo/image-demo.css"; -@import "back/jdd-components/map-with-pins/map-with-pins.css"; -@import "back/jdd-components/nice-box/nice-box.css"; -@import "back/jdd-components/table/table.css"; -@import "back/routes/common/ui/input.css"; -@import "back/routes/components.css"; -@import "colors.css"; -@import "tables.css"; diff --git a/test.cjs b/test.cjs new file mode 100644 index 0000000..dfecbfc --- /dev/null +++ b/test.cjs @@ -0,0 +1,54 @@ +const mri = require("mri"); +const { spawn } = require("child_process"); + +const argv = process.argv.slice(2); +const args = mri(argv); + +const bin_dir = "./node_modules/.bin/"; + +const mocha = bin_dir + "mocha"; + +let mocha_options = [ + "--recursive", + "--timeout=100000", + "--require", + "source-map-support/register", + "--exit", +]; + +if (args["test-report"]) { + mocha_options = [ + ...mocha_options, + // "--require", + // "ts-node/register", + // "--require", + // "./src/http/type-overrides.ts", + "--reporter", + "xunit", + "--reporter-option", + "output=.xunit", + ]; +} + +const mocha_files = ["dist/**/*.test.js"]; + +let command = [mocha, ...mocha_options, ...mocha_files]; + +if (args.debug) { + command = ["node", "inspect", ...command]; +} + +console.log("spawning mocha...", command.join(" ")); + +const proc = spawn(command[0], command.slice(1), { + stdio: "inherit", + env: process.env, +}); + +proc.on("exit", function (code) { + if (args["test-report"]) { + process.exit(0); + } else { + process.exit(code); + } +}); diff --git a/tsconfig-back.json b/tsconfig-back.json index 6b0ecdc..9a7f386 100644 --- a/tsconfig-back.json +++ b/tsconfig-back.json @@ -16,8 +16,7 @@ "allowJs": true, "resolveJsonModule": true, "sourceMap": true, - "skipLibCheck": true, - "types": ["vitest/globals"] + "skipLibCheck": true }, "include": ["./src/back/*", "./src/back/**/*", "./src/back/routes/common/navbar.ts"], "exclude": ["./src/front", "./src/**/*.stimulus.ts"],