diff --git a/.eslintignore b/.eslintignore index 3897265..5168214 100644 --- a/.eslintignore +++ b/.eslintignore @@ -6,6 +6,7 @@ node_modules .env .env.* !.env.example +/dist # Ignore files for PNPM, NPM and YARN pnpm-lock.yaml diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 8304ad3..48f0c30 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -27,5 +27,6 @@ module.exports = { parser: '@typescript-eslint/parser' } } - ] + ], + rules: { 'svelte/no-at-html-tags': 'off' } }; diff --git a/.gitignore b/.gitignore index 23856ec..6f79574 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,4 @@ node_modules vite.config.js.timestamp-* vite.config.ts.timestamp-* test-results -coverage +/coverage diff --git a/package-lock.json b/package-lock.json index b121f02..d15f253 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,12 +18,15 @@ "@sveltejs/package": "^2.0.0", "@testing-library/jest-dom": "^6.1.5", "@testing-library/svelte": "^4.0.5", + "@types/sanitize-html": "^2.9.5", "@typescript-eslint/eslint-plugin": "^6.0.0", "@typescript-eslint/parser": "^6.0.0", "@vitest/coverage-v8": "^1.0.4", + "@vitest/ui": "^1.0.4", "eslint": "^8.28.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-svelte": "^2.30.0", + "jsdom": "^23.0.1", "prettier": "^3.1.1", "prettier-plugin-svelte": "^3.1.2", "publint": "^0.1.9", @@ -1088,29 +1091,7 @@ "vite": "^4.0.0" } }, - "node_modules/@sveltejs/package": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/@sveltejs/package/-/package-2.2.3.tgz", - "integrity": "sha512-iZEC5qw+2RIjfIAHR3O+IeokJIjVM/ieoxPxj6YmZCwu5JKFADtC4jzjSUJ7GkCMUQ4HqE7u4/3cCxXBocxi8A==", - "dev": true, - "dependencies": { - "chokidar": "^3.5.3", - "kleur": "^4.1.5", - "sade": "^1.8.1", - "semver": "^7.5.3", - "svelte2tsx": "~0.6.19" - }, - "bin": { - "svelte-package": "svelte-package.js" - }, - "engines": { - "node": "^16.14 || >=18" - }, - "peerDependencies": { - "svelte": "^3.44.0 || ^4.0.0" - } - }, - "node_modules/@sveltejs/vite-plugin-svelte": { + "node_modules/@sveltejs/kit/node_modules/@sveltejs/vite-plugin-svelte": { "version": "2.5.3", "resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte/-/vite-plugin-svelte-2.5.3.tgz", "integrity": "sha512-erhNtXxE5/6xGZz/M9eXsmI7Pxa6MS7jyTy06zN3Ck++ldrppOnOlJwHHTsMC7DHDQdgUp4NAc4cDNQ9eGdB/w==", @@ -1132,7 +1113,7 @@ "vite": "^4.0.0" } }, - "node_modules/@sveltejs/vite-plugin-svelte-inspector": { + "node_modules/@sveltejs/kit/node_modules/@sveltejs/vite-plugin-svelte/node_modules/@sveltejs/vite-plugin-svelte-inspector": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte-inspector/-/vite-plugin-svelte-inspector-1.0.4.tgz", "integrity": "sha512-zjiuZ3yydBtwpF3bj0kQNV0YXe+iKE545QGZVTaylW3eAzFr+pJ/cwK8lZEaRp4JtaJXhD5DyWAV4AxLh6DgaQ==", @@ -1149,6 +1130,28 @@ "vite": "^4.0.0" } }, + "node_modules/@sveltejs/package": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/@sveltejs/package/-/package-2.2.3.tgz", + "integrity": "sha512-iZEC5qw+2RIjfIAHR3O+IeokJIjVM/ieoxPxj6YmZCwu5JKFADtC4jzjSUJ7GkCMUQ4HqE7u4/3cCxXBocxi8A==", + "dev": true, + "dependencies": { + "chokidar": "^3.5.3", + "kleur": "^4.1.5", + "sade": "^1.8.1", + "semver": "^7.5.3", + "svelte2tsx": "~0.6.19" + }, + "bin": { + "svelte-package": "svelte-package.js" + }, + "engines": { + "node": "^16.14 || >=18" + }, + "peerDependencies": { + "svelte": "^3.44.0 || ^4.0.0" + } + }, "node_modules/@testing-library/dom": { "version": "9.3.3", "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-9.3.3.tgz", @@ -1325,6 +1328,15 @@ "integrity": "sha512-Sk/uYFOBAB7mb74XcpizmH0KOR2Pv3D2Hmrh1Dmy5BmK3MpdSa5kqZcg6EKBdklU0bFXX9gCfzvpnyUehrPIuA==", "dev": true }, + "node_modules/@types/sanitize-html": { + "version": "2.9.5", + "resolved": "https://registry.npmjs.org/@types/sanitize-html/-/sanitize-html-2.9.5.tgz", + "integrity": "sha512-2Sr1vd8Dw+ypsg/oDDfZ57OMSG2Befs+l2CMyCC5bVSK3CpE7lTB2aNlbbWzazgVA+Qqfuholwom6x/mWd1qmw==", + "dev": true, + "dependencies": { + "htmlparser2": "^8.0.0" + } + }, "node_modules/@types/semver": { "version": "7.5.6", "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.6.tgz", @@ -1634,6 +1646,27 @@ "url": "https://opencollective.com/vitest" } }, + "node_modules/@vitest/ui": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@vitest/ui/-/ui-1.0.4.tgz", + "integrity": "sha512-gd4p6e7pjukSe4joWS5wpnm/JcEfzCZUYkYWQOORqJK1mDJ0MOaXa/9BbPOEVO5TcvdnKvFJUdJpFHnqoyYwZA==", + "dev": true, + "dependencies": { + "@vitest/utils": "1.0.4", + "fast-glob": "^3.3.2", + "fflate": "^0.8.1", + "flatted": "^3.2.9", + "pathe": "^1.1.1", + "picocolors": "^1.0.0", + "sirv": "^2.0.3" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "vitest": "^1.0.0" + } + }, "node_modules/@vitest/utils": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-1.0.4.tgz", @@ -1683,8 +1716,6 @@ "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.0.tgz", "integrity": "sha512-o/zjMZRhJxny7OyEF+Op8X+efiELC7k7yOjMzgfzVqOzXqkBkWI79YoTdOtsuWd5BWhAGAuOY/Xa6xpiaWXiNg==", "dev": true, - "optional": true, - "peer": true, "dependencies": { "debug": "^4.3.4" }, @@ -1795,9 +1826,7 @@ "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "node_modules/available-typed-arrays": { "version": "1.0.5", @@ -2007,8 +2036,6 @@ "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", "dev": true, - "optional": true, - "peer": true, "dependencies": { "delayed-stream": "~1.0.0" }, @@ -2087,8 +2114,6 @@ "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-3.0.0.tgz", "integrity": "sha512-N4u2ABATi3Qplzf0hWbVCdjenim8F3ojEXpBDF5hBpjzW182MjNGLqfmQ0SkSPeQ+V86ZXgeH8aXj6kayd4jgg==", "dev": true, - "optional": true, - "peer": true, "dependencies": { "rrweb-cssom": "^0.6.0" }, @@ -2101,8 +2126,6 @@ "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-5.0.0.tgz", "integrity": "sha512-ZYP5VBHshaDAiVZxjbRVcFJpc+4xGgT0bK3vzy1HLN8jTO975HEbuYzZJcHoQEY5K1a0z8YayJkyVETa08eNTg==", "dev": true, - "optional": true, - "peer": true, "dependencies": { "whatwg-mimetype": "^4.0.0", "whatwg-url": "^14.0.0" @@ -2132,9 +2155,7 @@ "version": "10.4.3", "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.3.tgz", "integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "node_modules/dedent-js": { "version": "1.0.1", @@ -2236,8 +2257,6 @@ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", "dev": true, - "optional": true, - "peer": true, "engines": { "node": ">=0.4.0" } @@ -2747,6 +2766,12 @@ "reusify": "^1.0.4" } }, + "node_modules/fflate": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.8.1.tgz", + "integrity": "sha512-/exOvEuc+/iaUm105QIiOt4LpBdMTWsXxqR0HDF35vx3fmaKzw7354gTilCh5rkzEt8WYyG//ku3h3nRmd7CHQ==", + "dev": true + }, "node_modules/file-entry-cache": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", @@ -2821,8 +2846,6 @@ "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", "dev": true, - "optional": true, - "peer": true, "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", @@ -3115,8 +3138,6 @@ "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-4.0.0.tgz", "integrity": "sha512-Y22oTqIU4uuPgEemfz7NDJz6OeKf12Lsu+QC+s3BVpda64lTiMYCyGwg5ki4vFxkMwQdeZDl2adZoqUgdFuTgQ==", "dev": true, - "optional": true, - "peer": true, "dependencies": { "whatwg-encoding": "^3.1.1" }, @@ -3153,8 +3174,6 @@ "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.0.tgz", "integrity": "sha512-+ZT+iBxVUQ1asugqnD6oWoRiS25AkjNfG085dKJGtGxkdwLQrMKU5wJr2bOOFAXzKcTuqq+7fZlTMgG3SRfIYQ==", "dev": true, - "optional": true, - "peer": true, "dependencies": { "agent-base": "^7.1.0", "debug": "^4.3.4" @@ -3168,8 +3187,6 @@ "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.2.tgz", "integrity": "sha512-NmLNjm6ucYwtcUmL7JQC1ZQ57LmHP4lT15FQ8D61nak1rO6DH+fz5qNK2Ap5UN4ZapYICE3/0KodcLYSPsPbaA==", "dev": true, - "optional": true, - "peer": true, "dependencies": { "agent-base": "^7.0.2", "debug": "4" @@ -3192,8 +3209,6 @@ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", "dev": true, - "optional": true, - "peer": true, "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" }, @@ -3479,9 +3494,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "node_modules/is-reference": { "version": "3.0.2", @@ -3693,8 +3706,6 @@ "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-23.0.1.tgz", "integrity": "sha512-2i27vgvlUsGEBO9+/kJQRbtqtm+191b5zAZrU/UezVmnC2dlDAFLgDYJvAEi94T4kjsRKkezEtLQTgsNEsW2lQ==", "dev": true, - "optional": true, - "peer": true, "dependencies": { "cssstyle": "^3.0.0", "data-urls": "^5.0.0", @@ -3976,8 +3987,6 @@ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", "dev": true, - "optional": true, - "peer": true, "engines": { "node": ">= 0.6" } @@ -3987,8 +3996,6 @@ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", "dev": true, - "optional": true, - "peer": true, "dependencies": { "mime-db": "1.52.0" }, @@ -4198,9 +4205,7 @@ "version": "2.2.7", "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.7.tgz", "integrity": "sha512-ub5E4+FBPKwAZx0UwIQOjYWGHTEq5sPqHQNRN8Z9e4A7u3Tj1weLJsL59yH9vmvqEtBHaOmT6cYQKIZOxp35FQ==", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "node_modules/object-inspect": { "version": "1.13.1", @@ -4347,8 +4352,6 @@ "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz", "integrity": "sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==", "dev": true, - "optional": true, - "peer": true, "dependencies": { "entities": "^4.4.0" }, @@ -4675,9 +4678,7 @@ "version": "1.9.0", "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "node_modules/publint": { "version": "0.1.16", @@ -4712,9 +4713,7 @@ "version": "2.2.0", "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "node_modules/queue-microtask": { "version": "1.2.3", @@ -4794,9 +4793,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "node_modules/resolve-from": { "version": "4.0.0", @@ -4872,9 +4869,7 @@ "version": "0.6.0", "resolved": "https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.6.0.tgz", "integrity": "sha512-APM0Gt1KoXBz0iIkkdB/kfvGOwC4UuJFeG/c+yV7wSc7q96cG/kJ0HiYCnzivD9SB53cLV1MlHFNfOuPaadYSw==", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "node_modules/run-parallel": { "version": "1.2.0", @@ -4915,9 +4910,7 @@ "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "node_modules/sander": { "version": "0.5.1", @@ -4981,8 +4974,6 @@ "resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz", "integrity": "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==", "dev": true, - "optional": true, - "peer": true, "dependencies": { "xmlchars": "^2.2.0" }, @@ -5409,9 +5400,7 @@ "version": "3.2.4", "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "node_modules/test-exclude": { "version": "6.0.0", @@ -5522,8 +5511,6 @@ "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.3.tgz", "integrity": "sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==", "dev": true, - "optional": true, - "peer": true, "dependencies": { "psl": "^1.1.33", "punycode": "^2.1.1", @@ -5539,8 +5526,6 @@ "resolved": "https://registry.npmjs.org/tr46/-/tr46-5.0.0.tgz", "integrity": "sha512-tk2G5R2KRwBd+ZN0zaEXpmzdKyOYksXwywulIX95MBODjSzMIuQnQ3m8JxgbhnL1LeVo7lqQKsYa1O3Htl7K5g==", "dev": true, - "optional": true, - "peer": true, "dependencies": { "punycode": "^2.3.1" }, @@ -5643,8 +5628,6 @@ "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==", "dev": true, - "optional": true, - "peer": true, "engines": { "node": ">= 4.0.0" } @@ -5663,8 +5646,6 @@ "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", "dev": true, - "optional": true, - "peer": true, "dependencies": { "querystringify": "^2.1.1", "requires-port": "^1.0.0" @@ -6186,9 +6167,9 @@ } }, "node_modules/vite-node/node_modules/vite": { - "version": "5.0.8", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.0.8.tgz", - "integrity": "sha512-jYMALd8aeqR3yS9xlHd0OzQJndS9fH5ylVgWdB+pxTwxLKdO1pgC5Dlb398BUxpfaBxa4M9oT7j1g503Gaj5IQ==", + "version": "5.0.9", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.0.9.tgz", + "integrity": "sha512-wVqMd5kp28QWGgfYPDfrj771VyHTJ4UDlCteLH7bJDGDEamaz5hV8IX6h1brSGgnnyf9lI2RnzXq/JmD0c2wwg==", "dev": true, "dependencies": { "esbuild": "^0.19.3", @@ -6739,9 +6720,9 @@ } }, "node_modules/vitest/node_modules/vite": { - "version": "5.0.8", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.0.8.tgz", - "integrity": "sha512-jYMALd8aeqR3yS9xlHd0OzQJndS9fH5ylVgWdB+pxTwxLKdO1pgC5Dlb398BUxpfaBxa4M9oT7j1g503Gaj5IQ==", + "version": "5.0.9", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.0.9.tgz", + "integrity": "sha512-wVqMd5kp28QWGgfYPDfrj771VyHTJ4UDlCteLH7bJDGDEamaz5hV8IX6h1brSGgnnyf9lI2RnzXq/JmD0c2wwg==", "dev": true, "dependencies": { "esbuild": "^0.19.3", @@ -6798,8 +6779,6 @@ "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-5.0.0.tgz", "integrity": "sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA==", "dev": true, - "optional": true, - "peer": true, "dependencies": { "xml-name-validator": "^5.0.0" }, @@ -6812,8 +6791,6 @@ "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", "dev": true, - "optional": true, - "peer": true, "engines": { "node": ">=12" } @@ -6823,8 +6800,6 @@ "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-3.1.1.tgz", "integrity": "sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==", "dev": true, - "optional": true, - "peer": true, "dependencies": { "iconv-lite": "0.6.3" }, @@ -6837,8 +6812,6 @@ "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-4.0.0.tgz", "integrity": "sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==", "dev": true, - "optional": true, - "peer": true, "engines": { "node": ">=18" } @@ -6848,8 +6821,6 @@ "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-14.0.0.tgz", "integrity": "sha512-1lfMEm2IEr7RIV+f4lUNPOqfFL+pO+Xw3fJSqmjX9AbXcXcYOkCe1P6+9VBZB6n94af16NfZf+sSk0JCBZC9aw==", "dev": true, - "optional": true, - "peer": true, "dependencies": { "tr46": "^5.0.0", "webidl-conversions": "^7.0.0" @@ -6950,8 +6921,6 @@ "resolved": "https://registry.npmjs.org/ws/-/ws-8.15.1.tgz", "integrity": "sha512-W5OZiCjXEmk0yZ66ZN82beM5Sz7l7coYxpRkzS+p9PP+ToQry8szKh+61eNktr7EA9DOwvFGhfC605jDHbP6QQ==", "dev": true, - "optional": true, - "peer": true, "engines": { "node": ">=10.0.0" }, @@ -6973,8 +6942,6 @@ "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-5.0.0.tgz", "integrity": "sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==", "dev": true, - "optional": true, - "peer": true, "engines": { "node": ">=18" } @@ -6983,9 +6950,7 @@ "version": "2.2.0", "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", - "dev": true, - "optional": true, - "peer": true + "dev": true }, "node_modules/yallist": { "version": "4.0.0", diff --git a/package.json b/package.json index 640f0fc..ee91cc3 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,8 @@ "lint": "prettier --check . && eslint .", "format": "prettier --write .", "test:integration": "playwright test", - "test:unit": "vitest", + "test:unit": "vitest run", + "test:ui": "vitest --ui --coverage.enabled=true", "test:coverage": "vitest run --coverage" }, "exports": { @@ -55,9 +56,11 @@ "@typescript-eslint/eslint-plugin": "^6.0.0", "@typescript-eslint/parser": "^6.0.0", "@vitest/coverage-v8": "^1.0.4", + "@vitest/ui": "^1.0.4", "eslint": "^8.28.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-svelte": "^2.30.0", + "jsdom": "^23.0.1", "prettier": "^3.1.1", "prettier-plugin-svelte": "^3.1.2", "publint": "^0.1.9", diff --git a/src/lib/test/setup.ts b/src/lib/test/setup.ts new file mode 100644 index 0000000..bb02c60 --- /dev/null +++ b/src/lib/test/setup.ts @@ -0,0 +1 @@ +import '@testing-library/jest-dom/vitest'; diff --git a/tsconfig.json b/tsconfig.json index 6f788f1..e005db1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,6 +10,8 @@ "sourceMap": true, "strict": true, "module": "NodeNext", - "moduleResolution": "NodeNext" - } + "moduleResolution": "NodeNext", + "types": ["node", "vite/client", "vitest/globals"] + }, + "exclude": ["vite.config.ts"] } diff --git a/vite.config.ts b/vite.config.ts index 37b6a84..2c25ae3 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -4,6 +4,13 @@ import { defineConfig } from 'vitest/config'; export default defineConfig({ plugins: [sveltekit()], test: { - include: ['src/**/*.{test,spec}.{js,ts}'] + include: ['src/**/*.{test,spec}.{js,ts}'], + environment: 'jsdom', + globals: true, + setupFiles: ['./src/lib/test/setup.ts'], + coverage: { + reporter: ['text', 'html'], + include: ['src/lib/**'] + } } });