From 9e1759a205f097c46176d517ce27466609797adf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 18 Oct 2023 09:45:17 +0300 Subject: [PATCH 001/123] chore(deps): bump @babel/traverse from 7.18.9 to 7.23.2 (#1322) Bumps [@babel/traverse](https://github.com/babel/babel/tree/HEAD/packages/babel-traverse) from 7.18.9 to 7.23.2. - [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.23.2/packages/babel-traverse) --- updated-dependencies: - dependency-name: "@babel/traverse" dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 292 ++++++++++++++++++++++++++-------------------- 1 file changed, 168 insertions(+), 124 deletions(-) diff --git a/package-lock.json b/package-lock.json index ddd6c39cd..d65694cb2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -219,16 +219,30 @@ } }, "node_modules/@babel/code-frame": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.18.6.tgz", - "integrity": "sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q==", + "version": "7.22.13", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.22.13.tgz", + "integrity": "sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w==", "dependencies": { - "@babel/highlight": "^7.18.6" + "@babel/highlight": "^7.22.13", + "chalk": "^2.4.2" }, "engines": { "node": ">=6.9.0" } }, + "node_modules/@babel/code-frame/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/@babel/compat-data": { "version": "7.18.8", "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.18.8.tgz", @@ -318,12 +332,13 @@ } }, "node_modules/@babel/generator": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.18.9.tgz", - "integrity": "sha512-wt5Naw6lJrL1/SGkipMiFxJjtyczUWTP38deiP1PO60HsBjDeKk08CGC3S8iVuvf0FmTdgKwU1KIXzSKL1G0Ug==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.0.tgz", + "integrity": "sha512-lN85QRR+5IbYrMWM6Y4pE/noaQtg4pNiqeNGX60eqOfo6gtEj6uw/JagelB8vVztSd7R6M5n1+PQkDbHbBRU4g==", "dependencies": { - "@babel/types": "^7.18.9", + "@babel/types": "^7.23.0", "@jridgewell/gen-mapping": "^0.3.2", + "@jridgewell/trace-mapping": "^0.3.17", "jsesc": "^2.5.1" }, "engines": { @@ -453,9 +468,9 @@ } }, "node_modules/@babel/helper-environment-visitor": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz", - "integrity": "sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg==", + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz", + "integrity": "sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==", "engines": { "node": ">=6.9.0" } @@ -472,23 +487,23 @@ } }, "node_modules/@babel/helper-function-name": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.18.9.tgz", - "integrity": "sha512-fJgWlZt7nxGksJS9a0XdSaI4XvpExnNIgRP+rVefWh5U7BL8pPuir6SJUmFKRfjWQ51OtWSzwOxhaH/EBWWc0A==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz", + "integrity": "sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==", "dependencies": { - "@babel/template": "^7.18.6", - "@babel/types": "^7.18.9" + "@babel/template": "^7.22.15", + "@babel/types": "^7.23.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-hoist-variables": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz", - "integrity": "sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q==", + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz", + "integrity": "sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==", "dependencies": { - "@babel/types": "^7.18.6" + "@babel/types": "^7.22.5" }, "engines": { "node": ">=6.9.0" @@ -608,20 +623,28 @@ } }, "node_modules/@babel/helper-split-export-declaration": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.18.6.tgz", - "integrity": "sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA==", + "version": "7.22.6", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz", + "integrity": "sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==", "dependencies": { - "@babel/types": "^7.18.6" + "@babel/types": "^7.22.5" }, "engines": { "node": ">=6.9.0" } }, + "node_modules/@babel/helper-string-parser": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz", + "integrity": "sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==", + "engines": { + "node": ">=6.9.0" + } + }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.18.6.tgz", - "integrity": "sha512-MmetCkz9ej86nJQV+sFCxoGGrUbU3q02kgLciwkrt9QqEB7cP39oKEY0PakknEO0Gu20SskMRi+AYZ3b1TpN9g==", + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz", + "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==", "engines": { "node": ">=6.9.0" } @@ -662,12 +685,12 @@ } }, "node_modules/@babel/highlight": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", - "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.20.tgz", + "integrity": "sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg==", "dependencies": { - "@babel/helper-validator-identifier": "^7.18.6", - "chalk": "^2.0.0", + "@babel/helper-validator-identifier": "^7.22.20", + "chalk": "^2.4.2", "js-tokens": "^4.0.0" }, "engines": { @@ -688,9 +711,9 @@ } }, "node_modules/@babel/parser": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.18.9.tgz", - "integrity": "sha512-9uJveS9eY9DJ0t64YbIBZICtJy8a5QrDEVdiLCG97fVLpDTpGX7t8mMSb6OWw6Lrnjqj4O8zwjELX3dhoMgiBg==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.0.tgz", + "integrity": "sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw==", "bin": { "parser": "bin/babel-parser.js" }, @@ -1955,31 +1978,31 @@ } }, "node_modules/@babel/template": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.18.6.tgz", - "integrity": "sha512-JoDWzPe+wgBsTTgdnIma3iHNFC7YVJoPssVBDjiHfNlyt4YcunDtcDOUmfVDfCK5MfdsaIoX9PkijPhjH3nYUw==", + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.15.tgz", + "integrity": "sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==", "dependencies": { - "@babel/code-frame": "^7.18.6", - "@babel/parser": "^7.18.6", - "@babel/types": "^7.18.6" + "@babel/code-frame": "^7.22.13", + "@babel/parser": "^7.22.15", + "@babel/types": "^7.22.15" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.18.9.tgz", - "integrity": "sha512-LcPAnujXGwBgv3/WHv01pHtb2tihcyW1XuL9wd7jqh1Z8AQkTd+QVjMrMijrln0T7ED3UXLIy36P9Ao7W75rYg==", - "dependencies": { - "@babel/code-frame": "^7.18.6", - "@babel/generator": "^7.18.9", - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-function-name": "^7.18.9", - "@babel/helper-hoist-variables": "^7.18.6", - "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/parser": "^7.18.9", - "@babel/types": "^7.18.9", + "version": "7.23.2", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.2.tgz", + "integrity": "sha512-azpe59SQ48qG6nu2CzcMLbxUudtN+dOM9kDbUqGq3HXUJRlo7i8fvPoxQUzYgLZ4cMVmuZgm8vvBpNeRhd6XSw==", + "dependencies": { + "@babel/code-frame": "^7.22.13", + "@babel/generator": "^7.23.0", + "@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.22.6", + "@babel/parser": "^7.23.0", + "@babel/types": "^7.23.0", "debug": "^4.1.0", "globals": "^11.1.0" }, @@ -1988,11 +2011,12 @@ } }, "node_modules/@babel/types": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.18.9.tgz", - "integrity": "sha512-WwMLAg2MvJmt/rKEVQBBhIVffMmnilX4oe0sRe7iPOHIGsqpruFHHdrfj4O1CMMtgMtCU4oPafZjDPCRgO57Wg==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.0.tgz", + "integrity": "sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==", "dependencies": { - "@babel/helper-validator-identifier": "^7.18.6", + "@babel/helper-string-parser": "^7.22.5", + "@babel/helper-validator-identifier": "^7.22.20", "to-fast-properties": "^2.0.0" }, "engines": { @@ -4025,12 +4049,12 @@ "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==" }, "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.14", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.14.tgz", - "integrity": "sha512-bJWEfQ9lPTvm3SneWwRFVLzrh6nhjwqw7TUFFBEMzwvg7t7PCDenf2lDwqo4NQXzdpgBXyFgDWnQA+2vkruksQ==", + "version": "0.3.20", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz", + "integrity": "sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==", "dependencies": { - "@jridgewell/resolve-uri": "^3.0.3", - "@jridgewell/sourcemap-codec": "^1.4.10" + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" } }, "node_modules/@leichtgewicht/ip-codec": { @@ -27210,11 +27234,24 @@ } }, "@babel/code-frame": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.18.6.tgz", - "integrity": "sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q==", + "version": "7.22.13", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.22.13.tgz", + "integrity": "sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w==", "requires": { - "@babel/highlight": "^7.18.6" + "@babel/highlight": "^7.22.13", + "chalk": "^2.4.2" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + } } }, "@babel/compat-data": { @@ -27280,12 +27317,13 @@ } }, "@babel/generator": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.18.9.tgz", - "integrity": "sha512-wt5Naw6lJrL1/SGkipMiFxJjtyczUWTP38deiP1PO60HsBjDeKk08CGC3S8iVuvf0FmTdgKwU1KIXzSKL1G0Ug==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.0.tgz", + "integrity": "sha512-lN85QRR+5IbYrMWM6Y4pE/noaQtg4pNiqeNGX60eqOfo6gtEj6uw/JagelB8vVztSd7R6M5n1+PQkDbHbBRU4g==", "requires": { - "@babel/types": "^7.18.9", + "@babel/types": "^7.23.0", "@jridgewell/gen-mapping": "^0.3.2", + "@jridgewell/trace-mapping": "^0.3.17", "jsesc": "^2.5.1" }, "dependencies": { @@ -27382,9 +27420,9 @@ } }, "@babel/helper-environment-visitor": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz", - "integrity": "sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg==" + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz", + "integrity": "sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==" }, "@babel/helper-explode-assignable-expression": { "version": "7.18.6", @@ -27395,20 +27433,20 @@ } }, "@babel/helper-function-name": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.18.9.tgz", - "integrity": "sha512-fJgWlZt7nxGksJS9a0XdSaI4XvpExnNIgRP+rVefWh5U7BL8pPuir6SJUmFKRfjWQ51OtWSzwOxhaH/EBWWc0A==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz", + "integrity": "sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==", "requires": { - "@babel/template": "^7.18.6", - "@babel/types": "^7.18.9" + "@babel/template": "^7.22.15", + "@babel/types": "^7.23.0" } }, "@babel/helper-hoist-variables": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz", - "integrity": "sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q==", + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz", + "integrity": "sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==", "requires": { - "@babel/types": "^7.18.6" + "@babel/types": "^7.22.5" } }, "@babel/helper-member-expression-to-functions": { @@ -27495,17 +27533,22 @@ } }, "@babel/helper-split-export-declaration": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.18.6.tgz", - "integrity": "sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA==", + "version": "7.22.6", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz", + "integrity": "sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==", "requires": { - "@babel/types": "^7.18.6" + "@babel/types": "^7.22.5" } }, + "@babel/helper-string-parser": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz", + "integrity": "sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==" + }, "@babel/helper-validator-identifier": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.18.6.tgz", - "integrity": "sha512-MmetCkz9ej86nJQV+sFCxoGGrUbU3q02kgLciwkrt9QqEB7cP39oKEY0PakknEO0Gu20SskMRi+AYZ3b1TpN9g==" + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz", + "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==" }, "@babel/helper-validator-option": { "version": "7.18.6", @@ -27534,12 +27577,12 @@ } }, "@babel/highlight": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", - "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.20.tgz", + "integrity": "sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg==", "requires": { - "@babel/helper-validator-identifier": "^7.18.6", - "chalk": "^2.0.0", + "@babel/helper-validator-identifier": "^7.22.20", + "chalk": "^2.4.2", "js-tokens": "^4.0.0" }, "dependencies": { @@ -27556,9 +27599,9 @@ } }, "@babel/parser": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.18.9.tgz", - "integrity": "sha512-9uJveS9eY9DJ0t64YbIBZICtJy8a5QrDEVdiLCG97fVLpDTpGX7t8mMSb6OWw6Lrnjqj4O8zwjELX3dhoMgiBg==" + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.0.tgz", + "integrity": "sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw==" }, "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": { "version": "7.18.6", @@ -28377,38 +28420,39 @@ } }, "@babel/template": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.18.6.tgz", - "integrity": "sha512-JoDWzPe+wgBsTTgdnIma3iHNFC7YVJoPssVBDjiHfNlyt4YcunDtcDOUmfVDfCK5MfdsaIoX9PkijPhjH3nYUw==", + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.15.tgz", + "integrity": "sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==", "requires": { - "@babel/code-frame": "^7.18.6", - "@babel/parser": "^7.18.6", - "@babel/types": "^7.18.6" + "@babel/code-frame": "^7.22.13", + "@babel/parser": "^7.22.15", + "@babel/types": "^7.22.15" } }, "@babel/traverse": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.18.9.tgz", - "integrity": "sha512-LcPAnujXGwBgv3/WHv01pHtb2tihcyW1XuL9wd7jqh1Z8AQkTd+QVjMrMijrln0T7ED3UXLIy36P9Ao7W75rYg==", - "requires": { - "@babel/code-frame": "^7.18.6", - "@babel/generator": "^7.18.9", - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-function-name": "^7.18.9", - "@babel/helper-hoist-variables": "^7.18.6", - "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/parser": "^7.18.9", - "@babel/types": "^7.18.9", + "version": "7.23.2", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.2.tgz", + "integrity": "sha512-azpe59SQ48qG6nu2CzcMLbxUudtN+dOM9kDbUqGq3HXUJRlo7i8fvPoxQUzYgLZ4cMVmuZgm8vvBpNeRhd6XSw==", + "requires": { + "@babel/code-frame": "^7.22.13", + "@babel/generator": "^7.23.0", + "@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.22.6", + "@babel/parser": "^7.23.0", + "@babel/types": "^7.23.0", "debug": "^4.1.0", "globals": "^11.1.0" } }, "@babel/types": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.18.9.tgz", - "integrity": "sha512-WwMLAg2MvJmt/rKEVQBBhIVffMmnilX4oe0sRe7iPOHIGsqpruFHHdrfj4O1CMMtgMtCU4oPafZjDPCRgO57Wg==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.0.tgz", + "integrity": "sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==", "requires": { - "@babel/helper-validator-identifier": "^7.18.6", + "@babel/helper-string-parser": "^7.22.5", + "@babel/helper-validator-identifier": "^7.22.20", "to-fast-properties": "^2.0.0" } }, @@ -30005,12 +30049,12 @@ "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==" }, "@jridgewell/trace-mapping": { - "version": "0.3.14", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.14.tgz", - "integrity": "sha512-bJWEfQ9lPTvm3SneWwRFVLzrh6nhjwqw7TUFFBEMzwvg7t7PCDenf2lDwqo4NQXzdpgBXyFgDWnQA+2vkruksQ==", + "version": "0.3.20", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz", + "integrity": "sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==", "requires": { - "@jridgewell/resolve-uri": "^3.0.3", - "@jridgewell/sourcemap-codec": "^1.4.10" + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" } }, "@leichtgewicht/ip-codec": { From b1c4ae935739f84c3afb95dd009bb42534dc0593 Mon Sep 17 00:00:00 2001 From: Joyel Johny <81413791+JoyelJohny@users.noreply.github.com> Date: Sat, 21 Oct 2023 21:29:57 +0530 Subject: [PATCH 002/123] feat: Updated UI of Page[Help] (#1323) * Docs: Updated UI of Page[Help] * Update custom.css * Update help.js --- src/css/custom.css | 22 ++++++++++++++++------ src/pages/help.js | 6 +++--- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/css/custom.css b/src/css/custom.css index 9de16964c..7c519d8fa 100644 --- a/src/css/custom.css +++ b/src/css/custom.css @@ -9,7 +9,18 @@ html[data-theme='dark'] { .wrapper { margin: 0 auto; max-width: 1100px; - padding: 0 20px; + padding: 0 70px; + margin-top: 30px; +} + +.help-heading-1 { + font-size: 3em; + margin-bottom: 30px; +} + +.help-heading-2 { + font-size: 2.5em; + margin: 30px 0; } .center { @@ -121,16 +132,12 @@ html[data-theme='dark'] { padding-bottom: 40px; padding-top: 40px; } - - .wrapper { - max-width: 1400px; - } } .mainContainer { flex: 1 1 0%; max-width: 100%; - padding: 40px 0; + margin-bottom: 50px; } .mainContainer .wrapper { @@ -396,6 +403,9 @@ html[data-theme='dark'] { } @media only screen and (max-width: 735px) { + .wrapper { + padding: 0 20px; + } .showcaseSection .logos img { max-height: 64px; padding: 20px; diff --git a/src/pages/help.js b/src/pages/help.js index 5c1ca8dc2..a5e318d1e 100755 --- a/src/pages/help.js +++ b/src/pages/help.js @@ -61,7 +61,7 @@ export default function Help(props) {
-

Need help?

+

Need help?

-

Buy a Course

+

Buy a course

Learn how to test JavaScript with{' '} @@ -96,7 +96,7 @@ export default function Help(props) {

-

Want to help?

+

Want to help?

Thanks! The Testing Library maintainers are happy to maintain this From ce729c7fce69677c4244b176d81e18b08fc53394 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Sat, 21 Oct 2023 19:00:48 +0300 Subject: [PATCH 003/123] docs: add JoyelJohny as a contributor for code (#1324) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] --------- Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 1 + 2 files changed, 10 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 59753c6c8..33dfbeddb 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2555,6 +2555,15 @@ "contributions": [ "doc" ] + }, + { + "login": "JoyelJohny", + "name": "Joyel Johny", + "avatar_url": "https://avatars.githubusercontent.com/u/81413791?v=4", + "profile": "https://github.com/JoyelJohny", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index a2945dc9d..6c039c056 100644 --- a/README.md +++ b/README.md @@ -498,6 +498,7 @@ Thanks goes to these wonderful people Andreas Nordahl
Andreas Nordahl

📖 neaumusic
neaumusic

📖 + Joyel Johny
Joyel Johny

💻 From e532b2cc1c6a8beac3c2a25762e649cb3105a774 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gromit=20=28=EC=A0=84=EB=AF=BC=EC=9E=AC=29?= <64779472+ssi02014@users.noreply.github.com> Date: Thu, 26 Oct 2023 16:40:56 +0900 Subject: [PATCH 004/123] imp: add unmount top link (#1325) * imp: add the act type and hyperlink * revert: act docs --- docs/react-testing-library/api.mdx | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/react-testing-library/api.mdx b/docs/react-testing-library/api.mdx index 9d95cd584..70469612b 100644 --- a/docs/react-testing-library/api.mdx +++ b/docs/react-testing-library/api.mdx @@ -31,6 +31,7 @@ as these methods: - [`renderHook` Result](#renderhook-result) - [`result`](#result) - [`rerender`](#rerender-1) + - [`unmount`](#unmount-1) --- From 4f531fcada5705603e46e7978268259734ba9904 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 28 Oct 2023 11:45:39 +0300 Subject: [PATCH 005/123] chore(deps-dev): bump browserify-sign from 4.2.1 to 4.2.2 (#1328) Bumps [browserify-sign](https://github.com/crypto-browserify/browserify-sign) from 4.2.1 to 4.2.2. - [Changelog](https://github.com/browserify/browserify-sign/blob/main/CHANGELOG.md) - [Commits](https://github.com/crypto-browserify/browserify-sign/compare/v4.2.1...v4.2.2) --- updated-dependencies: - dependency-name: browserify-sign dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 129 +++++++++++++++++++++------------------------- 1 file changed, 59 insertions(+), 70 deletions(-) diff --git a/package-lock.json b/package-lock.json index d65694cb2..576c1ee6d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7187,9 +7187,9 @@ "dev": true }, "node_modules/bn.js": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.1.3.tgz", - "integrity": "sha512-GkTiFpjFtUzU9CbMeJ5iazkCzGL3jrhzerzZIuqLABjbwRaFt33I9tUdSNryIptM+RxDet6OKm2WnLXzW51KsQ==", + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==", "dev": true }, "node_modules/body-parser": { @@ -7479,36 +7479,33 @@ } }, "node_modules/browserify-rsa": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", - "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.1.0.tgz", + "integrity": "sha512-AdEER0Hkspgno2aR97SAf6vi0y0k8NuOpGnVH3O99rcA5Q6sh8QxcngtHuJ6uXwnfAXNM4Gn1Gb7/MV1+Ymbog==", "dev": true, "dependencies": { - "bn.js": "^4.1.0", + "bn.js": "^5.0.0", "randombytes": "^2.0.1" } }, - "node_modules/browserify-rsa/node_modules/bn.js": { - "version": "4.11.9", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", - "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==", - "dev": true - }, "node_modules/browserify-sign": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.1.tgz", - "integrity": "sha512-/vrA5fguVAKKAVTNJjgSm1tRQDHUU6DbwO9IROu/0WAzC8PKhucDSh18J0RMvVeHAn5puMd+QHC2erPRNf8lmg==", + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.2.tgz", + "integrity": "sha512-1rudGyeYY42Dk6texmv7c4VcQ0EsvVbLwZkA+AQB7SxvXxmcD93jcHie8bzecJ+ChDlmAm2Qyu0+Ccg5uhZXCg==", "dev": true, "dependencies": { - "bn.js": "^5.1.1", - "browserify-rsa": "^4.0.1", + "bn.js": "^5.2.1", + "browserify-rsa": "^4.1.0", "create-hash": "^1.2.0", "create-hmac": "^1.1.7", - "elliptic": "^6.5.3", + "elliptic": "^6.5.4", "inherits": "^2.0.4", - "parse-asn1": "^5.1.5", - "readable-stream": "^3.6.0", - "safe-buffer": "^5.2.0" + "parse-asn1": "^5.1.6", + "readable-stream": "^3.6.2", + "safe-buffer": "^5.2.1" + }, + "engines": { + "node": ">= 4" } }, "node_modules/browserify-sign/node_modules/safe-buffer": { @@ -10406,18 +10403,18 @@ } }, "node_modules/elliptic": { - "version": "6.5.3", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz", - "integrity": "sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==", + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", + "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", "dev": true, "dependencies": { - "bn.js": "^4.4.0", - "brorand": "^1.0.1", + "bn.js": "^4.11.9", + "brorand": "^1.1.0", "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.0", - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.0" + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" } }, "node_modules/elliptic/node_modules/bn.js": { @@ -22569,9 +22566,9 @@ } }, "node_modules/readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", @@ -32490,9 +32487,9 @@ } }, "bn.js": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.1.3.tgz", - "integrity": "sha512-GkTiFpjFtUzU9CbMeJ5iazkCzGL3jrhzerzZIuqLABjbwRaFt33I9tUdSNryIptM+RxDet6OKm2WnLXzW51KsQ==", + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==", "dev": true }, "body-parser": { @@ -32736,38 +32733,30 @@ } }, "browserify-rsa": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", - "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.1.0.tgz", + "integrity": "sha512-AdEER0Hkspgno2aR97SAf6vi0y0k8NuOpGnVH3O99rcA5Q6sh8QxcngtHuJ6uXwnfAXNM4Gn1Gb7/MV1+Ymbog==", "dev": true, "requires": { - "bn.js": "^4.1.0", + "bn.js": "^5.0.0", "randombytes": "^2.0.1" - }, - "dependencies": { - "bn.js": { - "version": "4.11.9", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", - "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==", - "dev": true - } } }, "browserify-sign": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.1.tgz", - "integrity": "sha512-/vrA5fguVAKKAVTNJjgSm1tRQDHUU6DbwO9IROu/0WAzC8PKhucDSh18J0RMvVeHAn5puMd+QHC2erPRNf8lmg==", + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.2.tgz", + "integrity": "sha512-1rudGyeYY42Dk6texmv7c4VcQ0EsvVbLwZkA+AQB7SxvXxmcD93jcHie8bzecJ+ChDlmAm2Qyu0+Ccg5uhZXCg==", "dev": true, "requires": { - "bn.js": "^5.1.1", - "browserify-rsa": "^4.0.1", + "bn.js": "^5.2.1", + "browserify-rsa": "^4.1.0", "create-hash": "^1.2.0", "create-hmac": "^1.1.7", - "elliptic": "^6.5.3", + "elliptic": "^6.5.4", "inherits": "^2.0.4", - "parse-asn1": "^5.1.5", - "readable-stream": "^3.6.0", - "safe-buffer": "^5.2.0" + "parse-asn1": "^5.1.6", + "readable-stream": "^3.6.2", + "safe-buffer": "^5.2.1" }, "dependencies": { "safe-buffer": { @@ -34942,18 +34931,18 @@ "dev": true }, "elliptic": { - "version": "6.5.3", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz", - "integrity": "sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==", + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", + "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", "dev": true, "requires": { - "bn.js": "^4.4.0", - "brorand": "^1.0.1", + "bn.js": "^4.11.9", + "brorand": "^1.1.0", "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.0", - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.0" + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" }, "dependencies": { "bn.js": { @@ -44124,9 +44113,9 @@ } }, "readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", "requires": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", From bfbf510d7e10bd3d461d3c727827c4e06db7284a Mon Sep 17 00:00:00 2001 From: Nick McCurdy Date: Sat, 28 Oct 2023 20:02:27 -0400 Subject: [PATCH 006/123] chore: format --- docs/angular-testing-library/examples.mdx | 23 ++++--- docs/angular-testing-library/faq.mdx | 5 +- .../version-compatibility.mdx | 4 +- docs/dom-testing-library/api-debugging.mdx | 16 ++--- docs/dom-testing-library/setup.mdx | 7 +- docs/ecosystem-user-event.mdx | 23 ++++--- docs/example-external.mdx | 3 +- docs/example-formik.md | 9 ++- docs/example-react-router.mdx | 3 +- docs/learning.mdx | 15 +++-- docs/preact-testing-library/api.mdx | 24 ++++--- docs/queries/byrole.mdx | 5 +- .../example-intro.mdx | 10 +-- docs/react-testing-library/api.mdx | 14 ++-- docs/react-testing-library/example-intro.mdx | 67 +++++++++---------- docs/react-testing-library/setup.mdx | 33 +++++---- docs/svelte-testing-library/setup.mdx | 15 +++-- docs/user-event/api-clipboard.mdx | 3 +- docs/user-event/api-keyboard.mdx | 4 +- docs/user-event/api-pointer.mdx | 22 +++--- docs/user-event/api-utility.mdx | 4 +- docs/user-event/intro.mdx | 27 +++++--- docs/user-event/setup.mdx | 5 +- docs/vue-testing-library/faq.mdx | 2 +- docs/vue-testing-library/setup.mdx | 4 +- docusaurus.config.js | 6 +- src/components/Showcase/index.jsx | 22 +++--- 27 files changed, 201 insertions(+), 174 deletions(-) diff --git a/docs/angular-testing-library/examples.mdx b/docs/angular-testing-library/examples.mdx index b24098ecd..5829ccf78 100644 --- a/docs/angular-testing-library/examples.mdx +++ b/docs/angular-testing-library/examples.mdx @@ -57,11 +57,13 @@ describe('Counter', () => { ## With Standalone Components -Angular Testing Library can also test your standalone components. -In fact, it even becomes easier because you don't have to set up the whole Angular TestBed. -This was previously only [possible when you used Single Component Angular Modules (SCAMs)](https://timdeschryver.dev/blog/single-component-angular-modules-and-component-tests-go-hand-in-hand). +Angular Testing Library can also test your standalone components. In fact, it +even becomes easier because you don't have to set up the whole Angular TestBed. +This was previously only +[possible when you used Single Component Angular Modules (SCAMs)](https://timdeschryver.dev/blog/single-component-angular-modules-and-component-tests-go-hand-in-hand). -Let's migrate the counter component to a standalone component, and let's take a look at how this affects the test. +Let's migrate the counter component to a standalone component, and let's take a +look at how this affects the test. ```ts title="counter.component.ts" @Component({ @@ -86,8 +88,8 @@ export class CounterComponent { } ``` -Just as you would've expected, this doesn't affect the test cases. -Writing tests for standalone components remains the same as for "regular" components. +Just as you would've expected, this doesn't affect the test cases. Writing tests +for standalone components remains the same as for "regular" components. ```ts title="counter.component.spec.ts" import {render, screen, fireEvent} from '@testing-library/angular' @@ -114,7 +116,8 @@ describe('Counter', () => { }) ``` -To override an import of a standalone component for your component test, you can use the [`componentImports` property](api.mdx#componentImports). +To override an import of a standalone component for your component test, you can +use the [`componentImports` property](api.mdx#componentImports). ## More examples @@ -125,7 +128,9 @@ These examples include: - `@Input` and `@Output` properties - Forms - Integration with services -- And [more](https://github.com/testing-library/angular-testing-library/tree/master/apps/example-app/src/app/examples) +- And + [more](https://github.com/testing-library/angular-testing-library/tree/master/apps/example-app/src/app/examples) If you're looking for an example that isn't on the list, please feel free to -create a [new issue](https://github.com/testing-library/angular-testing-library/issues/new). +create a +[new issue](https://github.com/testing-library/angular-testing-library/issues/new). diff --git a/docs/angular-testing-library/faq.mdx b/docs/angular-testing-library/faq.mdx index b758c270c..e333db4b3 100644 --- a/docs/angular-testing-library/faq.mdx +++ b/docs/angular-testing-library/faq.mdx @@ -31,7 +31,8 @@ As you write your tests, keep in mind: In general, you should avoid mocking out components (see [the Guiding Principles section](guiding-principles.mdx)). However, if you need -to, then try to use [ng-mocks](https://ng-mocks.sudo.eu/) and its [`MockBuilder`](https://ng-mocks.sudo.eu/extra/with-3rd-party#testing-libraryangular-and-mockbuilder). +to, then try to use [ng-mocks](https://ng-mocks.sudo.eu/) and its +[`MockBuilder`](https://ng-mocks.sudo.eu/extra/with-3rd-party#testing-libraryangular-and-mockbuilder). ```typescript import {Component, NgModule} from '@angular/core' @@ -58,7 +59,7 @@ export class AppModule {} describe('ParentComponent', () => { it('should not render ChildComponent when shallow rendering', async () => { // all imports, declarations and exports of AppModule will be mocked. - const dependencies = MockBuilder(ParentComponent, AppModule).build(); + const dependencies = MockBuilder(ParentComponent, AppModule).build() await render(ParentComponent, dependencies) diff --git a/docs/angular-testing-library/version-compatibility.mdx b/docs/angular-testing-library/version-compatibility.mdx index 18a72b301..8a1ff4b88 100644 --- a/docs/angular-testing-library/version-compatibility.mdx +++ b/docs/angular-testing-library/version-compatibility.mdx @@ -3,7 +3,8 @@ id: version-compatibility title: Version compatibility --- -An overview of the compatibility between different versions of Angular Testing Library and Angular. +An overview of the compatibility between different versions of Angular Testing +Library and Angular. | Angular | Angular Testing Library | | ------- | ----------------------- | @@ -11,4 +12,3 @@ An overview of the compatibility between different versions of Angular Testing L | >= 15.1 | 13.x \|\| 14.x | | < 15.1 | 11.x \|\| 12.x | | 14.x | 11.x \|\| 12.x | - diff --git a/docs/dom-testing-library/api-debugging.mdx b/docs/dom-testing-library/api-debugging.mdx index 514a930bc..75968f5d1 100644 --- a/docs/dom-testing-library/api-debugging.mdx +++ b/docs/dom-testing-library/api-debugging.mdx @@ -42,9 +42,9 @@ you'd like a solution that works for both, see **Note**: The output of the DOM is colorized by default if your tests are running in a node environment. However, you may sometimes want to turn off -colors, such as in cases where the output is written to a log file for -debugging purposes. You can use the environment variable `COLORS` to explicitly -force the colorization off or on. For example: +colors, such as in cases where the output is written to a log file for debugging +purposes. You can use the environment variable `COLORS` to explicitly force the +colorization off or on. For example: ``` COLORS=false npm test @@ -105,9 +105,9 @@ This function is what also powers ## `screen.debug()` -For convenience `screen` also exposes a `debug` method. -This method is essentially a shortcut for `console.log(prettyDOM())`. It -supports debugging the document, a single element, or an array of elements. +For convenience `screen` also exposes a `debug` method. This method is +essentially a shortcut for `console.log(prettyDOM())`. It supports debugging the +document, a single element, or an array of elements. ```javascript import {screen} from '@testing-library/dom' @@ -129,8 +129,8 @@ screen.debug(screen.getAllByText('multi-test')) ## `screen.logTestingPlaygroundURL()` For debugging using [testing-playground](https://testing-playground.com), screen -exposes this convenient method which logs and returns a URL that can be opened in -a browser. +exposes this convenient method which logs and returns a URL that can be opened +in a browser. ```javascript import {screen} from '@testing-library/dom' diff --git a/docs/dom-testing-library/setup.mdx b/docs/dom-testing-library/setup.mdx index ecac8e750..b3be51807 100644 --- a/docs/dom-testing-library/setup.mdx +++ b/docs/dom-testing-library/setup.mdx @@ -18,9 +18,10 @@ the DOM and browser APIs that runs in node. If you're not using Jest and you would like to run your tests in Node, then you must install jsdom yourself. There's also a package called [global-jsdom](https://github.com/modosc/global-jsdom) which can be used to -setup the global environment to simulate the browser APIs. Note that if you're using -Vitest you only need to configure [`environment`](https://vitest.dev/config/#environment) -to `jsdom` to achieve the same effect, you don't need global-jsdom. +setup the global environment to simulate the browser APIs. Note that if you're +using Vitest you only need to configure +[`environment`](https://vitest.dev/config/#environment) to `jsdom` to achieve +the same effect, you don't need global-jsdom. First, install jsdom and global-jsdom. diff --git a/docs/ecosystem-user-event.mdx b/docs/ecosystem-user-event.mdx index c715a584a..6f5b2a5f7 100644 --- a/docs/ecosystem-user-event.mdx +++ b/docs/ecosystem-user-event.mdx @@ -615,22 +615,27 @@ method. Usage example: ```jsx -import React, { useState } from 'react' +import React, {useState} from 'react' import {render, screen} from '@testing-library/react' import userEvent, {specialChars} from '@testing-library/user-event' const InputElement = () => { - const [currentValue, setCurrentValue] = useState('This is a bad example'); - return

- - setCurrentValue(e.target.value)} /> -
; + const [currentValue, setCurrentValue] = useState('This is a bad example') + return ( +
+ + setCurrentValue(e.target.value)} + /> +
+ ) } test('delete characters within the selectedRange', () => { - render( - , - ) + render() const input = screen.getByLabelText(/example/i) input.setSelectionRange(10, 13) userEvent.type(input, `${specialChars.backspace}good`) diff --git a/docs/example-external.mdx b/docs/example-external.mdx index cf8a2cbdf..db47105d1 100644 --- a/docs/example-external.mdx +++ b/docs/example-external.mdx @@ -6,7 +6,8 @@ sidebar_label: External Examples ## Code Samples -- You can find more React Testing Library examples at [https://react-testing-examples.netlify.app/](https://react-testing-examples.netlify.app/). +- You can find more React Testing Library examples at + [https://react-testing-examples.netlify.app/](https://react-testing-examples.netlify.app/). ## Playground diff --git a/docs/example-formik.md b/docs/example-formik.md index 95c14dc1c..4d2525b04 100644 --- a/docs/example-formik.md +++ b/docs/example-formik.md @@ -65,9 +65,12 @@ test('rendering and submitting a basic Formik form', async () => { render() const user = userEvent.setup() - await user.type(screen.getByRole("textbox", { name: /first name/i }), 'John') - await user.type(screen.getByRole("textbox", { name: /last name/i }), 'Dee') - await user.type(screen.getByRole("textbox", { name: /email/i }), 'john.dee@someemail.com') + await user.type(screen.getByRole('textbox', {name: /first name/i}), 'John') + await user.type(screen.getByRole('textbox', {name: /last name/i}), 'Dee') + await user.type( + screen.getByRole('textbox', {name: /email/i}), + 'john.dee@someemail.com', + ) await user.click(screen.getByRole('button', {name: /submit/i})) diff --git a/docs/example-react-router.mdx b/docs/example-react-router.mdx index 530bb5f3b..76875f88c 100644 --- a/docs/example-react-router.mdx +++ b/docs/example-react-router.mdx @@ -168,7 +168,8 @@ export const App = () => ( ``` In your tests, pass the history object as a whole to the Router component. -**Note:** React Router v5 [only works with History v4](https://github.com/remix-run/history#documentation), +**Note:** React Router v5 +[only works with History v4](https://github.com/remix-run/history#documentation), so make sure you have the correct version of `history` installed. ```jsx diff --git a/docs/learning.mdx b/docs/learning.mdx index f2a5b2fbd..6ddeb75b1 100644 --- a/docs/learning.mdx +++ b/docs/learning.mdx @@ -43,10 +43,14 @@ sidebar_label: Learning Material [Daniel Afonso](https://twitter.com/danieljcafonso) - [Testing Apollo Components Using react-testing-library](https://www.arahansen.com/testing-apollo-components-using-react-testing-library/) by [Andrew Hansen](https://twitter.com/arahansen) -- [Enzyme vs React Testing Library: A Migration Guide](https://claritydev.net/blog/enzyme-vs-react-testing-library-migration-guide) by [Alex Khomenko](https://claritydev.net) -- [Testing React Hook Form With React Testing Library](https://claritydev.net/blog/testing-react-hook-form-with-react-testing-library) by [Alex Khomenko](https://claritydev.net) -- [Improving React Testing Library Tests](https://claritydev.net/blog/improving-react-testing-library-tests) by [Alex Khomenko](https://claritydev.net) -- [Testing Angular Challenges](https://angular-challenges.vercel.app/challenges/testing/) by [Thomas Laforge](https://twitter.com/laforge_toma) +- [Enzyme vs React Testing Library: A Migration Guide](https://claritydev.net/blog/enzyme-vs-react-testing-library-migration-guide) + by [Alex Khomenko](https://claritydev.net) +- [Testing React Hook Form With React Testing Library](https://claritydev.net/blog/testing-react-hook-form-with-react-testing-library) + by [Alex Khomenko](https://claritydev.net) +- [Improving React Testing Library Tests](https://claritydev.net/blog/improving-react-testing-library-tests) + by [Alex Khomenko](https://claritydev.net) +- [Testing Angular Challenges](https://angular-challenges.vercel.app/challenges/testing/) + by [Thomas Laforge](https://twitter.com/laforge_toma) ## Portuguese 🇧🇷 @@ -61,6 +65,7 @@ sidebar_label: Learning Material - [TESTING en REACT 🧪 ¡Aprende DESDE CERO! Con react-testing-library y Jest](https://www.youtube.com/watch?v=KYjjtRgg_H0) by [Midudev](https://twitter.com/midudev) -- [Buenas prácticas con Angular Testing Library](https://dev.to/danyparedes/buenas-practicas-con-angular-testing-library-59lp) by [Danywalls](https://twitter.com/danywalls) +- [Buenas prácticas con Angular Testing Library](https://dev.to/danyparedes/buenas-practicas-con-angular-testing-library-59lp) + by [Danywalls](https://twitter.com/danywalls) Feel free to contribute more! diff --git a/docs/preact-testing-library/api.mdx b/docs/preact-testing-library/api.mdx index 96d373301..ca4d8691f 100644 --- a/docs/preact-testing-library/api.mdx +++ b/docs/preact-testing-library/api.mdx @@ -93,23 +93,25 @@ give you an idea of how to test using those functions. ### Example 1 ```jsx -const cb = jest.fn(); +const cb = jest.fn() function Counter() { - useEffect(cb); + useEffect(cb) - const [count, setCount] = useState(0); + const [count, setCount] = useState(0) - return ; + return } -const { container: { firstChild: buttonNode }, } = render(); +const { + container: {firstChild: buttonNode}, +} = render() // Clear the first call to useEffect that the initial render triggers. -cb.mockClear(); +cb.mockClear() // Fire event Option 1. -fireEvent.click(buttonNode); +fireEvent.click(buttonNode) // Fire event Option 2. fireEvent( @@ -118,11 +120,11 @@ fireEvent( bubbles: true, cancelable: true, button: 0, - }) -); + }), +) -expect(buttonNode).toHaveTextContent('1'); -expect(cb).toHaveBeenCalledTimes(1); +expect(buttonNode).toHaveTextContent('1') +expect(cb).toHaveBeenCalledTimes(1) ``` ### Example 2 diff --git a/docs/queries/byrole.mdx b/docs/queries/byrole.mdx index 18b056ddd..c40ff6469 100644 --- a/docs/queries/byrole.mdx +++ b/docs/queries/byrole.mdx @@ -373,7 +373,8 @@ specific value using the `level` option `getByRole('spinbutton', { value: { now: 5, min: 0, max: 10, text: 'medium' } })`. Note that you don't have to specify all properties in `value`. A subset is -sufficient e.g. `getByRole('spinbutton', { value: { now: 5, text: 'medium' } })`. +sufficient e.g. +`getByRole('spinbutton', { value: { now: 5, text: 'medium' } })`. Given the example below, @@ -416,7 +417,7 @@ getAllByRole('spinbutton', {value: {min: 0}}) ``` > Every specified property in `value` must match. For example, if you query for -> `{value: {min: 0, now: 3}}` `aria-valuemin` must be equal to 0 **AND** +> `{value: {min: 0, now: 3}}` `aria-valuemin` must be equal to 0 **AND** > > `aria-valuenow` must be equal to 3 > The `value` option is _only_ applicable to certain roles (check the linked MDN diff --git a/docs/react-native-testing-library/example-intro.mdx b/docs/react-native-testing-library/example-intro.mdx index 1cd3b72c0..e6724ebd1 100644 --- a/docs/react-native-testing-library/example-intro.mdx +++ b/docs/react-native-testing-library/example-intro.mdx @@ -33,18 +33,18 @@ function Example() { test('examples of some things', async () => { const expectedUsername = 'Ada Lovelace' - + render() fireEvent.changeText(screen.getByTestId('input'), expectedUsername) fireEvent.press(screen.getByText('Print Username')) - + // Using `findBy` query to wait for asynchronous operation to finish const usernameOutput = await screen.findByTestId('printed-username') - + // Using `toHaveTextContent` matcher from `@testing-library/jest-native` package. - expect(usernameOutput).toHaveTextContent(expectedUsername); - + expect(usernameOutput).toHaveTextContent(expectedUsername) + expect(screen.toJSON()).toMatchSnapshot() }) ``` diff --git a/docs/react-testing-library/api.mdx b/docs/react-testing-library/api.mdx index 70469612b..6150b6418 100644 --- a/docs/react-testing-library/api.mdx +++ b/docs/react-testing-library/api.mdx @@ -339,7 +339,7 @@ function renderHook< Props, Q extends Queries = typeof queries, Container extends Element | DocumentFragment = HTMLElement, - BaseElement extends Element | DocumentFragment = Container, + BaseElement extends Element | DocumentFragment = Container >( render: (initialProps: Props) => Result, options?: RenderHookOptions, @@ -377,8 +377,10 @@ test('returns logged in user', () => { }) ``` -> NOTE: When using `renderHook` in conjunction with the `wrapper` and `initialProps` options, the `initialProps` are not passed to the `wrapper` component. -> To provide props to the `wrapper` component, consider a solution like this: +> NOTE: When using `renderHook` in conjunction with the `wrapper` and +> `initialProps` options, the `initialProps` are not passed to the `wrapper` +> component. To provide props to the `wrapper` component, consider a solution +> like this: > > ```js > const createWrapper = (Wrapper, props) => { @@ -386,9 +388,9 @@ test('returns logged in user', () => { > return {children}; > }; > }; -> +> > ... -> +> > { > wrapper: createWrapper(Wrapper, { value: 'foo' }), > } @@ -449,4 +451,4 @@ import {renderHook} from '@testing-library/react' const {unmount} = renderHook(({name = 'Alice'} = {}) => name) unmount() -``` \ No newline at end of file +``` diff --git a/docs/react-testing-library/example-intro.mdx b/docs/react-testing-library/example-intro.mdx index 035bfe252..5344fc006 100644 --- a/docs/react-testing-library/example-intro.mdx +++ b/docs/react-testing-library/example-intro.mdx @@ -6,65 +6,60 @@ sidebar_label: Example ## Quickstart -This is a minimal setup to get you started. -If you want to see a description of what each line does, -scroll down to the [annotated version](#quickstart-annotated). -Scroll down to [Full Example](#full-example) to see a more advanced test setup. +This is a minimal setup to get you started. If you want to see a description of +what each line does, scroll down to the +[annotated version](#quickstart-annotated). Scroll down to +[Full Example](#full-example) to see a more advanced test setup. ```jsx -import { render, screen } from '@testing-library/react' +import {render, screen} from '@testing-library/react' import userEvent from '@testing-library/user-event' import '@testing-library/jest-dom' import Fetch from './fetch' test('loads and displays greeting', async () => { - // ARRANGE render() - + // ACT await userEvent.click(screen.getByText('Load Greeting')) await screen.findByRole('heading') - + // ASSERT expect(screen.getByRole('heading')).toHaveTextContent('hello there') expect(screen.getByRole('button')).toBeDisabled() - }) ```
Quickstart (Annotated Example) - ```jsx - // import react-testing methods - import { render, screen } from '@testing-library/react' - // userEvent library simulates user interactions by dispatching the events that would happen if the interaction took place in a browser. - import userEvent from '@testing-library/user-event' - // add custom jest matchers from jest-dom - import '@testing-library/jest-dom' - // the component to test - import Fetch from './fetch' - - test('loads and displays greeting', async () => { - - // Render a React element into the DOM - render() - - await userEvent.click(screen.getByText('Load Greeting')) - // wait before throwing an error if it cannot find an element - await screen.findByRole('heading') - - // assert that the alert message is correct using - // toHaveTextContent, a custom matcher from jest-dom. - expect(screen.getByRole('heading')).toHaveTextContent('hello there') - expect(screen.getByRole('button')).toBeDisabled() - - }) - ``` +```jsx +// import react-testing methods +import {render, screen} from '@testing-library/react' +// userEvent library simulates user interactions by dispatching the events that would happen if the interaction took place in a browser. +import userEvent from '@testing-library/user-event' +// add custom jest matchers from jest-dom +import '@testing-library/jest-dom' +// the component to test +import Fetch from './fetch' -
+test('loads and displays greeting', async () => { + // Render a React element into the DOM + render() + + await userEvent.click(screen.getByText('Load Greeting')) + // wait before throwing an error if it cannot find an element + await screen.findByRole('heading') + // assert that the alert message is correct using + // toHaveTextContent, a custom matcher from jest-dom. + expect(screen.getByRole('heading')).toHaveTextContent('hello there') + expect(screen.getByRole('button')).toBeDisabled() +}) +``` + + ## Full Example diff --git a/docs/react-testing-library/setup.mdx b/docs/react-testing-library/setup.mdx index 552037088..271b0e9a0 100644 --- a/docs/react-testing-library/setup.mdx +++ b/docs/react-testing-library/setup.mdx @@ -84,7 +84,7 @@ import {ThemeProvider} from 'my-ui-lib' import {TranslationProvider} from 'my-i18n-lib' import defaultStrings from 'i18n/en-x-default' -const AllTheProviders = ({children}:{children: React.ReactNode}) => { +const AllTheProviders = ({children}: {children: React.ReactNode}) => { return ( @@ -214,7 +214,7 @@ import { const queryAllByDataCy = ( container: HTMLElement, id: Matcher, - options?: MatcherOptions | undefined + options?: MatcherOptions | undefined, ) => queryHelpers.queryAllByAttribute('data-cy', container, id, options) const getMultipleError = (c, dataCyValue) => @@ -247,8 +247,8 @@ export { You can then override and append the new queries via the render function by passing a [`queries`](api.mdx#render-options) option. -If you want to add custom queries globally, you can do this by defining your customized -`render`, `screen` and `within` methods: +If you want to add custom queries globally, you can do this by defining your +customized `render`, `screen` and `within` methods: @@ -273,11 +273,7 @@ const customRender = (ui, options) => export * from '@testing-library/react' // override render method -export { - customScreen as screen, - customWithin as within, - customRender as render, -} +export {customScreen as screen, customWithin as within, customRender as render} ``` @@ -302,11 +298,7 @@ const customRender = ( ) => render(ui, {queries: allQueries, ...options}) export * from '@testing-library/react' -export { - customScreen as screen, - customWithin as within, - customRender as render, -} +export {customScreen as screen, customWithin as within, customRender as render} ``` @@ -362,12 +354,15 @@ using Create React App without TypeScript, save this to `jsconfig.json` instead. ### Jest 28 -If you're using Jest 28 or later, jest-environment-jsdom package now must be installed separately. +If you're using Jest 28 or later, jest-environment-jsdom package now must be +installed separately. + ```bash npm2yarn npm install --save-dev jest-environment-jsdom ``` -`jsdom` is also no longer the default environment. You can enable `jsdom` globally by editing `jest.config.js`: +`jsdom` is also no longer the default environment. You can enable `jsdom` +globally by editing `jest.config.js`: ```diff title="jest.config.js" module.exports = { @@ -376,7 +371,8 @@ npm install --save-dev jest-environment-jsdom } ``` -Or if you only need `jsdom` in some of your tests, you can enable it as and when needed using +Or if you only need `jsdom` in some of your tests, you can enable it as and when +needed using [docblocks](https://jestjs.io/docs/configuration#testenvironment-string): ```js @@ -387,7 +383,8 @@ Or if you only need `jsdom` in some of your tests, you can enable it as and when ### Jest 27 -If you're using a recent version of Jest (27), `jsdom` is no longer the default environment. You can enable `jsdom` globally by editing `jest.config.js`: +If you're using a recent version of Jest (27), `jsdom` is no longer the default +environment. You can enable `jsdom` globally by editing `jest.config.js`: ```diff title="jest.config.js" module.exports = { diff --git a/docs/svelte-testing-library/setup.mdx b/docs/svelte-testing-library/setup.mdx index 4eff0ad06..d5bac8768 100644 --- a/docs/svelte-testing-library/setup.mdx +++ b/docs/svelte-testing-library/setup.mdx @@ -70,15 +70,16 @@ npm install --save-dev @vitest/ui npm install --save-dev vitest-dom ``` - 4.2 import `vitest-dom` at within the vitest setup file (usually `vitest-setup.(js|ts)`) + 4.2 import `vitest-dom` at within the vitest setup file (usually + `vitest-setup.(js|ts)`) ```js - import * as matchers from "vitest-dom/matchers"; - import { expect } from "vitest"; - expect.extend(matchers); - - // or: - import "vitest-dom/extend-expect"; + import * as matchers from 'vitest-dom/matchers' + import {expect} from 'vitest' + expect.extend(matchers) + + // or: + import 'vitest-dom/extend-expect' ``` 5. Create your component and a test file (checkout the rest of the docs to see diff --git a/docs/user-event/api-clipboard.mdx b/docs/user-event/api-clipboard.mdx index 32847ddf9..d6161bd4d 100644 --- a/docs/user-event/api-clipboard.mdx +++ b/docs/user-event/api-clipboard.mdx @@ -7,7 +7,8 @@ Note that the [Clipboard API](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard) is usually not available outside of secure context. To enable testing of workflows involving the clipboard, -[`userEvent.setup()`](setup.mdx) replaces `window.navigator.clipboard` with a stub. +[`userEvent.setup()`](setup.mdx) replaces `window.navigator.clipboard` with a +stub. ## copy() diff --git a/docs/user-event/api-keyboard.mdx b/docs/user-event/api-keyboard.mdx index 96e8dcd41..b3bc098b4 100644 --- a/docs/user-event/api-keyboard.mdx +++ b/docs/user-event/api-keyboard.mdx @@ -16,8 +16,8 @@ Keystrokes can be described: ```js keyboard('foo') // translates to: f, o, o ``` - The opening brackets `{` and `[` are used as special characters and can be referenced - by doubling them. + The opening brackets `{` and `[` are used as special characters and can be + referenced by doubling them. ```js keyboard('{{a[[') // translates to: {, a, [ ``` diff --git a/docs/user-event/api-pointer.mdx b/docs/user-event/api-pointer.mdx index f4fff24f8..3c2d93264 100644 --- a/docs/user-event/api-pointer.mdx +++ b/docs/user-event/api-pointer.mdx @@ -14,11 +14,11 @@ accepts a single pointer action or an array of them. type PointerInput = PointerActionInput | Array ``` -> Our primary target audience tests per `jest` in a `jsdom` environment and there -is no layout in `jsdom`. This means that different from your browser the -elements don't exist in a specific position, layer and size. -We don't try to determine if the pointer action you describe is possible at that -position in your layout. +> Our primary target audience tests per `jest` in a `jsdom` environment and +> there is no layout in `jsdom`. This means that different from your browser the +> elements don't exist in a specific position, layer and size. +> We don't try to determine if the pointer action you describe is possible at +> that position in your layout. ## Pointer action @@ -43,8 +43,8 @@ pointer({keys: '[MouseLeft][MouseRight]'}) pointer('[MouseLeft][MouseRight]') ``` -In order to press a button without releasing it, the button name is suffixed with -`>`. +In order to press a button without releasing it, the button name is suffixed +with `>`. For just releasing a previously pressed button, the tag is started with `/`. ```js @@ -52,7 +52,8 @@ pointer('[MouseLeft>]') // press the left mouse button pointer('[/MouseLeft]') // release the left mouse button ``` -Which buttons are available depends on the [`pointerMap`](options.mdx#pointermap). +Which buttons are available depends on the +[`pointerMap`](options.mdx#pointermap). ### Moving a pointer @@ -127,10 +128,7 @@ position to be used for any selection. pointer({target: element, offset: 2, keys: '[MouseLeft]'}) // =>
fo|obar
-pointer([ - {target: element, offset: 2, keys: '[MouseLeft>]'}, - {offset: 5}, -]) +pointer([{target: element, offset: 2, keys: '[MouseLeft>]'}, {offset: 5}]) // =>
fo[oba]r
pointer({target: element, node: element, offset: 1, keys: '[MouseLeft]'}) diff --git a/docs/user-event/api-utility.mdx b/docs/user-event/api-utility.mdx index 380e891c6..39805e3f7 100644 --- a/docs/user-event/api-utility.mdx +++ b/docs/user-event/api-utility.mdx @@ -121,8 +121,8 @@ type( Type into an input element. -> You should use [`keyboard()`](api-keyboard.mdx) if you want to just simulate pressing -> buttons on the keyboard. +> You should use [`keyboard()`](api-keyboard.mdx) if you want to just simulate +> pressing buttons on the keyboard. > You can use `type()` if you just want to conveniently insert some text into an > input field or textarea. diff --git a/docs/user-event/intro.mdx b/docs/user-event/intro.mdx index 8d6a31e31..c3ef3533e 100644 --- a/docs/user-event/intro.mdx +++ b/docs/user-event/intro.mdx @@ -42,13 +42,18 @@ factors in that the browser e.g. wouldn't let a user click a hidden element or type in a disabled text box. This is [why you should use `user-event`](https://ph-fritsche.github.io/blog/post/why-userevent) -to test interaction with your components. +to test interaction with your components. -There are, however, some user interactions or aspects of these [that aren't yet implemented and thus can't yet be described with `user-event`](https://github.com/testing-library/user-event/issues?q=is%3Aopen+label%3Aaccuracy%2Cenhancement). -In these cases you can use `fireEvent` to dispatch the concrete events that your software relies on. +There are, however, some user interactions or aspects of these +[that aren't yet implemented and thus can't yet be described with `user-event`](https://github.com/testing-library/user-event/issues?q=is%3Aopen+label%3Aaccuracy%2Cenhancement). +In these cases you can use `fireEvent` to dispatch the concrete events that your +software relies on. -Note that this makes your component and/or test reliant upon your assumptions about the concrete aspects of the interaction being correct. -Therefore if you already put in the work to specify the correct aspects of such interaction, please consider contributing to this project so that `user-event` might cover these cases too. +Note that this makes your component and/or test reliant upon your assumptions +about the concrete aspects of the interaction being correct. Therefore if you +already put in the work to specify the correct aspects of such interaction, +please consider contributing to this project so that `user-event` might cover +these cases too. ## Writing tests with `userEvent` @@ -68,7 +73,7 @@ test('trigger some awesome feature when clicking the button', async () => { // See https://testing-library.com/docs/dom-testing-library/install#wrappers render() - await user.click(screen.getByRole('button', { name: /click me!/i })) + await user.click(screen.getByRole('button', {name: /click me!/i})) // ...assertions... }) @@ -88,13 +93,13 @@ function setup(jsx) { } test('render with a setup function', async () => { - const { user } = setup() + const {user} = setup() // ... }) ``` Note that, while directly invoking APIs such as `userEvent.click()` (which will -trigger `setup` internally) is [still supported in -v14](https://testing-library.com/docs/user-event/setup#direct-apis), this option -exists to ease the migration from v13 to v14, and for simple tests. We recommend -using the methods on the instances returned by `userEvent.setup()`. +trigger `setup` internally) is +[still supported in v14](https://testing-library.com/docs/user-event/setup#direct-apis), +this option exists to ease the migration from v13 to v14, and for simple tests. +We recommend using the methods on the instances returned by `userEvent.setup()`. diff --git a/docs/user-event/setup.mdx b/docs/user-event/setup.mdx index 77546ab4d..ee43d0f44 100644 --- a/docs/user-event/setup.mdx +++ b/docs/user-event/setup.mdx @@ -27,7 +27,7 @@ This allows to write multiple consecutive interactions that behave just like the described interactions by a real user. ```js -import userEvent from "@testing-library/user-event"; +import userEvent from '@testing-library/user-event' const user = userEvent.setup() @@ -41,7 +41,8 @@ instance that shares the same input device state. The [Clipboard API](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard) is usually not available outside of secure context. To enable testing of workflows involving the clipboard, -[`userEvent.setup()`](setup.mdx) replaces `window.navigator.clipboard` with a stub. +[`userEvent.setup()`](setup.mdx) replaces `window.navigator.clipboard` with a +stub. ## Direct APIs diff --git a/docs/vue-testing-library/faq.mdx b/docs/vue-testing-library/faq.mdx index db9fd76b7..ce5a92a20 100644 --- a/docs/vue-testing-library/faq.mdx +++ b/docs/vue-testing-library/faq.mdx @@ -51,7 +51,7 @@ import Component from './Component' test('Can stub components', () => { render(Component, { - global: { stubs: ['FontAwesomeIcon'] }, + global: {stubs: ['FontAwesomeIcon']}, }) }) ``` diff --git a/docs/vue-testing-library/setup.mdx b/docs/vue-testing-library/setup.mdx index 2088286e7..a320eef6a 100644 --- a/docs/vue-testing-library/setup.mdx +++ b/docs/vue-testing-library/setup.mdx @@ -14,4 +14,6 @@ Jest, so normally you don't need to change anything. #### Vitest -If you're using Vitest and want to cleanup after each test, you need to [enable globals](https://vitest.dev/config/#globals) through its configuration file. +If you're using Vitest and want to cleanup after each test, you need to +[enable globals](https://vitest.dev/config/#globals) through its configuration +file. diff --git a/docusaurus.config.js b/docusaurus.config.js index 6577f4688..f1da30174 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -220,7 +220,7 @@ module.exports = { showLastUpdateAuthor: true, showLastUpdateTime: true, remarkPlugins: [ - [require('@docusaurus/remark-plugin-npm2yarn'), { sync: true }], + [require('@docusaurus/remark-plugin-npm2yarn'), {sync: true}], ], editUrl: 'https://github.com/testing-library/testing-library-docs/edit/main/', @@ -239,7 +239,7 @@ module.exports = { }, gtag: { trackingID: 'UA-137787095-1', - } + }, }, ], ], @@ -355,7 +355,7 @@ module.exports = { copyright: `Copyright © 2018-${new Date().getFullYear()} Kent C. Dodds and contributors`, logo: { src: 'img/octopus-128x128.png', - alt: 'An octopus representing the DOM Testing Library Logo' + alt: 'An octopus representing the DOM Testing Library Logo', }, }, algolia: { diff --git a/src/components/Showcase/index.jsx b/src/components/Showcase/index.jsx index ab50e18f1..6a5f00247 100644 --- a/src/components/Showcase/index.jsx +++ b/src/components/Showcase/index.jsx @@ -1,15 +1,15 @@ import React from 'react' -import {useThemeConfig} from '@docusaurus/theme-common'; +import {useThemeConfig} from '@docusaurus/theme-common' export const Showcase = ({users}) => { - const {isDarkTheme} = useThemeConfig() - return users.map(user => ( -
- {user.caption} - - )) + const {isDarkTheme} = useThemeConfig() + return users.map(user => ( + + {user.caption} + + )) } From 4085adf52134f0990e16c2a5fb78573ceb6f511e Mon Sep 17 00:00:00 2001 From: bsheps <35780702+bsheps@users.noreply.github.com> Date: Tue, 31 Oct 2023 01:58:26 -0500 Subject: [PATCH 007/123] Update user event's delay option to say milliseconds instead of seconds (#1334) --- docs/user-event/options.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/user-event/options.mdx b/docs/user-event/options.mdx index 6d4153560..13ec10768 100644 --- a/docs/user-event/options.mdx +++ b/docs/user-event/options.mdx @@ -38,7 +38,7 @@ The feature therefore will not constitute a breaking change. ### delay Between some subsequent inputs like typing a series of characters the code -execution is delayed per `setTimeout` for (at least) `delay` seconds. +execution is delayed per `setTimeout` for (at least) `delay` milliseconds. This moves the next changes at least to the next macro task and allows other (asynchronous) code to run between events. From 043e9cb34e5fdbe72d31bf314fe98e9f2a222db4 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Tue, 31 Oct 2023 08:59:22 +0200 Subject: [PATCH 008/123] docs: add bsheps as a contributor for doc (#1336) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] --------- Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 1 + 2 files changed, 10 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 33dfbeddb..655eefe05 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2564,6 +2564,15 @@ "contributions": [ "code" ] + }, + { + "login": "bsheps", + "name": "bsheps", + "avatar_url": "https://avatars.githubusercontent.com/u/35780702?v=4", + "profile": "https://github.com/bsheps", + "contributions": [ + "doc" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index 6c039c056..d93d74636 100644 --- a/README.md +++ b/README.md @@ -499,6 +499,7 @@ Thanks goes to these wonderful people Andreas Nordahl
Andreas Nordahl

📖 neaumusic
neaumusic

📖 Joyel Johny
Joyel Johny

💻 + bsheps
bsheps

📖 From 840d59f26110715187e8b9c16db5815dcdee0ef1 Mon Sep 17 00:00:00 2001 From: Kyle Nazario Date: Tue, 31 Oct 2023 03:04:51 -0400 Subject: [PATCH 009/123] Highlights necessary step in Svelte setup (#1330) * Calls out globals in documentation * Restores comma * Formatting * Svelte cleanup docs match React language * Clarifies cleanup docs for Vue and Preact * Instructs user to call cleanup() themselves --- docs/preact-testing-library/api.mdx | 9 ++++++--- docs/react-testing-library/api.mdx | 7 +++---- docs/svelte-testing-library/api.mdx | 4 +++- docs/svelte-testing-library/setup.mdx | 3 ++- docs/vue-testing-library/api.mdx | 6 +++--- 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/docs/preact-testing-library/api.mdx b/docs/preact-testing-library/api.mdx index ca4d8691f..18dd43131 100644 --- a/docs/preact-testing-library/api.mdx +++ b/docs/preact-testing-library/api.mdx @@ -52,9 +52,12 @@ const {results} = render(, {options}) Unmounts the component from the container and destroys the container. -📝 When you import anything from the library, this automatically runs after each -test. If you'd like to disable this then set `process.env.PTL_SKIP_AUTO_CLEANUP` -to true when running your tests. +> This is called automatically if your testing framework (such as mocha, Jest or +> Jasmine) injects a global `afterEach()` function into the testing environment. +> If not, you will need to call `cleanup()` after each test. + +If you'd like to disable this then set `process.env.PTL_SKIP_AUTO_CLEANUP` to +true when running your tests. ```jsx import {render, cleanup} from '@testing-library/preact' diff --git a/docs/react-testing-library/api.mdx b/docs/react-testing-library/api.mdx index 6150b6418..366a56f9f 100644 --- a/docs/react-testing-library/api.mdx +++ b/docs/react-testing-library/api.mdx @@ -289,10 +289,9 @@ expect(firstRender).toMatchDiffSnapshot(asFragment()) Unmounts React trees that were mounted with [render](#render). -> Please note that this is done automatically if the testing framework you're -> using supports the `afterEach` global and it is injected to your testing -> environment (like mocha, Jest, and Jasmine). If not, you will need to do -> manual cleanups after each test. +> This is called automatically if your testing framework (such as mocha, Jest or +> Jasmine) injects a global `afterEach()` function into the testing environment. +> If not, you will need to call `cleanup()` after each test. For example, if you're using the [ava](https://github.com/avajs/ava) testing framework, then you would need to use the `test.afterEach` hook like so: diff --git a/docs/svelte-testing-library/api.mdx b/docs/svelte-testing-library/api.mdx index 7af1ac643..c0171dd21 100644 --- a/docs/svelte-testing-library/api.mdx +++ b/docs/svelte-testing-library/api.mdx @@ -70,7 +70,9 @@ const {results} = render(YourComponent, {myProp: 'value'}) ## `cleanup` -> You don't need to import or use this, it's done automagically for you! +> This is called automatically if your testing framework (such as mocha, Jest or +> Jasmine) injects a global `afterEach()` function into the testing environment. +> If not, you will need to call `cleanup()` after each test. Unmounts the component from the container and destroys the container. diff --git a/docs/svelte-testing-library/setup.mdx b/docs/svelte-testing-library/setup.mdx index d5bac8768..2bfcb7f7c 100644 --- a/docs/svelte-testing-library/setup.mdx +++ b/docs/svelte-testing-library/setup.mdx @@ -46,7 +46,8 @@ npm install --save-dev @vitest/ui npm install --save-dev @sveltejs/vite-plugin-svelte vite ``` -3. Add a `vitest.config.ts` configuration file to the root of your project +3. Add a `vitest.config.ts` configuration file to the root of your project. Add + `globals: true` so `cleanup()` runs after each test. ```js import {defineConfig} from 'vitest/config' diff --git a/docs/vue-testing-library/api.mdx b/docs/vue-testing-library/api.mdx index 3bac572ba..fc5cc4a17 100644 --- a/docs/vue-testing-library/api.mdx +++ b/docs/vue-testing-library/api.mdx @@ -232,9 +232,9 @@ See a working example of `update` in the Unmounts Vue trees that were mounted with [render](#rendercomponent-options-callback). -> If you are using an environment that supports `afterEach` hook (as in Jest), -> there's no need to call `cleanup` manually. Vue Testing Library handles it for -> you. +> This is called automatically if your testing framework (such as mocha, Jest or +> Jasmine) injects a global `afterEach()` function into the testing environment. +> If not, you will need to call `cleanup()` after each test. Failing to call `cleanup` when you've called `render` could result in a memory leak and tests which are not idempotent (which can lead to difficult to debug From a54a9688944f37e4a0512cd18390946208e8183a Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Tue, 31 Oct 2023 09:08:39 +0200 Subject: [PATCH 010/123] docs: add kyle-n as a contributor for doc (#1337) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] --------- Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 1 + 2 files changed, 10 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 655eefe05..7367b37eb 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2573,6 +2573,15 @@ "contributions": [ "doc" ] + }, + { + "login": "kyle-n", + "name": "Kyle Nazario", + "avatar_url": "https://avatars.githubusercontent.com/u/13384477?v=4", + "profile": "http://www.kylenazario.com/", + "contributions": [ + "doc" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index d93d74636..b8d17166e 100644 --- a/README.md +++ b/README.md @@ -500,6 +500,7 @@ Thanks goes to these wonderful people neaumusic
neaumusic

📖 Joyel Johny
Joyel Johny

💻 bsheps
bsheps

📖 + Kyle Nazario
Kyle Nazario

📖 From 6aa5dc57eaf5a7707fc07168e2251d6ca6d62aef Mon Sep 17 00:00:00 2001 From: Giuliano Crivelli Date: Tue, 31 Oct 2023 03:12:54 -0400 Subject: [PATCH 011/123] docs: improve example of query/byrole #current (#1332) Co-authored-by: Giuliano Crivelli --- docs/queries/byrole.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/queries/byrole.mdx b/docs/queries/byrole.mdx index c40ff6469..38bc83b08 100644 --- a/docs/queries/byrole.mdx +++ b/docs/queries/byrole.mdx @@ -181,13 +181,13 @@ For example in ```html ``` -you can get the "👍" link by calling `getByRole('link', { current: true })` and +you can get the "👍" link by calling `getByRole('link', { current: 'page' })` and the "👎" by calling `getByRole('link', { current: false })`. To learn more about the current state see [ARIA `aria-current`](https://www.w3.org/TR/wai-aria-1.2/#aria-current). From 69f0b95f1fe0caf59f8be030578a6b212c9cb99a Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Tue, 31 Oct 2023 09:14:01 +0200 Subject: [PATCH 012/123] docs: add thefalked as a contributor for doc (#1338) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] --------- Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 1 + 2 files changed, 10 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 7367b37eb..ab6f6c8f9 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2582,6 +2582,15 @@ "contributions": [ "doc" ] + }, + { + "login": "thefalked", + "name": "Giuliano Crivelli", + "avatar_url": "https://avatars.githubusercontent.com/u/28029756?v=4", + "profile": "https://github.com/thefalked", + "contributions": [ + "doc" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index b8d17166e..8f1442b73 100644 --- a/README.md +++ b/README.md @@ -501,6 +501,7 @@ Thanks goes to these wonderful people Joyel Johny
Joyel Johny

💻 bsheps
bsheps

📖 Kyle Nazario
Kyle Nazario

📖 + Giuliano Crivelli
Giuliano Crivelli

📖 From e96650ee7a906b62a92e6df06496d7aa1fdf08b2 Mon Sep 17 00:00:00 2001 From: Nick McCurdy Date: Fri, 3 Nov 2023 04:57:20 -0400 Subject: [PATCH 013/123] docs: improve tabs and package manager scripts (#1339) --- docs/bs-react-testing-library/intro.mdx | 3 +++ .../api-custom-queries.mdx | 3 --- docs/dom-testing-library/api-debugging.mdx | 4 ++-- docs/ecosystem-user-event.mdx | 18 +--------------- docs/example-react-intl.mdx | 2 +- docs/marko-testing-library/api.mdx | 4 ++-- docs/marko-testing-library/setup.mdx | 2 +- docs/nightwatch-testing-library/intro.mdx | 2 +- docs/react-testing-library/setup.mdx | 4 ++-- docs/svelte-testing-library/setup.mdx | 6 +++--- docs/user-event/install.mdx | 21 +------------------ docs/webdriverio-testing-library/intro.mdx | 2 +- 12 files changed, 18 insertions(+), 53 deletions(-) diff --git a/docs/bs-react-testing-library/intro.mdx b/docs/bs-react-testing-library/intro.mdx index fec630605..316ccc9b2 100644 --- a/docs/bs-react-testing-library/intro.mdx +++ b/docs/bs-react-testing-library/intro.mdx @@ -15,6 +15,9 @@ Bindings for several testing libraries have been ported to [ReasonML][re]. ```bash npm2yarn npm install --save-dev bs-dom-testing-library +``` + +```bash npm2yarn npm install --save-dev bs-react-testing-library ``` diff --git a/docs/dom-testing-library/api-custom-queries.mdx b/docs/dom-testing-library/api-custom-queries.mdx index 452f518f7..8147ead50 100644 --- a/docs/dom-testing-library/api-custom-queries.mdx +++ b/docs/dom-testing-library/api-custom-queries.mdx @@ -3,9 +3,6 @@ id: api-custom-queries title: Custom Queries --- -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - `DOM Testing Library` exposes many of the helper functions that are used to implement the default queries. You can use the helpers to build custom queries. For example, the code below shows a way to override the default `testId` queries diff --git a/docs/dom-testing-library/api-debugging.mdx b/docs/dom-testing-library/api-debugging.mdx index 75968f5d1..972a2d7d9 100644 --- a/docs/dom-testing-library/api-debugging.mdx +++ b/docs/dom-testing-library/api-debugging.mdx @@ -32,7 +32,7 @@ value is `7000`. You will see `...` in the console, when the DOM content is stripped off, because of the length you have set or due to default size limit. Here's how you might increase this limit when running tests: -``` +```bash npm2yarn DEBUG_PRINT_LIMIT=10000 npm test ``` @@ -46,7 +46,7 @@ colors, such as in cases where the output is written to a log file for debugging purposes. You can use the environment variable `COLORS` to explicitly force the colorization off or on. For example: -``` +```bash npm2yarn COLORS=false npm test ``` diff --git a/docs/ecosystem-user-event.mdx b/docs/ecosystem-user-event.mdx index 6f5b2a5f7..ca7cfc7a4 100644 --- a/docs/ecosystem-user-event.mdx +++ b/docs/ecosystem-user-event.mdx @@ -3,9 +3,6 @@ id: ecosystem-user-event title: user-event v13 --- -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - [`user-event`][gh] is a companion library for Testing Library that provides more advanced simulation of browser interactions than the built-in [`fireEvent`](dom-testing-library/api-events.mdx#fireevent) method. @@ -21,23 +18,10 @@ fixes and new features. ## Installation - - - -```sh +```bash npm2yarn npm install --save-dev @testing-library/user-event @testing-library/dom ``` - - - -```sh -yarn add --dev @testing-library/user-event @testing-library/dom -``` - - - - Now simply import it in your tests: ```js diff --git a/docs/example-react-intl.mdx b/docs/example-react-intl.mdx index dc0bb5522..f9ea45597 100644 --- a/docs/example-react-intl.mdx +++ b/docs/example-react-intl.mdx @@ -141,4 +141,4 @@ the component in a way that will simulate the user behavior as much as posible. | Use strings from the default language | Test is easy to read, and asserts expected default output. If you have variables in your strings, you can test that they work properly with correct output. | 1. Strings hardcoded into tests mean you have to update both tests and code for any copy changes. 2. If multiple elements have the same string/substring text, find-and-replace may be hard to use reliably. | | Mock the translation library | If your library is difficult to use in the test environment, you can mock it so it is easier. For example, you can add the message ID as a data-attribute to the text so you can query by that. | Test code deviates from what runs in production. Tests may assert about message IDs but not enough about content, so errors are possible. | | Use translation library in tests | Decouples strings from tests, so you can update the message files in one place without worrying about breaking tests. Can run tests in another language or multiple languages. `const buttonText = getNodeText();` | Overhead - it takes more lines of code to write the test, and you need to know the variables and message IDs to create the right strings. It's not obvious what the text actually is when you read the test code, making maintaining it harder. | -| Use translation library + inline snapshots | Same as above, but by adding an inline snapshot of the string, you can read the test code and see what strings are in use, but easily update them with `jest -u` if the messages change. `expect(buttonText).toMatchInlineSnapshot("'My button text'")` | Tests are longer because of the extra lines. You can wrap up some of the translation-related code into a helper function to make it a little more inline-able and avoid repeating yourself, but you still need to know the message IDs and variables inside the test. | +| Use translation library + inline snapshots | Same as above, but by adding an inline snapshot of the string, you can read the test code and see what strings are in use, but easily update them with `jest --updateSnapshot` if the messages change. `expect(buttonText).toMatchInlineSnapshot("'My button text'")` | Tests are longer because of the extra lines. You can wrap up some of the translation-related code into a helper function to make it a little more inline-able and avoid repeating yourself, but you still need to know the message IDs and variables inside the test. | diff --git a/docs/marko-testing-library/api.mdx b/docs/marko-testing-library/api.mdx index 87188faf2..0a3e91044 100644 --- a/docs/marko-testing-library/api.mdx +++ b/docs/marko-testing-library/api.mdx @@ -294,8 +294,8 @@ You can turn off the automatic test cleanup by importing the following module: import '@marko/testing-library/dont-cleanup-after-each' ``` -With mocha you can use `mocha -r @marko/testing-library/dont-cleanup-after-each` -as a shorthand. +With mocha you can use +`mocha --require @marko/testing-library/dont-cleanup-after-each` as a shorthand. If you are using Jest, you can include `setupFilesAfterEnv: ["@marko/testing-library/dont-cleanup-after-each"]` in your diff --git a/docs/marko-testing-library/setup.mdx b/docs/marko-testing-library/setup.mdx index 1b6280b56..37b74e8dc 100644 --- a/docs/marko-testing-library/setup.mdx +++ b/docs/marko-testing-library/setup.mdx @@ -80,7 +80,7 @@ To run server-side Marko tests with `mocha` you can simply run the following command: ```console -mocha -r marko/node-require +mocha --require marko/node-require ``` This enables the diff --git a/docs/nightwatch-testing-library/intro.mdx b/docs/nightwatch-testing-library/intro.mdx index dd93b7282..4a9ceaf69 100644 --- a/docs/nightwatch-testing-library/intro.mdx +++ b/docs/nightwatch-testing-library/intro.mdx @@ -14,7 +14,7 @@ in [Nightwatch](https://nightwatchjs.org) for end-to-end web testing. then just ```bash npm2yarn -npm install -D @testing-library/nightwatch +npm install --save-dev @testing-library/nightwatch ``` - [nightwatch-testing-library on GitHub][gh] diff --git a/docs/react-testing-library/setup.mdx b/docs/react-testing-library/setup.mdx index 271b0e9a0..61ce15879 100644 --- a/docs/react-testing-library/setup.mdx +++ b/docs/react-testing-library/setup.mdx @@ -478,7 +478,7 @@ do this with Jest's `setupFiles` configuration: Or with mocha's `-r` flag: ``` -mocha -r @testing-library/react/dont-cleanup-after-each +mocha --require @testing-library/react/dont-cleanup-after-each ``` Alternatively, you could import `@testing-library/react/pure` in all your tests @@ -508,5 +508,5 @@ exports.mochaHooks = { And register it using mocha's `-r` flag: ``` -mocha -r ./mocha-watch-cleanup-after-each.js +mocha --require ./mocha-watch-cleanup-after-each.js ``` diff --git a/docs/svelte-testing-library/setup.mdx b/docs/svelte-testing-library/setup.mdx index 2bfcb7f7c..cc02a7386 100644 --- a/docs/svelte-testing-library/setup.mdx +++ b/docs/svelte-testing-library/setup.mdx @@ -87,7 +87,7 @@ npm install --save-dev @vitest/ui how) and run the following command to run the tests. ```bash npm2yarn - npm run test + npm test ``` ## Jest @@ -104,7 +104,7 @@ npm install --save-dev @vitest/ui { "scripts": { "test": "jest src", - "test:watch": "npm run test -- --watch" + "test:watch": "jest src --watch" } } ``` @@ -180,7 +180,7 @@ npm install --save-dev @vitest/ui and run it ```bash npm2yarn - npm run test + npm test ``` ### TypeScript diff --git a/docs/user-event/install.mdx b/docs/user-event/install.mdx index db2be35f6..9e92a29b0 100644 --- a/docs/user-event/install.mdx +++ b/docs/user-event/install.mdx @@ -3,29 +3,10 @@ id: install title: Installation --- -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - - - - -```sh +```bash npm2yarn npm install --save-dev @testing-library/user-event ``` - - - -```sh -yarn add --dev @testing-library/user-event -``` - - - - Note that `@testing-library/user-event` requires `@testing-library/dom`. If you use one of the diff --git a/docs/webdriverio-testing-library/intro.mdx b/docs/webdriverio-testing-library/intro.mdx index ab41ede9c..db760600b 100644 --- a/docs/webdriverio-testing-library/intro.mdx +++ b/docs/webdriverio-testing-library/intro.mdx @@ -14,7 +14,7 @@ queries in [WebdriverIO](https://webdriver.io/) for end-to-end web testing. then just ```bash npm2yarn -npm install -D @testing-library/webdriverio +npm install --save-dev @testing-library/webdriverio ``` - [webdriverio-testing-library on GitHub][gh] From 99f18e0dd290d2fbd6be58cf1c762bc04912e445 Mon Sep 17 00:00:00 2001 From: Nick McCurdy Date: Thu, 9 Nov 2023 20:19:25 -0500 Subject: [PATCH 014/123] chore: format --- docs/queries/byrole.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/queries/byrole.mdx b/docs/queries/byrole.mdx index 38bc83b08..c0f94a52c 100644 --- a/docs/queries/byrole.mdx +++ b/docs/queries/byrole.mdx @@ -187,9 +187,9 @@ For example in ``` -you can get the "👍" link by calling `getByRole('link', { current: 'page' })` and -the "👎" by calling `getByRole('link', { current: false })`. To learn more about -the current state see +you can get the "👍" link by calling `getByRole('link', { current: 'page' })` +and the "👎" by calling `getByRole('link', { current: false })`. To learn more +about the current state see [ARIA `aria-current`](https://www.w3.org/TR/wai-aria-1.2/#aria-current). ### `pressed` From 1a17632e5548371aba1092c6fd48ceaca88d24eb Mon Sep 17 00:00:00 2001 From: Nick McCurdy Date: Mon, 13 Nov 2023 23:00:52 -0500 Subject: [PATCH 015/123] chore: format --- docs/react-testing-library/api.mdx | 2 +- docusaurus.config.js | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/react-testing-library/api.mdx b/docs/react-testing-library/api.mdx index 366a56f9f..47c34d2a4 100644 --- a/docs/react-testing-library/api.mdx +++ b/docs/react-testing-library/api.mdx @@ -338,7 +338,7 @@ function renderHook< Props, Q extends Queries = typeof queries, Container extends Element | DocumentFragment = HTMLElement, - BaseElement extends Element | DocumentFragment = Container + BaseElement extends Element | DocumentFragment = Container, >( render: (initialProps: Props) => Result, options?: RenderHookOptions, diff --git a/docusaurus.config.js b/docusaurus.config.js index f1da30174..034cec28f 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -314,8 +314,7 @@ module.exports = { }, { label: 'Stack Overflow', - href: - 'https://stackoverflow.com/questions/tagged/react-testing-library', + href: 'https://stackoverflow.com/questions/tagged/react-testing-library', }, { label: 'Discord', From 5bf98e4264336837a6f8d870143b9f7d8ff08670 Mon Sep 17 00:00:00 2001 From: mrkv Date: Thu, 16 Nov 2023 10:46:52 +0300 Subject: [PATCH 016/123] Update svelte-testing-library api.mdx (#1340) --- docs/svelte-testing-library/api.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/svelte-testing-library/api.mdx b/docs/svelte-testing-library/api.mdx index c0171dd21..0c3851b2f 100644 --- a/docs/svelte-testing-library/api.mdx +++ b/docs/svelte-testing-library/api.mdx @@ -27,7 +27,7 @@ tells Svelte to apply any new changes to the DOM. ```js import {render} from '@testing-library/svelte' -const {results} = render(YourComponent, {ComponentOptions}, {RenderOptions}) +const view = render(YourComponent, {ComponentOptions}, {RenderOptions}) ``` ### Component Options @@ -41,13 +41,13 @@ in directly. ```js // With options. -const {results} = render(YourComponent, { +const view = render(YourComponent, { target: MyTarget, props: {myProp: 'value'}, }) // Props only. -const {results} = render(YourComponent, {myProp: 'value'}) +const view = render(YourComponent, {myProp: 'value'}) ``` ### Render Options From 7ffe7f9cd8777b868da655ef777894ace567c2a0 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Thu, 16 Nov 2023 09:45:28 +0100 Subject: [PATCH 017/123] docs: add mroforolhc as a contributor for doc (#1341) --- .all-contributorsrc | 9 +++++++++ README.md | 1 + 2 files changed, 10 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index ab6f6c8f9..c680c4ba0 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2591,6 +2591,15 @@ "contributions": [ "doc" ] + }, + { + "login": "mroforolhc", + "name": "mrkv", + "avatar_url": "https://avatars.githubusercontent.com/u/26799398?v=4", + "profile": "https://t.me/markov_ka", + "contributions": [ + "doc" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index 8f1442b73..f038d941d 100644 --- a/README.md +++ b/README.md @@ -502,6 +502,7 @@ Thanks goes to these wonderful people bsheps
bsheps

📖 Kyle Nazario
Kyle Nazario

📖 Giuliano Crivelli
Giuliano Crivelli

📖 + mrkv
mrkv

📖 From baa24a16fa6aa249423c7862b105048f8b0b0e1f Mon Sep 17 00:00:00 2001 From: smk267 <88115182+smk267@users.noreply.github.com> Date: Thu, 23 Nov 2023 01:28:25 -0800 Subject: [PATCH 018/123] fix: improve SEO for user-event (#1342) Closes #1333 --- docs/user-event/intro.mdx | 2 +- docs/{ecosystem-user-event.mdx => user-event/v13.mdx} | 2 +- netlify.toml | 4 ++++ sidebars.js | 2 +- src/pages/index.js | 2 +- 5 files changed, 8 insertions(+), 4 deletions(-) rename docs/{ecosystem-user-event.mdx => user-event/v13.mdx} (99%) diff --git a/docs/user-event/intro.mdx b/docs/user-event/intro.mdx index c3ef3533e..f4319fec1 100644 --- a/docs/user-event/intro.mdx +++ b/docs/user-event/intro.mdx @@ -11,7 +11,7 @@ events that would happen if the interaction took place in a browser. These docs describe `user-event@14`. We recommend updating your projects to this version, as it includes important bug fixes and new features. You can find the -docs for `user-event@13.5.0` [here](../ecosystem-user-event.mdx), and the +docs for `user-event@13.5.0` [here](./v13.mdx), and the changelog for the release [here](https://github.com/testing-library/user-event/releases/tag/v14.0.0). diff --git a/docs/ecosystem-user-event.mdx b/docs/user-event/v13.mdx similarity index 99% rename from docs/ecosystem-user-event.mdx rename to docs/user-event/v13.mdx index ca7cfc7a4..916391dc3 100644 --- a/docs/ecosystem-user-event.mdx +++ b/docs/user-event/v13.mdx @@ -1,5 +1,5 @@ --- -id: ecosystem-user-event +id: v13 title: user-event v13 --- diff --git a/netlify.toml b/netlify.toml index 88310e167..510f8553d 100644 --- a/netlify.toml +++ b/netlify.toml @@ -60,6 +60,10 @@ [[redirects]] from = "/docs/dom-testing-library/api-helpers" to = "/docs/dom-testing-library/api-accessibility" +[[redirects]] + from = "/docs/ecosystem-user-event" + to = "/docs/user-event/intro" + # Reorganization (do not redirect if route is not 404) [[redirects]] diff --git a/sidebars.js b/sidebars.js index ad516c830..b6d4483f0 100755 --- a/sidebars.js +++ b/sidebars.js @@ -186,7 +186,7 @@ module.exports = { 'user-event/clipboard', 'user-event/utility', 'user-event/convenience', - 'ecosystem-user-event', + 'user-event/v13', ], }, { diff --git a/src/pages/index.js b/src/pages/index.js index 6f7611c77..a4f8f2df3 100755 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -245,7 +245,7 @@ export default class Index extends React.Component { { image: `${baseUrl}img/construction-128x128.png`, imageAlign: 'top', - title: '[And more...](./docs/ecosystem-user-event)', + title: '[And more...](./docs/user-event/intro)', imageAlt: '', }, ]} From 05927607577d9fa72caf3898fe6ee2b6d390ac3e Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Thu, 23 Nov 2023 10:31:41 +0100 Subject: [PATCH 019/123] docs: add smk267 as a contributor for infra (#1343) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] --------- Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 3 +++ 2 files changed, 12 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index c680c4ba0..e00d07a3c 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2600,6 +2600,15 @@ "contributions": [ "doc" ] + }, + { + "login": "smk267", + "name": "smk267", + "avatar_url": "https://avatars.githubusercontent.com/u/88115182?v=4", + "profile": "https://github.com/smk267", + "contributions": [ + "infra" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index f038d941d..59c0078ee 100644 --- a/README.md +++ b/README.md @@ -504,6 +504,9 @@ Thanks goes to these wonderful people Giuliano Crivelli
Giuliano Crivelli

📖 mrkv
mrkv

📖 + + smk267
smk267

🚇 + From 7efbe468cb7723e08464ac4319a1f382ed6edba8 Mon Sep 17 00:00:00 2001 From: Vadim Shvetsov Date: Sun, 26 Nov 2023 09:20:03 +0100 Subject: [PATCH 020/123] chore: Improve docs with removing misleading statement on query API in cypress-testing-library (#1344) --- docs/cypress-testing-library/intro.mdx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/cypress-testing-library/intro.mdx b/docs/cypress-testing-library/intro.mdx index 8121a5be4..3c88d4d2b 100644 --- a/docs/cypress-testing-library/intro.mdx +++ b/docs/cypress-testing-library/intro.mdx @@ -22,8 +22,7 @@ Add this line to your project's `cypress/support/commands.js`: import '@testing-library/cypress/add-commands' ``` -You can now use all of `DOM Testing Library`'s `findBy`, `findAllBy`, `queryBy` -and `queryAllBy` commands off the global `cy` object. +You can now use some of `DOM Testing Library`'s `findBy`, and `findAllBy` commands off the global `cy` object. [See the `About queries` docs for reference](/docs/queries/about). > Note: the `get*` queries are not supported because for reasonable Cypress From 35a64b8817cbe070c1200d086887601ff53ec3e8 Mon Sep 17 00:00:00 2001 From: Matan Borenkraout Date: Sat, 2 Dec 2023 20:55:59 +0200 Subject: [PATCH 021/123] docs: add redirect to new rtl template (#1346) --- netlify.toml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/netlify.toml b/netlify.toml index 510f8553d..749958cd1 100644 --- a/netlify.toml +++ b/netlify.toml @@ -32,6 +32,11 @@ from = "/discord" to = "https://discord.gg/testing-library" +# Shortcuts to reproduction templates +[[redirects]] + from = "/new-rtl" + to = "https://stackblitz.com/edit/rtl-template" + # Support page to help page [[redirects]] from = "/support" From e10d2567eab5ab2dba4194addc0f362c50a837c2 Mon Sep 17 00:00:00 2001 From: Matan Borenkraout Date: Mon, 4 Dec 2023 19:48:15 +0200 Subject: [PATCH 022/123] docs: add redirect to dtl template (#1347) --- netlify.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/netlify.toml b/netlify.toml index 749958cd1..b64acf689 100644 --- a/netlify.toml +++ b/netlify.toml @@ -36,6 +36,9 @@ [[redirects]] from = "/new-rtl" to = "https://stackblitz.com/edit/rtl-template" +[[redirects]] + from = "/new-dtl" + to = "https://stackblitz.com/edit/dtl-template" # Support page to help page [[redirects]] From b30ab035e5bc2ff960a6f91cb57435690adaf114 Mon Sep 17 00:00:00 2001 From: Matan Borenkraout Date: Mon, 4 Dec 2023 20:57:52 +0200 Subject: [PATCH 023/123] docs: add atl redirect (#1348) --- netlify.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/netlify.toml b/netlify.toml index b64acf689..4a6bf62c2 100644 --- a/netlify.toml +++ b/netlify.toml @@ -39,6 +39,9 @@ [[redirects]] from = "/new-dtl" to = "https://stackblitz.com/edit/dtl-template" +[[redirects]] + from = "/new-atl" + to = "https://stackblitz.com/edit/atl-template" # Support page to help page [[redirects]] From 5e9c7e0c51019edd185a677442906936ade992b2 Mon Sep 17 00:00:00 2001 From: Tim Deschryver <28659384+timdeschryver@users.noreply.github.com> Date: Thu, 14 Dec 2023 19:29:11 +0100 Subject: [PATCH 024/123] docs(angular): add v15 to compatibility table (#1350) --- docs/angular-testing-library/version-compatibility.mdx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/angular-testing-library/version-compatibility.mdx b/docs/angular-testing-library/version-compatibility.mdx index 8a1ff4b88..7765c43cc 100644 --- a/docs/angular-testing-library/version-compatibility.mdx +++ b/docs/angular-testing-library/version-compatibility.mdx @@ -8,7 +8,8 @@ Library and Angular. | Angular | Angular Testing Library | | ------- | ----------------------- | -| 16.x | 13.x \|\| 14.x | -| >= 15.1 | 13.x \|\| 14.x | -| < 15.1 | 11.x \|\| 12.x | -| 14.x | 11.x \|\| 12.x | +| 17.x | 15.x, 14.x, 13.x | +| 16.x | 14.x, 13.x | +| >= 15.1 | 14.x, 13.x | +| < 15.1 | 12.x, 11.x | +| 14.x | 12.x, 11.x | From ef68559e40a09ef39a646c688a8b0a874fda4d9e Mon Sep 17 00:00:00 2001 From: Tim Deschryver <28659384+timdeschryver@users.noreply.github.com> Date: Tue, 26 Dec 2023 15:46:32 +0100 Subject: [PATCH 025/123] update angular logo (#1353) --- sidebars.js | 52 ++++++++++++++++----------------- src/pages/index.js | 48 +++++++++++++++--------------- static/img/angular-128x128.png | Bin 0 -> 9313 bytes static/img/angular-250x250.png | Bin 2385 -> 0 bytes 4 files changed, 50 insertions(+), 50 deletions(-) create mode 100644 static/img/angular-128x128.png delete mode 100644 static/img/angular-250x250.png diff --git a/sidebars.js b/sidebars.js index b6d4483f0..03a2a5c65 100755 --- a/sidebars.js +++ b/sidebars.js @@ -109,19 +109,6 @@ module.exports = { 'react-testing-library/cheatsheet', ], }, - { - 'Reason Testing Library': [ - 'bs-react-testing-library/intro', - 'bs-react-testing-library/examples', - ], - }, - { - 'Native Testing Library': [ - 'react-native-testing-library/intro', - 'react-native-testing-library/example-intro', - 'react-native-testing-library/setup', - ], - }, { 'Vue Testing Library': [ 'vue-testing-library/intro', @@ -132,13 +119,6 @@ module.exports = { 'vue-testing-library/faq', ], }, - { - 'Marko Testing Library': [ - 'marko-testing-library/intro', - 'marko-testing-library/setup', - 'marko-testing-library/api', - ], - }, { 'Angular Testing Library': [ 'angular-testing-library/intro', @@ -148,6 +128,22 @@ module.exports = { 'angular-testing-library/faq', ], }, + { + 'Svelte Testing Library': [ + 'svelte-testing-library/intro', + 'svelte-testing-library/setup', + 'svelte-testing-library/example', + 'svelte-testing-library/api', + 'svelte-testing-library/faq', + ], + }, + { + 'Marko Testing Library': [ + 'marko-testing-library/intro', + 'marko-testing-library/setup', + 'marko-testing-library/api', + ], + }, { 'Preact Testing Library': [ 'preact-testing-library/intro', @@ -157,12 +153,16 @@ module.exports = { ], }, { - 'Svelte Testing Library': [ - 'svelte-testing-library/intro', - 'svelte-testing-library/setup', - 'svelte-testing-library/example', - 'svelte-testing-library/api', - 'svelte-testing-library/faq', + 'Reason Testing Library': [ + 'bs-react-testing-library/intro', + 'bs-react-testing-library/examples', + ], + }, + { + 'Native Testing Library': [ + 'react-native-testing-library/intro', + 'react-native-testing-library/example-intro', + 'react-native-testing-library/setup', ], }, 'cypress-testing-library/intro', diff --git a/src/pages/index.js b/src/pages/index.js index a4f8f2df3..f4857df84 100755 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -183,16 +183,16 @@ export default class Index extends React.Component { imageAlt: 'React logo', }, { - image: `${baseUrl}img/cypress-128x128.png`, + image: `${baseUrl}img/vue-400x400.png`, imageAlign: 'top', - title: '[Cypress](./docs/cypress-testing-library/intro)', - imageAlt: 'Cypress logo', + title: '[Vue](./docs/vue-testing-library/intro)', + imageAlt: 'Vue logo', }, { - image: `${baseUrl}img/testcafe-128x128.jpg`, + image: `${baseUrl}img/angular-128x128.png`, imageAlign: 'top', - title: `[Testcafe](./docs/testcafe-testing-library/intro)`, - imageAlt: 'Testcafe logo', + title: '[Angular](./docs/angular-testing-library/intro)', + imageAlt: 'Angular logo', }, { image: `${baseUrl}img/svelte-logo.png`, @@ -201,16 +201,10 @@ export default class Index extends React.Component { imageAlt: 'Svelte logo', }, { - image: `${baseUrl}img/vue-400x400.png`, - imageAlign: 'top', - title: '[Vue](./docs/vue-testing-library/intro)', - imageAlt: 'Vue logo', - }, - { - image: `${baseUrl}img/angular-250x250.png`, + image: `${baseUrl}img/preact-128x128.png`, imageAlign: 'top', - title: '[Angular](./docs/angular-testing-library/intro)', - imageAlt: 'Angular logo', + title: '[Preact](./docs/preact-testing-library/intro)', + imageAlt: 'Preact logo', }, { image: `${baseUrl}img/reason-200x200.png`, @@ -218,12 +212,6 @@ export default class Index extends React.Component { title: '[ReasonReact](./docs/bs-react-testing-library/intro)', imageAlt: 'ReasonReact logo', }, - { - image: `${baseUrl}img/puppeteer-275x275.png`, - imageAlign: 'top', - title: '[Puppeteer](./docs/pptr-testing-library/intro)', - imageAlt: 'Puppeteer logo', - }, { image: `${baseUrl}img/react-native-128x128.png`, imageAlign: 'top', @@ -231,10 +219,22 @@ export default class Index extends React.Component { imageAlt: 'React Native logo', }, { - image: `${baseUrl}img/preact-128x128.png`, + image: `${baseUrl}img/cypress-128x128.png`, imageAlign: 'top', - title: '[Preact](./docs/preact-testing-library/intro)', - imageAlt: 'Preact logo', + title: '[Cypress](./docs/cypress-testing-library/intro)', + imageAlt: 'Cypress logo', + }, + { + image: `${baseUrl}img/puppeteer-275x275.png`, + imageAlign: 'top', + title: '[Puppeteer](./docs/pptr-testing-library/intro)', + imageAlt: 'Puppeteer logo', + }, + { + image: `${baseUrl}img/testcafe-128x128.jpg`, + imageAlign: 'top', + title: `[Testcafe](./docs/testcafe-testing-library/intro)`, + imageAlt: 'Testcafe logo', }, { image: `${baseUrl}img/nightwatch-128x128.png`, diff --git a/static/img/angular-128x128.png b/static/img/angular-128x128.png new file mode 100644 index 0000000000000000000000000000000000000000..e688de075720500b18d93a565188417d0d783492 GIT binary patch literal 9313 zcmWk!Wl+=)6aL+Cz#VyXiL`*Ew19AwbVzsikphB993>rsAd*LS2?&xW3X)RNUD6HG z@c!QqyZdE#c6Mj?nVs1uT1!Kb5RVoQ002T|C3)@tEb9LP#raSFkg^*1&w#wN6=i|y z-;cHdfDurZm(lez-#3H#=}k16BXhmTdcu|E|1w#T+mbq{mlqA^5xIhP<2szHuqd&~ z_mRf2SWopTCRQu-bHC!zkLU-Sm;DSe#zk-nJQ+Mihr=1ybJ`yxi8uG&MNdI1m7X2Zy1Fn6Shb&EY~}9ypL%CkMJ-w2p|N+x)hh8owqnRjsS*43aog! zAElva;J*N-DqFGi8)@;WGD3XY~8TWs>(|##aocrr)VD;?D+M`<|?DZy2 zzTL54jacn_a~xSuP*hiXBH8A1hF;$ZRRB)s5AxF@0D(y@wkDbAG#T@6VB0BQy=IrX z;!w|wwi`&+>$-zQYWJ)-ozRdhkNMkqVgh(=GtdU!G$pcK7TkDojt9J1HQT)pn4UdF z#MC9Dli-Z-{CBOyb5&8}7ITN!-k5)GV9)0yV9+2lOb3Uz_bM}6%|7}XC)^(dXIEYnp!QL$rd3iqT0aCj-y>WlwVKnEVf%H}b(jQR7 zpPHPnLw#^@pm`?!Nda15o2+v`-0pc$QXnB{ULIIbY7&IVBf__EK?IWi=D#%8 z8iEXN>wX)K9LBDJnWUIdtXvx4GjbMqHDkC1b}Lu#J8R`#`rB{UKzJMkrF~`+GirQW zoigdIq_1}ug)mixxB_o6Ov*qgz@{ms6i_rYpFs6<`(~V{$2mk3_hY*nu*n67<0+$m zhjc?p+)@!beWyWzCnf5WMvN|;IJB_ORL^b6fibynC*M_XP;eXQF&?waV8SOY)@UUF zt%a4q0n_RQemhFkoJ#nBP*-;Yn#7ELCLxK4+8ZWpaFYBM-KU03RE``t~34}K-6AmfH#<%cE&H{-g0!j-FI0#)M$$Gt$|Kwq?p?4(-gwbd# zdiyv%CQtSEOSB0a=5tSHeXmOBNj*wsYbHbl(5hiFo&LM##;5b0d+DxY7H+XOWwbZ6 z`_PR|>VZQ7QNb;pM~#6IrSdS6XYk&s;b)e|>dgM7mR93a0&K5Ky@0)vEyW~*S1m`@ zOqSdrB7I6(wOvNgbPepf0mhkp1ajO0@(qKwX>=V4iWqWE%A@h~3WxE-{m(sMcX^S^JJ~*hmC-)z_hqx|u z6VjqYu`G!dPG7Qq$kSCny(X{naZ0pQK$Dsm%nc6Rn3)-NA{z(6Ue`gM6fnP+=npNoZbA zVJ#EGYO4g?f#SD+?&sCM`kND%VuzmG(Q*vJLzOCB*uGx;d@ffpT{K;}+*v=L(czYO zehgQ^=>OK)PTv7%!VXu`dN&*PN3M#@1LzfOSd_!8;_SKCr|y=%T#wY9YPXs z+~~MuB;`wGWhwAf3`z_yiZGQ8GKCZvd7=QGowu`WuwYzhVpePOsJ7Ik5TkHHBgONd zc&HunyTy?DMB;E!NE){wX>) z0j6#41>H@E?5#LKUti_t7LenFwD9h>a92F1W%?t$BWxeW*w0q_b5fPnv;Ru9UaEYk zmx&V4E!nyt`26A#%#97R@+K6-A8o}E={y_HF{YnKAJ7Y)q&GA`W9J<=g{K$?j$KsC zS^YQIM>3tm!7`)=AD>D%Rz1%+(|zgT9ZK1jfaGUl4XLT7iJn>a!TTvkmC9;f6W^QH z19(&=1}{mRExgk1GL)ChDKU)f>3!A_vohg@bJvrLWK0k7SU@P>%bBzSInU|9bUr#oABDEbiZj9RMg3jBl z2n=vN^_Albtg+sFzBN;28(~QmIKH)GGqkxd5CqbH4lK&JOUiP%iF_RDO5ibb`1R*Z zoXi!Hoa61vmcgl=B6$;mGWE4`fI*d`+Y>W_=ac1}?h+`qcpMMUXUFhKsCN6bl^LtB zU0(MZzf)lz_=}(4%MJ}-O#VronSR~!L7f{YeRSJn%S??M z^$x^1puu4gcel`tMPK>+esL5x;RydnJ3o2Dq$ZTFF+=onRju~ko6@glIE~6^kJL*0 zeg7g%CAs_K2DG$`6fVn-}tcg6-}gM^*z@ z?748oEi$U}lHkM_O{?aaQjG8))Xm!Qkwf=1uN)t$MU2+vaq`68kf}ViT4!2)PQ`a_ zQ9pR&$xHp3A(juzY-X%u6zUr|vJW+%`K+-;b>oD>G6BInbamJkZ=nt!m-?Vo z1At-<(PHJg8Q#*&5nWsu2t_9&KSl$9hn4e|S8iOrh)%Sb-g(+2eZmG@@!DHKEzs z&ydnjFnF98whSYJ!6Fz0P<{AYo$>v?@}BFwk1VGz%H3E}iEHp~(Nh$vv^8Qsff2Up z6Hu_*ZWsp$^H)4{N;xU%AiGO3omlI~!3cdTAxj(q(99$c|K4))H~v(jJy_skx?BH5 zUDN6pHu$FfVXL|Lxca5h0IM~w>RcXItqc4~^ceeG71i{V+GrFf8QN5v`7lO%-gNv~ z857nPEU#lcV_*4_09EkHt|I>*kNTYmUQ|GK8cZCPoOAA_+5vbw#A5$Aj2^#+6~BeD zgpK8R4X=MuO^gUzY8dWDfXnH#=w6x+&xv_5aA~X_8M3|4;$Vy*8AC1aL@43Y0HqzU z>5tjjy>#E;zV zq|c8=6hn`Z0=@WS{r!1UH}cN^>at&ofkB6DLq*R7KHYejpGUV^$s^BQyCMTy)$cQA zEK;(SlVg|lIE8ErV`UpP0+(m~8%9`b05Tqg$b)D7<0Z+$YpEGlJwD%A*Wr{d;;tM) zzpAM*NkvpB$p#H5Y*v5y6}1*xRrKkfe{d+IE%6hz5_!{wxxm@Im=PwX-k`PWkXf=W z4j>a(;2tp!YT=LTQV_*TPo`SNV+v(_l=60ne~hP4RP-A7H7{)q2x;1P08(F*_K8YyBaQJ~~pS{yWtkpym zf-0O~L$PDA?oAUhCLZ23NHgSEchpMN{hY>Fo$fsM;U5>|(iNPS!6Rmdj|$#5dp&mL z$uMrbU9li~9|7>{a$~*`+H5dEyULdg9Kj2!eYtn%!dze6dN}~yM>l({AZup6bop`m z3Nq}No)ScPmL)}pbXgK||YOWC&bN2d(Mwc!LTR?K_`k0I- zQ3vvl%YUl_n|VLd)&93(E|?b{)OpxHZV{J>y(c`h)e@8gd6s13Uk0S_fLZHNWwZx; z1n1Mt%e@b#A6~o=1T4cRa%_SnOjWKWYNj?Pq$aOjnK-b4ugxSauqrpuasRx+CuypZ zbL4SJMH-j?V3q;|`{nI+_6uf<$`E|Rd0zz?t36(5FCRqh_g32q9_O-=6Cyo>jDHkF z3oi^06Co+2%nRCWp@=shj^iHzEDdr?G*}BSz7e3y+w7Mf>vW7cS+0?eCCg{Tz|uCk zoyJnU&O8MWVpnDs^ii_EQ?lY-wf`Gs9N6+rW=wC!IX5wCcBi8z%%Uw;@qRK-{>5*s zjh8NsH0nSf{ZsvL|fdQCu z_jxh=|DY5tS{$?XY@imyAW_30ha#?c|DjfQZyhI&4jPeHZ>g`KPny{N#^;~I=MS)k zvSq16pAXB&p*`FK;PNpCyk>uexTja~Y4Xsb+AWSN2 z1SR{cuP+v&b405h+n&k+Xxz7o!%GdvZLEBW{dxeuBm+f+_v-T^4%;v9Z&nX-H+k20qzuco^^Bvzk0&*EaPRW{yLGX~|zQ#_Zx$N+F$H>oBp|Q+EW2TPg<4Pcc8% zb|Z@VwX_>ho@R#c``X`5RSnP3;))@2U_u@7?{ABh6}lHm5n?ZmL>vrURQ;45ia83+ zz{g{j;Bxpo&YGEiI*}ev8D71)Lz9J#?nJ0(=>hNGed;U9@L zRbCmBK3)<4~} zh+4@n8q}pH0V>oxBXHLa)YkEQGM#(e!gaiu*~HyNNq)HR`By>lgQ8c$Td6eABR=D|=#{mI?Q2hT|OUZvZ4K6MM!s1FG5TF>Ae zmR1BlWd{1^S3ioh=AmvtYGJgjlYocK=0*n#k|w&^j+=-C1WSRaN);2dE^4 zMGK&uHx<8lKN0`_=d-IiU91JM*0!mS)(9~ysIDeT182J&{TquKkuH1>y}bE5&|^y5 zd5$#u@@3%R(Hcptv}2bL@|qwYo7U>`lba7W`GoCW`AK_QUd4S_rh@gZqHZ528HwbQ z=N&#|m9+1Mp_pt{Pbi3|LAGc^u!W2i$*=tk`B>;a{x5u+w&J&M_r`Og#{N95$JI zgP7;Gw7H}buVElnx;5MdK7k(XPDL}NO5vak+)T&UL&aVL#~{ql0}1~ZM~}c}zt4en zGv2QEnq=UoxaFVTf-uPEY)#o@7wfH3{${^QC`qgj$sgSBoQ;VX8zj%$Xam&0F;Wtn zKI|JCrC72b&k)hsldjHar9d~-R zU=i6tM*j0UnfFyv9>TuNx9$;bP%vdgNaYVD`}vkmQ6 z9c^Im$-uK-x>qe}>xD)WkVwuc4pNVER8q1elT4-CpC`SCO&+Z7qohbBM|Q8BXLP|p zln$GpxZM!9-Dku;qMCZYRoZ-RefTprz|!{S-|fujjCkA0rBhuiz+swMT8uFk=S51&EoR&XGUxv(8qOGvs zV71k*#WR^G1_`>+TmD4j?dG_2z6FC8OK4x}mWdI-^x6?h)NclQiW%&vfriW3(es4G zt#`3!{(#-BKgD~TA5v?%Nn_HIA)#IUoqs<)-upg{1AHEjiQL)oPNL5_O z+g01(-pzPpykF-H-EsyIg2RC})CiJAMolVcw=};QwEP7_w*PgWfiYpq7(o$D4u^VZ zl0FOWYI%YbBml%WbSCRcDQpeW02x&skp6zWyw+!O^Pt@^Wu$YMR8_*X-bKjLuPE#hIc}i~AREQ+AfbxA7edBtt z=?NS46A1YVYDT^)cwLuCgD&V;!(AGq2#7vg;!$CLK#Np%iac4>3M$dNNPJws!O46m zoeJ1Ji;`8sG*TF;pTz20ySVNig8{(To305C@)rcOs_by#IbvVm_TA-96rUrRN}B@8 z_7zQI6)Pk(2f&GqbCZ04sbxOg2~q1ef87&k=A<`{jCaLU)^hCz%_$;;$f1K@>y9?F zQi%gUsTFFClSz?Exl`Q#*#CMLjR;T-o#v9UC5cJwad#Bw=Dpsm`w#V>kZ#?tiH01} zA+)d&Fh)r>hl!8DLclU64+%O_nsa5x<*+ArYk$k(t-T0gk)F68o&0PEB{}%9n(FvhZ#Tx22IY3C|5+6&u9~b3YXS z>x7`LqV0hF9x^-M8pPR^_FJA&4k|U9c@8-$SH_nXw6YnmSX058A_7_#&d@D-apA-! zmG=`cPxe5fAdcNb_R5;zqpdH*tS6K8i*jTlBHwuGK_eT*(NLjiIImmXN!=%xgpPZS zA9)g95~C@JybKBeA8C|?`_iAYoH!gzLbYfDdp_)2#bfs>Il(z9?=74!9gk=9ZZ7EC zy)xySgI9a(Qv}I?V#>~ffpZ&JsnbC@`=MLyeTLky#=mw~t{_m0S8 zUBi%!u?!s7(-9Ri3?2em8d+**#@NV%XP4^owzJ|0u*SDLtWJ9FrW3 z;zsW_rRzm)1J=+T(O!5!w`s=>ZDMHHz1p!%Kt7_Vb8SYG@vc^6h~Af0{HxlsOx*ZX z5He7SVti1H9l z*v9(UKdbY=b^WXNgdWbCl61s&J)F~lJkzU3_wt2b{u383HF^;x>L3ZYhvBr=kTrnu_}G`>n12x{&PihK=$#ArI0h=!){^J0Scc4damWJHMK|s z2^e3IKnJ-hsp)SL*m0lL;NDL91AyzDgmK`Z2%|ruMx43+M9gmEL*B#I^H#|hrbSsq zV26@gD1mAA#zP@C9LRGc0O&A@sX9juQ2=^d!(VGY~vV z^RD{f9md`dx|BW&)UMW4ZbUe+jHsELmb<;oJ5bq>2N6Nf{84|R5MdEAAId>zK{5v# zrWyA>b7ENE&mU-^GBFPZ`ZW(Glz_C7br;LYFlT9-z(2MPPn#lhz*2GG)B(U?@0df{ z4p9r<7*NRU8)s>)^Z|UmU`VLrN)$!tXfXk&wN`{LCA2JPNh5$2LY4%Prm^fI?hXD{ z``WvTn=_FNLW2*`seanX%4L@{wpN>{7Aa2y{pl{`2J_ zi0yh|aJO!Ascy|-YM?jXR~|p?zzVo*HNCi)Pm>+dW_2v+W>`8=H~B{Rpmyp+d)In^ zu*e5T)|-0-zktJJ7J`3~F>C|>9rIcvP^m~zCB9O*5~BULG82iVHP=Djtt>VDZd$!3 zm`M(V)+w`lzPW)<(iSVPNH*Qm%d*MFRp8gtn}}*&}DT)-RHH-?YPK zd|1z^fFSd-da<9lo)CHxYbLu?M^^ToQ#Bp`iiO_*tyhh#gG?zMXbVz^PX+)G;{S62 zhBD#+TcDH!^Eu$A6-N%P1x|T{W6ey1lAc+byQX6Q(Yx?j{A!j};Btjh@69IBA!Sk< z6-==#+F))F=|$MR^hp5}13R-ledkJqa5r>Gi;@_?oLj3^gQ$V&kF}#7l)K=4iaAA3Da*@~_<6(a}xL z+K90dQv4Ep-9v!`e?!~>hdLiekc1@QX!&ADX0Q8n??(zyw}tZ3c_>6QG24?KLXE|H zqFgY3CzA)ylI$U)0oPQOg1rz{vz(Pgh!{^LYUFH?E5wo%?#<6qc`k#8-~7XUOR9)6 zNuNLvDAJaMdPuXOfvMXskhQ8XIQcU{N`@ztLWJ3J3f z1=%W?6~en~SN@PbFZ8*sgzWaUs3PyURYsJT!ErNtYs+DUFA#-7$I8bL(gqgb0}HW` zrKVBvQrDu(jg>a$37(QW)YAvGz%%cRQi7alSZRNm*p(e&P#U9OSUJ|4+}V}ezNiHw ze6B4G*1B}~(YU}eYrP(V0yvnH&~jC0c#qsJt#Vcm5=R7XVFVF=5 z8LV*cH>cm~+a`~Mt0|=;_OFo+IW>tv_qDi)a;dE*&A$}Nq4o6_w)-7etn&$|8Rr4o zRf5o2msbur+3=Br-&JljVOiF2+2qoX%S%mI9nGQ)=5tL=OihKs@7oAEcyGPT9<9|{ zqRv8?qt3qbinWvZuRew}51u`+eO`(VpOq0J5926Y)X%y2tD~H|Npc%qwbCs-yCA=0 zL`9}!@Joyvq*Wz_64a2@lmt*E)GxHK0}^dgFMhFpP)Zj#a)B*2Pab``IKME>MEM_V zCQ?&rEku;NFp)>`TOZ-^F?GEI)zMzcPj$RBvPvbCA$h;#WgPzz_Ne{ITZ<&Z71KGz*U z%tE*BD)1zCDGirF_|%Laz&M}g9Tkl%l7 zgaJk!hvJ0a6(GPzXymhhIu2mFGx%rptuTO2z!BFW9tTir*`LM5YjA)+qX>r`D_S6_ zOi)L0a{@q#({8D~P{RTQeC&6&+GqhSMXcHM!9+u$2FwSRhKg2B<&>E{G!#O# zwA6e=j)|gO?V+h4plBtal?v$qDI=3vgaK)w- z0000O;O~7%hw3kTnZE99-CJR-15QX_sE-c&4ED4e*$MUSznU)mkNyA5Kl8u(I!A2c z^2*FfcJ9u|rGiEI)VyNq({Ykkt9^SSZGL!kc4TzSGn%*mxawJ#qP=Tm$NsL}{!{ci z>HRw0XkGb-y+_$jMHy)#GgHe@3YgxRlDsIzilq0|Sw&Y(Mu@wkSyKF}g2KfF85E0efvcWi^e-(3c~#)b>`TQ2)>6zHAmrMd-Stf-V=Oj zU|bgI<@i-s9DGM~8e77!JU&BVo2CnzGbOe#tP;Vul%}y2h;}~u-%*q<+MSR8BC3L7 z8XSt4URzS*4V`AssYpj|Vzz9q78l55t9WVHt=T2?Gut}JIRsIh z1%d!9ZTJz0B;Ds&fZx58g;kJ+7Y{6mdr%8A^3Vy)yS)| zsbKXMQWg=wJBnuq3Ta7hXa)wz;|x+dHDw#{0*dc&FU3?ws*lXV1bG|vkTrJc?lHjN zxV+q;QM+`wt7km|b_ZnGa6omy8ka&`>FSU(Au&;`u4v~q>eRrPTlEkZxaSP+X!}zh z6N!0pnRbDHC4JX!?2S_{tb*eRhOZP-d-2#)A`^8SoC@*u8x4$*m2wC>aof*q=r%;( zmNzNY*S9Ky_l(sSQ#xn(hSs>Z_KQE=1bH>kWPX7H=X26Js;1gbJRzO;(y*u^y40Wj zaWqDG)+ibnjM@fe#20WE*K`(wgRBxQx1!**kM4qD<>d}Cy@?|8^A>n3FYDA^i2&%{ zJq|%w`VNpzg;y{@>$8Vq`_*}j%^zd6LAyr^4t$aoy!<>Yi?--az z<(m^N4e1+Zs#fz#YbgQY%Y@}o2$PfR^Fc-SYQbHwr}|Mb#im`NE9?#4bFoai`C7OS z*kl*k}6{1T5!RH3W5Y$66%T7aX^xOg+9-zpuWmVZpO|{MrF-usr&Ys6i zc*u*CfGr-Xhud&(J=JJ0Hh!a8a2*_+r5se)NN&(Mz^w(ca4>6fz?QI5xZwh`r>3w) zJ#_cjpv1__V{MBY2(%$D)L#CVn0F(Ed=1PK@&C1~<@p)aI19Qs-VZhFOeJ2=fw%BE zeD@;Mv2wA42gDf$Z|yGe?&rm-E3O@ib%OKfFGcD%-)uc~D|u=lX9})i9u#E{^z=J@ zW;PP7!XToi!*f#X&k&K07^%;&u@{jD4b}2*X(> zHAR)l?@tr{f;XS4{zoHs$fb(Uae=f|%+IzkH>wDm1X93VnR*{`#WYgXrDQ*3x*D+Y)Ihu{Q7!rfGMwO?^v ljI?SQ9hwt}{Ftxy#)W*NndmOdGy3wQ2l&9ft34yn{|yqu>aG9) From ec7cd8c4a346203a614cc9ff585246e9f72f252e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 10 Jan 2024 09:06:32 +0200 Subject: [PATCH 026/123] chore(deps): bump follow-redirects from 1.15.1 to 1.15.4 (#1355) Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.1 to 1.15.4. - [Release notes](https://github.com/follow-redirects/follow-redirects/releases) - [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.15.1...v1.15.4) --- updated-dependencies: - dependency-name: follow-redirects dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 576c1ee6d..c116be159 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12790,9 +12790,9 @@ } }, "node_modules/follow-redirects": { - "version": "1.15.1", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.1.tgz", - "integrity": "sha512-yLAMQs+k0b2m7cVxpS1VKJVvoz7SS9Td1zss3XRwXj+ZDH00RJgnuLx7E44wx02kQLrdM3aOOy+FpzS7+8OizA==", + "version": "1.15.4", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.4.tgz", + "integrity": "sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw==", "funding": [ { "type": "individual", @@ -36717,9 +36717,9 @@ "dev": true }, "follow-redirects": { - "version": "1.15.1", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.1.tgz", - "integrity": "sha512-yLAMQs+k0b2m7cVxpS1VKJVvoz7SS9Td1zss3XRwXj+ZDH00RJgnuLx7E44wx02kQLrdM3aOOy+FpzS7+8OizA==" + "version": "1.15.4", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.4.tgz", + "integrity": "sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw==" }, "for-in": { "version": "1.0.2", From aa016e27994e7eeba5f5bbb66dbdd72e6207a26a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ernesto=20Garc=C3=ADa?= Date: Fri, 12 Jan 2024 15:14:57 -0300 Subject: [PATCH 027/123] fix typo in user-event's paste event documentation (#1357) --- docs/user-event/api-clipboard.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/user-event/api-clipboard.mdx b/docs/user-event/api-clipboard.mdx index d6161bd4d..10c935213 100644 --- a/docs/user-event/api-clipboard.mdx +++ b/docs/user-event/api-clipboard.mdx @@ -46,5 +46,5 @@ Paste data into the document. When called without `clipboardData`, the content to be pasted is read from the `Clipboard`. -When performed in editable context, the pasted content is inserted into to the +When performed in editable context, the pasted content is inserted into the document. From 960d86f41ec276022c1c64891f7e6258a28c547e Mon Sep 17 00:00:00 2001 From: Tim Deschryver <28659384+timdeschryver@users.noreply.github.com> Date: Sat, 13 Jan 2024 16:51:54 +0100 Subject: [PATCH 028/123] angular: document deferrable views (#1354) --- docs/angular-testing-library/api.mdx | 44 ++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/docs/angular-testing-library/api.mdx b/docs/angular-testing-library/api.mdx index de6b61298..9518a20f1 100644 --- a/docs/angular-testing-library/api.mdx +++ b/docs/angular-testing-library/api.mdx @@ -395,20 +395,39 @@ properties that are not defined are cleared. ```typescript const {rerender} = await render(Counter, { - componentProperties: {count: 4, name: 'Sarah'}, + componentInputs: {count: 4, name: 'Sarah'}, }) expect(screen.getByTestId('count-value').textContent).toBe('4') expect(screen.getByTestId('name-value').textContent).toBe('Sarah') -await rerender({componentProperties: {count: 7}}) +await rerender({componentInputs: {count: 7}}) -// count updated to 7 +// count is updated to 7 expect(screen.getByTestId('count-value').textContent).toBe('7') // name is undefined because it's not provided in rerender expect(screen.getByTestId('name-value').textContent).toBeUndefined() ``` +Using `partialUpdate`, only the newly provided properties will be updated. Other +input properties that aren't provided won't be cleared. + +```typescript +const {rerender} = await render(Counter, { + componentInputs: {count: 4, name: 'Sarah'}, +}) + +expect(screen.getByTestId('count-value').textContent).toBe('4') +expect(screen.getByTestId('name-value').textContent).toBe('Sarah') + +await rerender({componentInputs: {count: 7}, partialUpdate: true}) + +// count is updated to 7 +expect(screen.getByTestId('count-value').textContent).toBe('7') +// name is still rendered as "Sarah" because of the partial update +expect(screen.getByTestId('name-value').textContent).toBe('Sarah') +``` + ### `detectChanges` Trigger a change detection cycle for the component. @@ -473,3 +492,22 @@ screen.getByRole('heading', { }) queryByLabelText(/First name/i') ``` + +### `renderDeferBlock` + +To test [Deferrable views](https://angular.dev/guide/defer#defer), you can make +use of `renderDeferBlock`. `renderDeferBlock` will set the desired defer state +for a specific deferrable block. The default value of a deferrable view is +`Placeholder`, but you can also set the initial state while rendering the +component. + +```typescript +const {renderDeferBlock} = await render(FixtureComponent, { + deferBlockStates: DeferBlockState.Loading, +}) + +expect(screen.getByText(/loading/i)).toBeInTheDocument() + +await renderDeferBlock(DeferBlockState.Complete) +expect(screen.getByText(/completed/i)).toBeInTheDocument() +``` From e3010361c63ec11b0975a03ec4642503538fc197 Mon Sep 17 00:00:00 2001 From: Dylan Gordon <3656794+agentdylan@users.noreply.github.com> Date: Sun, 14 Jan 2024 04:52:37 +1300 Subject: [PATCH 029/123] docs: add query ByRole performance notes (#1349) --- docs/queries/byrole.mdx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/queries/byrole.mdx b/docs/queries/byrole.mdx index c0f94a52c..7c70db2f7 100644 --- a/docs/queries/byrole.mdx +++ b/docs/queries/byrole.mdx @@ -462,3 +462,20 @@ You can query a specific element like this ```js getByRole('alertdialog', {description: 'Your session is about to expire'}) ``` + +## Performance + +`getByRole` is the most preferred query to use as it most closely resembles the +user experience, however the calculations it must perform to provide this +confidence can be expensive (particularly with large DOM trees). + +Where test performance is a concern it may be desirable to trade some of this +confidence for improved performance. + +`getByRole` performance can be improved by setting the option +[`hidden`](#hidden) to `true` and thereby avoid expensive visibility checks. +Note that in doing so inaccessible elements will now be included in the result. + +Another option may be to substitute `getByRole` for simpler `getByLabelText` and +`getByText` queries which can be significantly faster though less robust +alternatives. From c1855e6f83e4057b00e35b51ff66bbac11902c23 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Sat, 13 Jan 2024 16:55:03 +0100 Subject: [PATCH 030/123] docs: add agentdylan as a contributor for doc (#1358) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] --------- Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 1 + 2 files changed, 10 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index e00d07a3c..ad277df29 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2609,6 +2609,15 @@ "contributions": [ "infra" ] + }, + { + "login": "agentdylan", + "name": "Dylan Gordon", + "avatar_url": "https://avatars.githubusercontent.com/u/3656794?v=4", + "profile": "https://www.dylangordon.co.nz/", + "contributions": [ + "doc" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index 59c0078ee..202b9bd21 100644 --- a/README.md +++ b/README.md @@ -506,6 +506,7 @@ Thanks goes to these wonderful people smk267
smk267

🚇 + Dylan Gordon
Dylan Gordon

📖 From 50ad2d20a36ea717c1ff22f076e86c98c11ad939 Mon Sep 17 00:00:00 2001 From: Tim Deschryver <28659384+timdeschryver@users.noreply.github.com> Date: Fri, 26 Jan 2024 18:32:10 +0100 Subject: [PATCH 031/123] angular: add deferBlockBehavior to the docs (#1359) --- docs/angular-testing-library/api.mdx | 36 ++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/docs/angular-testing-library/api.mdx b/docs/angular-testing-library/api.mdx index 9518a20f1..dad1e3f3b 100644 --- a/docs/angular-testing-library/api.mdx +++ b/docs/angular-testing-library/api.mdx @@ -150,6 +150,42 @@ await render(AppComponent, { }) ``` +### `deferBlockBehavior` + +Set the defer blocks behavior. + +For more info see the +[Angular docs](https://angular.io/api/core/testing/DeferBlockBehavior) + +**default** : `undefined` (uses the Angular default, which is +`DeferBlockBehavior.Manual`) + +**example**: + +```typescript +await render(AppComponent, { + deferBlockBehavior: DeferBlockBehavior.Playthrough, +}) +``` + +### `deferBlockStates` + +Set the initial state of a deferrable blocks in a component. + +For more info see the +[Angular docs](https://angular.io/api/core/testing/DeferBlockState) + +**default** : `undefined` (uses the Angular default, which is +`DeferBlockState.Placeholder`) + +**example**: + +```typescript +await render(FixtureComponent, { + deferBlockStates: DeferBlockState.Loading, +}) +``` + ### `componentProviders` A collection of providers needed to render the component via Dependency From ac096abf3e18c88aac393bac8fe78a4ca7da76fe Mon Sep 17 00:00:00 2001 From: Yusuke Iinuma Date: Wed, 31 Jan 2024 06:21:27 +0900 Subject: [PATCH 032/123] Add `reactStrictMode` option for RTL (#1318) * docs: add `configure` functions and options for RTL * docs: change link for RTL's `configure` --------- Co-authored-by: Sebastian Silbermann --- docs/react-testing-library/api.mdx | 23 +++++++++++++++++++++++ docs/react-testing-library/cheatsheet.mdx | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/docs/react-testing-library/api.mdx b/docs/react-testing-library/api.mdx index 47c34d2a4..359bc1134 100644 --- a/docs/react-testing-library/api.mdx +++ b/docs/react-testing-library/api.mdx @@ -32,6 +32,8 @@ as these methods: - [`result`](#result) - [`rerender`](#rerender-1) - [`unmount`](#unmount-1) +- [`configure`](#configure) +- [`configure` Options](#configure-options) --- @@ -451,3 +453,24 @@ const {unmount} = renderHook(({name = 'Alice'} = {}) => name) unmount() ``` + +## `configure` + +Changes global options. Basic usage can be seen at +[Configuration Options](dom-testing-library/api-configuration.mdx). + +React Testing Library also has dedicated options. + +```typescript +import {configure} from '@testing-library/react' + +configure({reactStrictMode: true}) +``` + +## `configure` Options + +### `reactStrictMode` + +When enabled, [``](https://react.dev/reference/react/StrictMode) is +rendered around the inner element. Defaults to `false`. + diff --git a/docs/react-testing-library/cheatsheet.mdx b/docs/react-testing-library/cheatsheet.mdx index d0e3341be..53da683d3 100644 --- a/docs/react-testing-library/cheatsheet.mdx +++ b/docs/react-testing-library/cheatsheet.mdx @@ -131,7 +131,7 @@ See [Events API](dom-testing-library/api-events.mdx) ## Other See [Querying Within Elements](dom-testing-library/api-within.mdx), -[Config API](dom-testing-library/api-configuration.mdx), +[Config API](react-testing-library/api.mdx#configure), [Cleanup](react-testing-library/api.mdx#cleanup), - **within** take a node and return an object with all the queries bound to the From 09696f9e73a5abd8b78fb1da99df77256d9d6b46 Mon Sep 17 00:00:00 2001 From: Yanick Champoux Date: Thu, 1 Feb 2024 12:18:54 -0500 Subject: [PATCH 033/123] svelte: add FAQ entry for onMount (#1361) --- docs/svelte-testing-library/faq.mdx | 32 +++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/docs/svelte-testing-library/faq.mdx b/docs/svelte-testing-library/faq.mdx index bd2ab5dbe..8a0c8099d 100644 --- a/docs/svelte-testing-library/faq.mdx +++ b/docs/svelte-testing-library/faq.mdx @@ -5,6 +5,7 @@ sidebar_label: FAQ --- - [Does this library also work with SvelteKit?](#does-this-library-also-work-with-sveltekit) +- [`onMount` isn't called when rendering components](#onmount-isnt-called-when-rendering-compoments) - [Testing file upload component](#testing-file-upload-component) --- @@ -14,6 +15,37 @@ sidebar_label: FAQ Yes, it does. It requires the same [setup](setup.mdx) as a "normal" Svelte project. +## `onMount` isn't called when rendering components + +Since the test is running in a Node environment instead of a browser +environment, it uses the SSR exports from Svelte, which declare +all lifecycle events as no-ops. + +One solution is to configure Vite to use browser resolutions in tests. + +```js title="vite.config.js" + +import { svelte } from '@sveltejs/vite-plugin-svelte'; +import { defineConfig } from 'vite'; + +export default defineConfig(({ mode }) => ({ + plugins: [svelte()], + resolve: { + // the default would be [ 'svelte', 'node' ] + // as set by vite-plugin-svelte and vitest + conditions: mode === 'test' ? ['browser'] : [], + }, + test: { + environment: 'jsdom', + }, +}; + +``` + +See +[svelte-testing-library's issue 222](https://github.com/testing-library/svelte-testing-library/issues/222) +for more details. + ## Testing file upload component File upload handler not triggering? Use `happy-dom`, not `jsdom`, and make sure From 01bb6d35ede0e868c498ee217a5475eb483cdd0e Mon Sep 17 00:00:00 2001 From: Michael Cousins Date: Fri, 2 Feb 2024 04:43:17 +1100 Subject: [PATCH 034/123] docs(svelte-testing-library): update vitest and jest setup instructions (#1360) --- docs/svelte-testing-library/intro.mdx | 17 +- docs/svelte-testing-library/setup.mdx | 265 +++++++++++++------------- 2 files changed, 138 insertions(+), 144 deletions(-) diff --git a/docs/svelte-testing-library/intro.mdx b/docs/svelte-testing-library/intro.mdx index 375ae98cd..4c0a5df1f 100644 --- a/docs/svelte-testing-library/intro.mdx +++ b/docs/svelte-testing-library/intro.mdx @@ -12,9 +12,10 @@ sidebar_label: Introduction npm install --save-dev @testing-library/svelte ``` -> This library is built on top of -> [`DOM Testing Library`](dom-testing-library/intro.mdx) which is where most of -> the logic behind the queries is. +> This library is built on top of [`dom-testing-library`][dom-testing-library] +> which is where most of the logic behind the queries is. + +[dom-testing-library]: ../dom-testing-library/intro.mdx ## The Problem @@ -27,14 +28,16 @@ The Svelte Testing Library is a very lightweight solution for testing Svelte components. It provides light utility functions on top of `svelte`, in a way that encourages better testing practices. Its primary guiding principle is: -> [The more your tests resemble the way your software is used, the more confidence they can give you.](https://twitter.com/kentcdodds/status/977018512689455106) +> [The more your tests resemble the way your software is used, the more +> confidence they can give you.][testing-library-blurb] So rather than dealing with instances of rendered Svelte components, your tests -will work with actual DOM nodes. See the [Dom -Introduction][dom-solution-explainer] for a more in-depth explanation. +will work with actual DOM nodes. See the +[`dom-testing-library`][dom-solution-explainer] for a more in-depth explanation. +[testing-library-blurb]: + https://twitter.com/kentcdodds/status/977018512689455106 [dom-solution-explainer]: ../dom-testing-library/intro.mdx#this-solution -[react-solution-explainer]: ../react-testing-library/intro.mdx#this-solution **What this library is not**: diff --git a/docs/svelte-testing-library/setup.mdx b/docs/svelte-testing-library/setup.mdx index cc02a7386..473aa51ba 100644 --- a/docs/svelte-testing-library/setup.mdx +++ b/docs/svelte-testing-library/setup.mdx @@ -4,83 +4,87 @@ title: Setup sidebar_label: Setup --- -We recommend using [Vitest](https://vitest.dev/) but you're free to use the -library with any testing framework and runner you're comfortable with. +We recommend using [Vitest][], but you're free to use the library with any test +runner that's ESM compatible. -## Vitest - -1. Install Vitest and jsdom +[vitest]: https://vitest.dev/ -We're using `jsdom` here as the test environment, but you can use any other -options e.g `happy-dom`. +## Vitest -```bash npm2yarn -npm install --save-dev vitest jsdom -``` +1. Add development dependencies -Optionally install `@vitest/ui`, which opens a UI within a browser window to -follow the progress and interact with your tests. + - [`@testing-library/svelte`][@testing-library/svelte] + - [`@testing-library/jest-dom`][@testing-library/jest-dom] (Optional, but + highly recommended) + - [`@sveltejs/vite-plugin-svelte`][@sveltejs/vite-plugin-svelte] + - [`vitest`][vitest] + - [`jsdom`][jsdom], [`happy-dom`][happy-dom], or other [Vitest DOM + environment][vitest dom] -```bash npm2yarn -npm install --save-dev @vitest/ui -``` + ```bash npm2yarn + npm install --save-dev \ + @testing-library/svelte \ + @testing-library/jest-dom \ + @sveltejs/vite-plugin-svelte \ + vitest \ + jsdom + ``` -1. Add the test scipts to your `package.json` to run the tests with Vitest + Optionally install [`@vitest/ui`][@vitest/ui], which opens a UI within a + browser window to follow the progress and interact with your tests. - ```json - { - "scripts": { - "test": "vitest run", - "test:ui": "vitest --ui", - "test:watch": "vitest" - } - } + ```bash npm2yarn + npm install --save-dev @vitest/ui ``` -2. To compile the Svelte components before using them in Vitest, you need to - install - [@sveltejs/vite-plugin-svelte](https://github.com/sveltejs/vite-plugin-svelte) - and Vite +2. Add a `vitest-setup.js` file to optionally set up automatic post-test cleanup + and [`@testing-library/jest-dom`][@testing-library/jest-dom] expect matchers. - ```bash npm2yarn - npm install --save-dev @sveltejs/vite-plugin-svelte vite + ```ts title="vitest-setup.js" + import '@testing-library/svelte/vitest' + import '@testing-library/jest-dom/vitest' ``` -3. Add a `vitest.config.ts` configuration file to the root of your project. Add - `globals: true` so `cleanup()` runs after each test. +3. Add `vitest.config.js`, or update your existing `vite.config.js`, to process + Svelte files, resolve browser exports during tests, use the [jsdom][] (or + [happy-dom][]) environment, and run your setup file. - ```js + ```js title="vitest.config.js" import {defineConfig} from 'vitest/config' import {svelte} from '@sveltejs/vite-plugin-svelte' - export default defineConfig({ - plugins: [svelte({hot: !process.env.VITEST})], + export default defineConfig(({mode}) => ({ + plugins: [svelte()], + resolve: { + conditions: mode === 'test' ? ['browser'] : [], + }, test: { - globals: true, environment: 'jsdom', + setupFiles: ['./vitest-setup.js'], }, - }) + })) ``` -4. Optionally install [vitest-dom](https://github.com/chaance/vitest-dom) to add - handy assertions to Vitest - - 4.1 Install `vitest-dom` + :::note - ```bash npm2yarn - npm install --save-dev vitest-dom - ``` + Prepending the `browser` resolve condition to Vite's default conditions may + cause issues if you have a complex Vite configuration or dependencies that + cannot be loaded into Node.js - 4.2 import `vitest-dom` at within the vitest setup file (usually - `vitest-setup.(js|ts)`) + See [testing-library/svelte-testing-library#222][] for more information and + alternative configuration options to ensure Svelte's browser bundle is used. + ::: - ```js - import * as matchers from 'vitest-dom/matchers' - import {expect} from 'vitest' - expect.extend(matchers) +4. Add test scripts to your `package.json` to run the tests with Vitest - // or: - import 'vitest-dom/extend-expect' + ```json title="package.json" + { + "scripts": { + "test": "vitest run", + "test:ui": "vitest --ui", + "test:watch": "vitest" + } + } ``` 5. Create your component and a test file (checkout the rest of the docs to see @@ -90,108 +94,95 @@ npm install --save-dev @vitest/ui npm test ``` -## Jest - -1. Install Jest & jest-environment-jsdom - - ```bash npm2yarn - npm install --save-dev jest jest-environment-jsdom - ``` - -2. Add the following to your `package.json` - - ```json - { - "scripts": { - "test": "jest src", - "test:watch": "jest src --watch" - } - } - ``` - -3. You'll need to compile the Svelte components before using them in Jest, so - we need to install - [svelte-jester](https://github.com/mihar-22/svelte-jester) +[@testing-library/svelte]: + https://github.com/testing-library/svelte-testing-library +[@testing-library/jest-dom]: https://github.com/testing-library/jest-dom +[@sveltejs/vite-plugin-svelte]: https://github.com/sveltejs/vite-plugin-svelte +[jsdom]: https://github.com/jsdom/jsdom +[happy-dom]: https://github.com/capricorn86/happy-dom +[@vitest/ui]: https://vitest.dev/guide/ui.html +[vitest dom]: https://vitest.dev/guide/environment.html +[testing-library/svelte-testing-library#222]: + https://github.com/testing-library/svelte-testing-library/issues/222 - ```bash npm2yarn - npm install --save-dev svelte-jester - ``` - -4. Add the following Jest configuration to your `package.json` - - ```json - { - "jest": { - "transform": { - "^.+\\.svelte$": "svelte-jester" - }, - "moduleFileExtensions": ["js", "svelte"], - "testEnvironment": "jsdom" - } - } - ``` - -5. If you are using ES6 modules in your project you have to add Jest's babel - transform setting (it is set by default, but since we are overriding the - transform config, we have to add it explicitly) +## Jest - 5.1 Install `babel-jest` +[`@testing-library/svelte`][@testing-library/svelte] is ESM-only, which means +you must use Jest in [ESM mode][jest esm mode]. - ```bash npm2yarn - npm install --save-dev babel-jest - ``` +1. Add development dependencies - 5.2. Add a basic `.babelrc` configuration + - [`@testing-library/svelte`][@testing-library/svelte] + - [`@testing-library/jest-dom`][@testing-library/jest-dom] (Optional, but + highly recommended) + - [`svelte-jester`][svelte-jester] + - [`jest`][vitest] + - [`jest-environment-jsdom`][jest-environment-jsdom] - ```json - { - "presets": [["@babel/preset-env", {"targets": {"node": "current"}}]] - } - ``` + ```bash npm2yarn + npm install --save-dev \ + @testing-library/svelte \ + @testing-library/jest-dom \ + svelte-jester \ + jest \ + jest-environment-jsdom + ``` - 5.3. Update the Jest transform configuration +2. Add a `jest-setup.js` file to configure + [`@testing-library/jest-dom`][@testing-library/jest-dom], if using. - ```json - "transform": { - "^.+\\.js$": "babel-jest", - "^.+\\.svelte$": "svelte-jester" - }, - ``` + ```ts title="jest-setup.js" + import '@testing-library/jest-dom' + ``` -6. This is optional but it is recommended, you can install - [jest-dom](https://github.com/testing-library/jest-dom) to add handy - assertions to Jest +3. Configure Jest to use jsdom, transform Svelte files, and use your setup file - 6.1 Install `jest-dom` + ```js title="jest.config.js" + module.exports = { + "transform": { + "^.+\\.svelte$": "svelte-jester" + }, + "moduleFileExtensions": ["js", "svelte"], + "extensionsToTreatAsEsm": ["svelte"] + "testEnvironment": "jsdom", + "setupFilesAfterEnv": ["/jest-setup.js"] + } + ``` - ```bash npm2yarn - npm install --save-dev @testing-library/jest-dom - ``` +4. Add the following to your `package.json` - 6.2 Add the following to your Jest configuration in `package.json` + ```json title="package.json" + { + "scripts": { + "test": "npx --node-options=\"--experimental-vm-modules\" jest src", + "test:watch": "npx --node-options=\"--experimental-vm-modules\" jest src --watch" + } + } + ``` - ```json - { - "setupFilesAfterEnv": ["@testing-library/jest-dom/extend-expect"] - } - ``` +5. Create your component + test file (checkout the rest of the docs to see how) + and run it -7. Create your component + test file (checkout the rest of the docs to see how) - and run it + ```bash npm2yarn + npm test + ``` - ```bash npm2yarn - npm test - ``` +[jest esm mode]: https://jestjs.io/docs/ecmascript-modules +[svelte-jester]: https://github.com/svelteness/svelte-jester +[jest-environment-jsdom]: + https://jestjs.io/docs/configuration#testenvironment-string -### TypeScript +### TypeScript and preprocessors To use TypeScript with Jest, you'll need to install and configure `svelte-preprocess` and `ts-jest`. For full instructions, see the -[`svelte-jester`](https://github.com/mihar-22/svelte-jester#typescript) docs. +[`svelte-jester` docs][svelte-jester typescript]. -### Preprocessors +If you'd like include any other [Svelte preprocessors][svelte-preprocess], see +the [`svelte-jester` docs][svelte-jester preprocess]. -If you'd like to also include any -[Svelte preprocessors](https://github.com/sveltejs/svelte-preprocess) then -simply follow the instructions over at -[svelte-jester](https://github.com/mihar-22/svelte-jester#babel). +[svelte-preprocess]: https://github.com/sveltejs/svelte-preprocess +[svelte-jester typescript]: + https://github.com/svelteness/svelte-jester#typescript +[svelte-jester preprocess]: + https://github.com/svelteness/svelte-jester#preprocess From 6ae3bb1d5c54028e9963b32b27cf3576254b148c Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Thu, 1 Feb 2024 18:50:33 +0100 Subject: [PATCH 035/123] docs: add mcous as a contributor for doc, and review (#1362) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] --------- Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 10 ++++++++++ README.md | 1 + 2 files changed, 11 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index ad277df29..b3e0b4fce 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2618,6 +2618,16 @@ "contributions": [ "doc" ] + }, + { + "login": "mcous", + "name": "Michael Cousins", + "avatar_url": "https://avatars.githubusercontent.com/u/2963448?v=4", + "profile": "https://michael.cousins.io/", + "contributions": [ + "doc", + "review" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index 202b9bd21..480466dbf 100644 --- a/README.md +++ b/README.md @@ -507,6 +507,7 @@ Thanks goes to these wonderful people smk267
smk267

🚇 Dylan Gordon
Dylan Gordon

📖 + Michael Cousins
Michael Cousins

📖 👀 From 2cd12abba84cc20013fb8bf53363950790cd7582 Mon Sep 17 00:00:00 2001 From: Michael Cousins Date: Sat, 10 Feb 2024 02:00:01 -0500 Subject: [PATCH 036/123] docs(svelte-testing-library): add FAQ entry for transition events (#1363) --- docs/svelte-testing-library/faq.mdx | 95 +++++++++++++++++++++-------- 1 file changed, 69 insertions(+), 26 deletions(-) diff --git a/docs/svelte-testing-library/faq.mdx b/docs/svelte-testing-library/faq.mdx index 8a0c8099d..764fd1a9b 100644 --- a/docs/svelte-testing-library/faq.mdx +++ b/docs/svelte-testing-library/faq.mdx @@ -5,54 +5,97 @@ sidebar_label: FAQ --- - [Does this library also work with SvelteKit?](#does-this-library-also-work-with-sveltekit) -- [`onMount` isn't called when rendering components](#onmount-isnt-called-when-rendering-compoments) -- [Testing file upload component](#testing-file-upload-component) +- [Why isn't `onMount` called when rendering components?](#why-isnt-onmount-called-when-rendering-components) +- [How do I test file upload?](#how-do-i-test-file-upload) +- [Why aren't transition events running?](#why-arent-transition-events-running) --- ## Does this library also work with SvelteKit? -Yes, it does. It requires the same [setup](setup.mdx) as a "normal" Svelte -project. +Yes, it does. It requires the same [setup][] as a "normal" Svelte project. -## `onMount` isn't called when rendering components +## Why isn't `onMount` called when rendering components? Since the test is running in a Node environment instead of a browser -environment, it uses the SSR exports from Svelte, which declare -all lifecycle events as no-ops. +environment, it uses the SSR exports from Svelte, which declare all lifecycle +events as no-ops. -One solution is to configure Vite to use browser resolutions in tests. +One solution is to configure Vite to use browser resolutions in tests. ```js title="vite.config.js" +import {svelte} from '@sveltejs/vite-plugin-svelte' +import {defineConfig} from 'vite' -import { svelte } from '@sveltejs/vite-plugin-svelte'; -import { defineConfig } from 'vite'; - -export default defineConfig(({ mode }) => ({ +export default defineConfig(({mode}) => ({ plugins: [svelte()], resolve: { - // the default would be [ 'svelte', 'node' ] - // as set by vite-plugin-svelte and vitest + // The default would be [ 'svelte', 'node' ] + // as set by vite-plugin-svelte and vitest. + // This sets [ 'browser', 'svelte', 'node' ] conditions: mode === 'test' ? ['browser'] : [], }, test: { environment: 'jsdom', }, -}; +})) +``` + +See svelte-testing-library's [issue 222][] for more details. + +[setup]: ./setup.mdx +[issue 222]: + https://github.com/testing-library/svelte-testing-library/issues/222 + +## How do I test file upload? + +Use the [upload][] utility from `@testing-library/user-event` rather than +`fireEvent`. It works well in both [jsdom][] and [happy-dom][]. + +```js +test('upload file', async () => { + const user = userEvent.setup() + render(Uploader) + const file = new File(['hello'], 'hello.png', {type: 'image/png'}) + const input = screen.getByLabelText(/upload file/i) + + await user.upload(input, file) + + expect(input.files[0]).toBe(file) + expect(input.files.item(0)).toBe(file) + expect(input.files).toHaveLength(1) +}) ``` -See -[svelte-testing-library's issue 222](https://github.com/testing-library/svelte-testing-library/issues/222) -for more details. +[upload]: ../user-event/api-utility.mdx#upload +[jsdom]: https://github.com/jsdom/jsdom +[happy-dom]: https://github.com/capricorn86/happy-dom + +## Why aren't [transition events][] running? + +The [jsdom][] implementation of `requestAnimationFrame` can be unreliable in +Vitest. To work around it, you can: -## Testing file upload component +- Switch to [happy-dom][], if you are able, which does not exhibit the same + issues +- Replace the implementation of `requestAnimationFrame` + +```js +beforeEach(() => { + const raf = fn => setTimeout(() => fn(new Date()), 16) + vi.stubGlobal('requestAnimationFrame', raf) +}) + +// Alternatively, set `unstubGlobals: true` in vitest.config.js +afterEach(() => { + vi.unstubAllGlobals() +}) +``` -File upload handler not triggering? Use `happy-dom`, not `jsdom`, and make sure -to use `fireEvent.change(...)` and not `fireEvent.input(...)`. It seems that -jsdom (which is at v22.1.0 at the time of this writing) doesn't fake all the -File object as it should. +See svelte-testing-library's [issue 206][] for more details. -See -[svelte-testing-library's issue 219](https://github.com/testing-library/svelte-testing-library/issues/219) -for more details. +[transition events]: + https://svelte.dev/docs/element-directives#transition-events +[issue 206]: + https://github.com/testing-library/svelte-testing-library/issues/206 From 334201d0f632a8a54eaba653f8971e5e0e44a6d3 Mon Sep 17 00:00:00 2001 From: Michael Cousins Date: Mon, 19 Feb 2024 11:26:42 -0500 Subject: [PATCH 037/123] docs(svelte-testing-library): add event, slot, binding, context examples (#1366) --- docs/svelte-testing-library/example.mdx | 278 +++++++++++++++++++++--- 1 file changed, 250 insertions(+), 28 deletions(-) diff --git a/docs/svelte-testing-library/example.mdx b/docs/svelte-testing-library/example.mdx index 26c8fe34a..639e55d81 100644 --- a/docs/svelte-testing-library/example.mdx +++ b/docs/svelte-testing-library/example.mdx @@ -4,53 +4,275 @@ title: Example sidebar_label: Example --- -## Component +For additional resources, patterns, and best practices about testing Svelte +components and other Svelte features, take a look at the [Svelte Society testing +recipes][testing-recipes]. -```html +[testing-recipes]: + https://sveltesociety.dev/recipes/testing-and-debugging/unit-testing-svelte-component + +## Basic + +This basic example demonstrates how to: + +- Pass props to your Svelte component using `render` +- Query the structure of your component's DOM elements using `screen` +- Interact with your component using [`@testing-library/user-event`][user-event] +- Make assertions using `expect`, using matchers from + [`@testing-library/jest-dom`][jest-dom] + +```html title="greeter.svelte" -

Hello {name}!

+ - +{#if showGreeting} +

Hello {name}

+{/if} ``` -## Test +```js title="greeter.test.js" +import {render, screen} from '@testing-library/svelte' +import userEvent from '@testing-library/user-event' +import {expect, test} from 'vitest' -```js -// NOTE: jest-dom adds handy assertions to Jest (and Vitest) and it is recommended, but not required. -import '@testing-library/jest-dom' +import Greeter from './greeter.svelte' -import {render, fireEvent, screen} from '@testing-library/svelte' +test('no initial greeting', () => { + render(Greeter, {name: 'World'}) -import Comp from '../Comp' + const button = screen.getByRole('button', {name: 'Greet'}) + const greeting = screen.queryByText(/hello/iu) -test('shows proper heading when rendered', () => { - render(Comp, {name: 'World'}) - const heading = screen.getByText('Hello World!') - expect(heading).toBeInTheDocument() + expect(button).toBeInTheDocument() + expect(greeting).not.toBeInTheDocument() }) -// Note: This is as an async test as we are using `fireEvent` -test('changes button text on click', async () => { - render(Comp, {name: 'World'}) +test('greeting appears on click', async () => { + const user = userEvent.setup() + render(Greeter, {name: 'World'}) + const button = screen.getByRole('button') + await user.click(button) + const greeting = screen.getByText(/hello world/iu) + + expect(greeting).toBeInTheDocument() +}) +``` + +[user-event]: ../user-event/intro.mdx +[jest-dom]: https://github.com/testing-library/jest-dom + +## Events + +Events can be tested using spy functions. If you're using Vitest you can use +[`vi.fn()`][vi-fn] to create a spy. + +:::info + +Consider using function props to make testing events easier. + +::: + +```html title="button-with-event.svelte" + +``` + +```html title="button-with-prop.svelte" + + + +``` + +```js title="button.test.ts" +import {render, screen} from '@testing-library/svelte' +import userEvent from '@testing-library/user-event' +import {expect, test, vi} from 'vitest' + +import ButtonWithEvent from './button-with-event.svelte' +import ButtonWithProp from './button-with-prop.svelte' + +test('button with event', async () => { + const user = userEvent.setup() + const onClick = vi.fn() + + const {component} = render(ButtonWithEvent) + component.$on('click', onClick) + + const button = screen.getByRole('button') + await user.click(button) + + expect(onClick).toHaveBeenCalledOnce() +}) + +test('button with function prop', async () => { + const user = userEvent.setup() + const onClick = vi.fn() + + render(ButtonWithProp, {onClick}) + + const button = screen.getByRole('button') + await user.click(button) + + expect(onClick).toHaveBeenCalledOnce() +}) +``` + +[vi-fn]: https://vitest.dev/api/vi.html#vi-fn + +## Slots + +Slots cannot be tested directly. It's usually easier to structure your code so +that you can test the user-facing results, leaving any slots as an +implementation detail. + +However, if slots are an important developer-facing API of your component, you +can use a wrapper component and "dummy" children to test them. Test IDs can be +helpful when testing slots in this manner. + +```html title="heading.svelte" +

+ +

+``` + +```html title="heading.test.svelte" + + + + + +``` - // Using await when firing events is unique to the svelte testing library because - // we have to wait for the next `tick` so that Svelte flushes all pending state changes. - await fireEvent.click(button) +```js title="heading.test.js" +import {render, screen, within} from '@testing-library/svelte' +import {expect, test} from 'vitest' - expect(button).toHaveTextContent('Button Clicked') +import HeadingTest from './heading.test.svelte' + +test('heading with slot', () => { + render(HeadingTest) + + const heading = screen.getByRole('heading') + const child = within(heading).getByTestId('child') + + expect(child).toBeInTheDocument() }) ``` -For additional resources, patterns and best practices about testing svelte -components and other svelte features take a look at the -[Svelte Society testing recipe](https://sveltesociety.dev/recipes/testing-and-debugging/unit-testing-svelte-component). +## Two-way data binding + +Two-way data binding cannot be tested directly. It's usually easier to structure +your code so that you can test the user-facing results, leaving the binding as +an implementation detail. + +However, if two-way binding is an important developer-facing API of your +component, you can use a wrapper component and writable store to test the +binding itself. + +```html title="text-input.svelte" + + + +``` + +```html title="text-input.test.svelte" + + + +``` + +```js title="text-input.test.js" +import {render, screen} from '@testing-library/svelte' +import userEvent from '@testing-library/user-event' +import {get, writable} from 'svelte/store' +import {expect, test} from 'vitest' + +import TextInputTest from './text-input.test.svelte' + +test('text input with value binding', async () => { + const user = userEvent.setup() + const valueStore = writable('') + + render(TextInputTest, {valueStore}) + + const input = screen.getByRole('textbox') + await user.type(input, 'hello world') + + expect(get(valueStore)).toBe('hello world') +}) +``` + +## Contexts + +If your component requires access to contexts, you can pass those contexts in +when you [`render`][component-options] the component. When you use options like +`context`, be sure to place props under the `props` key. + +[component-options]: ./api.mdx#component-options + +```html title="notifications-provider.svelte" + +``` + +```html title="notifications.svelte" + + +
+ {#each $messages as message (message.id)} +

{message.text}

+
+ {/each} +
+``` + +```js title="notifications.test.js" +import {render, screen} from '@testing-library/svelte' +import {readable} from 'svelte/store' +import {expect, test} from 'vitest' + +import Notifications from './notifications.svelte' + +test('notifications with messages from context', async () => { + const messages = readable([ + {id: 'abc', text: 'hello'}, + {id: 'def', text: 'world'}, + ]) + + render(Notifications, { + context: new Map([['messages', messages]]), + props: {label: 'Notifications'}, + }) + + const status = screen.getByRole('status', {name: 'Notifications'}) + + expect(status).toHaveTextContent('hello world') +}) +``` From 0e8a058c111b8e98794b782d161a1951d834119f Mon Sep 17 00:00:00 2001 From: Daniel Afonso <35337607+danieljcafonso@users.noreply.github.com> Date: Wed, 6 Mar 2024 20:08:54 +0000 Subject: [PATCH 038/123] docs(solid-testing-library): add solid testing library docs (#1370) * docs(solid-testing-library): add solid testing library * Update docs/solid-testing-library/api.mdx Co-authored-by: Tim Deschryver <28659384+timdeschryver@users.noreply.github.com> * Update docs/solid-testing-library/api.mdx Co-authored-by: Matan Borenkraout * Update docs/solid-testing-library/api.mdx Co-authored-by: Matan Borenkraout * docs: add info to netlify.toml and address pr comments --------- Co-authored-by: Tim Deschryver <28659384+timdeschryver@users.noreply.github.com> Co-authored-by: Matan Borenkraout --- docs/dom-testing-library/install.mdx | 1 + docs/solid-testing-library/api.mdx | 181 +++++++++++++++++++++++++++ docs/solid-testing-library/intro.mdx | 53 ++++++++ netlify.toml | 3 + sidebars.js | 6 + 5 files changed, 244 insertions(+) create mode 100644 docs/solid-testing-library/api.mdx create mode 100644 docs/solid-testing-library/intro.mdx diff --git a/docs/dom-testing-library/install.mdx b/docs/dom-testing-library/install.mdx index fef49e378..903a0325f 100644 --- a/docs/dom-testing-library/install.mdx +++ b/docs/dom-testing-library/install.mdx @@ -28,6 +28,7 @@ install the wrapper: - [Puppeteer Testing Library](pptr-testing-library/intro.mdx) - [Testcafe Testing Library](testcafe-testing-library/intro.mdx) - [Nightwatch Testing Library](nightwatch-testing-library/intro.mdx) +- [Solid Testing Library](solid-testing-library/intro.mdx) ## Ecosystem diff --git a/docs/solid-testing-library/api.mdx b/docs/solid-testing-library/api.mdx new file mode 100644 index 000000000..f1eb1703c --- /dev/null +++ b/docs/solid-testing-library/api.mdx @@ -0,0 +1,181 @@ +--- +id: api +title: API +sidebar_label: API +--- + +Due to being inspired by the [preact-testing-library][preact-docs] you can check +its page for more information. + +[preact-docs]: ../preact-testing-library/intro.mdx + +There are several key differences, to be aware of. + +- [`render`](#render) +- [`renderHook`](#renderHook) +- [`renderDirective`](#renderDirective) +- [`Async methods`](#async-methods) +- [`Know issues`](#known-issues) + +## `render` + +The `render` function takes in a function that returns a Solid Component, rather +than simply the component itself. + +```tsx +const results = render(() => , options) +``` + +Solid.js does _not_ re-render, it merely executes side effects triggered by +reactive state that change the DOM, therefore there is no `rerender` method. You +can use global signals to manipulate your test component in a way that causes it +to update. + +In addition to the original API, the render function of this testing library +supports a convenient `location` option that will set up an in-memory router +pointing at the specified location. Since this setup is not synchronous, you +need to first use asynchronous queries (`findBy`) after employing it: + +```tsx +it('uses params', async () => { + const App = () => ( + <> +

Id: {useParams()?.id}

} /> +

Start

} /> + + ) + const {findByText} = render(() => , {location: 'ids/1234'}) + expect(await findByText('Id: 1234')).not.toBeFalsy() +}) +``` + +It uses `@solidjs/router`, so if you want to use a different router, you should +consider the `wrapper` option instead. If you attempt to use this without having +the package installed, you will receive an error message. + +## `renderHook` + +Solid.js external reactive state does not require any DOM elements to run in, so +our `renderHook` call to test hooks in the context of a component (if your hook +does not require the context of a component, `createRoot` should suffice to test +the reactive behavior; for convenience, we also have `createEffect`, which is +described in the [`Async methods`](#async-methods) section) has no `container`, +`baseElement` or queries in its options or return value. Instead, it has an +`owner` to be used with +[`runWithOwner`](https://www.solidjs.com/docs/latest/api#runwithowner) if +required. It also exposes a `cleanup` function, though this is already +automatically called after the test is finished. + +```ts +function renderHook( + hook: (...args: Args) => Result, + options: { + initialProps?: Args, + wrapper?: Component<{ children: JSX.Element }> + } +) => { + result: Result; + owner: Owner | null; + cleanup: () => void; +} +``` + +This can be used to easily test a hook / primitive: + +```ts +const {result} = renderHook(createResult) +expect(result).toBe(true) +``` + +If you are using a `wrapper` with `renderHook`, make sure it will **always** +return `props.children` - especially if you are using a context with +asynchronous code together with ``, because this is required to get the +value from the hook and it is only obtained synchronously once and you will +otherwise only get `undefined` and wonder why this is the case. + +## `renderDirective` + +Solid.js supports +[custom directives](https://www.solidjs.com/docs/latest/api#use___), which is a +convenient pattern to tie custom behavior to elements, so we also have a +`renderDirective` call, which augments `renderHook` to take a directive as first +argument, accept an `initialValue` for the argument and a `targetElement` +(string, HTMLElement or function returning an HTMLElement) in the `options` and +also returns `arg` and `setArg` to read and manipulate the argument of the +directive. + +```ts +function renderDirective< + Arg extends any, + Elem extends HTMLElement +>( + directive: (ref: Elem, arg: Accessor) => void, + options?: { + ...renderOptions, + initialValue: Arg, + targetElement: + | Lowercase + | Elem + | (() => Elem) + } +): Result & { arg: Accessor, setArg: Setter }; +``` + +This allows for very effective and concise testing of directives: + +```ts +const {asFragment, setArg} = renderDirective(myDirective) +expect(asFragment()).toBe('
') +setArg('perfect') +expect(asFragment()).toBe('
') +``` + +## Async methods + +Solid.js reactive changes are pretty instantaneous, so there is rarely need to +use `waitFor(…)`, `await findByRole(…)` and other asynchronous queries to test +the rendered result, except for transitions, suspense, resources and router +navigation. + +Solid.js manages side effects with different variants of `createEffect`. While +you can use `waitFor` to test asynchronous effects, it uses polling instead of +allowing Solid's reactivity to trigger the next step. In order to simplify +testing those asynchronous effects, we have a `testEffect` helper that +complements the hooks for directives and hooks: + +```ts +testEffect(fn: (done: (result: T) => void) => void, owner?: Owner): Promise + +// use it like this: +test("testEffect allows testing an effect asynchronously", () => { + const [value, setValue] = createSignal(0); + return testEffect(done => createEffect((run: number = 0) => { + if (run === 0) { + expect(value()).toBe(0); + setValue(1); + } else if (run === 1) { + expect(value()).toBe(1); + done(); + } + return run + 1; + })); +}); +``` + +It allows running the effect inside a defined owner that is received as an +optional second argument. This can be useful in combination with `renderHook`, +which gives you an owner field in its result. The return value is a Promise with +the value given to the `done()` callback. You can either await the result for +further assertions or return it to your test runner. + +## Known issues + +If you are using [`vitest`](https://vitest.dev/), then tests might fail, because +the packages `solid-js`, and `@solidjs/router` (if used) need to be loaded only +once, and they could be loaded both through the internal `vite` server and +through node. Typical bugs that happen because of this is that dispose is +supposedly undefined, or the router could not be loaded. + +Since version 2.8.2, our vite plugin has gained the capability to configure +everything for testing, so you should only need extra configuration for globals, +coverage, etc. diff --git a/docs/solid-testing-library/intro.mdx b/docs/solid-testing-library/intro.mdx new file mode 100644 index 000000000..b1f0dafe6 --- /dev/null +++ b/docs/solid-testing-library/intro.mdx @@ -0,0 +1,53 @@ +--- +id: intro +title: Intro +sidebar_label: Introduction +--- + +[Solid Testing Library on GitHub][gh] + +> Inspired completely by [preact-testing-library][preact-docs] + +[preact-docs]: ../preact-testing-library/intro.mdx +[gh]: https://github.com/solidjs/solid-testing-library + +```bash npm2yarn +npm install --save-dev @solidjs/testing-library +``` + +> This library is built on top of +> [`DOM Testing Library`](dom-testing-library/intro.mdx) which is where most of +> the logic behind the queries is. + +## The Problem + +You want to write tests for your Solid components so that they avoid including +implementation details, and are maintainable in the long run. + +## This Solution + +The Solid Testing Library is a very lightweight solution for testing Solid +components. Its primary guiding principle is: + +> [The more your tests resemble the way your software is used, the more confidence they can give you.](https://twitter.com/kentcdodds/status/977018512689455106) + +See the [Dom introduction][dom-solution-explainer] and [React +introduction][react-solution-explainer] for a more in-depth explanation. + +[dom-solution-explainer]: ../dom-testing-library/intro.mdx#this-solution +[react-solution-explainer]: ../react-testing-library/intro.mdx#this-solution + +**What this library is not**: + +1. A test runner or framework. +2. Specific to a testing framework. + +If you using Jest we recommend using +[solid-jest](https://github.com/solidjs/solid-jest) to properly resolve the +browser version of Solid as Jest will default to the server version when run in +Node. + +💡 If you are using Jest or vitest, you may also be interested in installing +`@testing-library/jest-dom` so you can use [the custom jest matchers][jest-dom]. + +[jest-dom]: ../ecosystem-jest-dom diff --git a/netlify.toml b/netlify.toml index 4a6bf62c2..b5a5a4803 100644 --- a/netlify.toml +++ b/netlify.toml @@ -121,3 +121,6 @@ [[redirects]] from = "/user-event/" to = "/docs/user-event/intro" +[[redirects]] + from = "/solid/" + to = "/docs/solid-testing-library/intro" diff --git a/sidebars.js b/sidebars.js index 03a2a5c65..b5aa8b8cc 100755 --- a/sidebars.js +++ b/sidebars.js @@ -165,6 +165,12 @@ module.exports = { 'react-native-testing-library/setup', ], }, + { + 'Solid Testing Library': [ + 'solid-testing-library/intro', + 'solid-testing-library/api', + ], + }, 'cypress-testing-library/intro', 'pptr-testing-library/intro', 'testcafe-testing-library/intro', From 3e5729521c96576b0230099481eafdaa5afd669d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 17 Mar 2024 11:27:19 +0200 Subject: [PATCH 039/123] chore(deps): bump follow-redirects from 1.15.4 to 1.15.6 (#1374) Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.4 to 1.15.6. - [Release notes](https://github.com/follow-redirects/follow-redirects/releases) - [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.15.4...v1.15.6) --- updated-dependencies: - dependency-name: follow-redirects dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index c116be159..87e9c7071 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12790,9 +12790,9 @@ } }, "node_modules/follow-redirects": { - "version": "1.15.4", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.4.tgz", - "integrity": "sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw==", + "version": "1.15.6", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", + "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==", "funding": [ { "type": "individual", @@ -36717,9 +36717,9 @@ "dev": true }, "follow-redirects": { - "version": "1.15.4", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.4.tgz", - "integrity": "sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw==" + "version": "1.15.6", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", + "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==" }, "for-in": { "version": "1.0.2", From 749ce3bfcc4b1adbe5d53c7eab77799392eb9396 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Soares?= Date: Tue, 19 Mar 2024 19:01:35 +0000 Subject: [PATCH 040/123] improve docs because ByRole does not receive exact anymore (#1373) --- docs/queries/about.mdx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/docs/queries/about.mdx b/docs/queries/about.mdx index da377a7b0..53de0b1f0 100644 --- a/docs/queries/about.mdx +++ b/docs/queries/about.mdx @@ -317,12 +317,9 @@ can contain options that affect the precision of string matching: - `exact`: Defaults to `true`; matches full strings, case-sensitive. When false, matches substrings and is not case-sensitive. - - `exact` has no effect on `regex` or `function` arguments. - - `exact` has no effect on accessible names specified with the `name` option - of `*byRole` queries. You can use a regex for fuzzy matching on accessible - names. - - In most cases using a regex instead of a string gives you more control over - fuzzy matching and should be preferred over `{ exact: false }`. + - it has no effect when used together with `regex` or `function` arguments. + - in most cases, using a regex instead of a string combined with `{ exact: false }` + gives you more control over fuzzy matching so it should be preferred. - `normalizer`: An optional function which overrides normalization behavior. See [`Normalization`](#normalization). From c8a4d0dbfb6dc1d861fab00e804513ab7c3bc511 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 23 Mar 2024 17:56:37 +0200 Subject: [PATCH 041/123] chore(deps): bump webpack-dev-middleware from 5.3.3 to 5.3.4 (#1376) Bumps [webpack-dev-middleware](https://github.com/webpack/webpack-dev-middleware) from 5.3.3 to 5.3.4. - [Release notes](https://github.com/webpack/webpack-dev-middleware/releases) - [Changelog](https://github.com/webpack/webpack-dev-middleware/blob/v5.3.4/CHANGELOG.md) - [Commits](https://github.com/webpack/webpack-dev-middleware/compare/v5.3.3...v5.3.4) --- updated-dependencies: - dependency-name: webpack-dev-middleware dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 87e9c7071..a183174a7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26469,9 +26469,9 @@ } }, "node_modules/webpack-dev-middleware": { - "version": "5.3.3", - "resolved": "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-5.3.3.tgz", - "integrity": "sha512-hj5CYrY0bZLB+eTO+x/j67Pkrquiy7kWepMHmUMoPsmcUaeEnQJqFzHJOyxgWlq746/wUuA64p9ta34Kyb01pA==", + "version": "5.3.4", + "resolved": "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-5.3.4.tgz", + "integrity": "sha512-BVdTqhhs+0IfoeAf7EoH5WE+exCmqGerHfDM0IL096Px60Tq2Mn9MAbnaGUe6HiMa41KMCYF19gyzZmBcq/o4Q==", "dependencies": { "colorette": "^2.0.10", "memfs": "^3.4.3", @@ -47073,9 +47073,9 @@ } }, "webpack-dev-middleware": { - "version": "5.3.3", - "resolved": "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-5.3.3.tgz", - "integrity": "sha512-hj5CYrY0bZLB+eTO+x/j67Pkrquiy7kWepMHmUMoPsmcUaeEnQJqFzHJOyxgWlq746/wUuA64p9ta34Kyb01pA==", + "version": "5.3.4", + "resolved": "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-5.3.4.tgz", + "integrity": "sha512-BVdTqhhs+0IfoeAf7EoH5WE+exCmqGerHfDM0IL096Px60Tq2Mn9MAbnaGUe6HiMa41KMCYF19gyzZmBcq/o4Q==", "requires": { "colorette": "^2.0.10", "memfs": "^3.4.3", From 6cf968b62042c8232c7da6974fbc77dc37522d44 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 28 Mar 2024 11:27:20 +0200 Subject: [PATCH 042/123] chore(deps): bump express from 4.18.1 to 4.19.2 (#1377) Bumps [express](https://github.com/expressjs/express) from 4.18.1 to 4.19.2. - [Release notes](https://github.com/expressjs/express/releases) - [Changelog](https://github.com/expressjs/express/blob/master/History.md) - [Commits](https://github.com/expressjs/express/compare/4.18.1...4.19.2) --- updated-dependencies: - dependency-name: express dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 96 +++++++++++++++++++++++------------------------ 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/package-lock.json b/package-lock.json index a183174a7..2f644dde5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7193,20 +7193,20 @@ "dev": true }, "node_modules/body-parser": { - "version": "1.20.0", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.0.tgz", - "integrity": "sha512-DfJ+q6EPcGKZD1QWUjSpqp+Q7bDQTsQIF4zfUAtZ6qk+H/3/QRhg9CEp39ss+/T2vw0+HaidC0ecJj/DRLIaKg==", + "version": "1.20.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", + "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", "dependencies": { "bytes": "3.1.2", - "content-type": "~1.0.4", + "content-type": "~1.0.5", "debug": "2.6.9", "depd": "2.0.0", "destroy": "1.2.0", "http-errors": "2.0.0", "iconv-lite": "0.4.24", "on-finished": "2.4.1", - "qs": "6.10.3", - "raw-body": "2.5.1", + "qs": "6.11.0", + "raw-body": "2.5.2", "type-is": "~1.6.18", "unpipe": "1.0.0" }, @@ -8739,9 +8739,9 @@ ] }, "node_modules/content-type": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", - "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", "engines": { "node": ">= 0.6" } @@ -8755,9 +8755,9 @@ } }, "node_modules/cookie": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", - "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", + "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==", "engines": { "node": ">= 0.6" } @@ -12110,16 +12110,16 @@ } }, "node_modules/express": { - "version": "4.18.1", - "resolved": "https://registry.npmjs.org/express/-/express-4.18.1.tgz", - "integrity": "sha512-zZBcOX9TfehHQhtupq57OF8lFZ3UZi08Y97dwFCkD8p9d/d2Y3M+ykKcwaMDEL+4qyUolgBDX6AblpR3fL212Q==", + "version": "4.19.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz", + "integrity": "sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==", "dependencies": { "accepts": "~1.3.8", "array-flatten": "1.1.1", - "body-parser": "1.20.0", + "body-parser": "1.20.2", "content-disposition": "0.5.4", "content-type": "~1.0.4", - "cookie": "0.5.0", + "cookie": "0.6.0", "cookie-signature": "1.0.6", "debug": "2.6.9", "depd": "2.0.0", @@ -12135,7 +12135,7 @@ "parseurl": "~1.3.3", "path-to-regexp": "0.1.7", "proxy-addr": "~2.0.7", - "qs": "6.10.3", + "qs": "6.11.0", "range-parser": "~1.2.1", "safe-buffer": "5.2.1", "send": "0.18.0", @@ -22012,9 +22012,9 @@ "integrity": "sha512-QFADYnsVoBMw1srW7OVKEYjG+MbIa49s54w1MA1EDY6r2r/sTcKKYqRX1f4GYvnXP7eN/Pe9HFcX+hwzmrXRHA==" }, "node_modules/qs": { - "version": "6.10.3", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz", - "integrity": "sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==", + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", + "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", "dependencies": { "side-channel": "^1.0.4" }, @@ -22085,9 +22085,9 @@ } }, "node_modules/raw-body": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", - "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", + "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", "dependencies": { "bytes": "3.1.2", "http-errors": "2.0.0", @@ -32493,20 +32493,20 @@ "dev": true }, "body-parser": { - "version": "1.20.0", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.0.tgz", - "integrity": "sha512-DfJ+q6EPcGKZD1QWUjSpqp+Q7bDQTsQIF4zfUAtZ6qk+H/3/QRhg9CEp39ss+/T2vw0+HaidC0ecJj/DRLIaKg==", + "version": "1.20.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", + "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", "requires": { "bytes": "3.1.2", - "content-type": "~1.0.4", + "content-type": "~1.0.5", "debug": "2.6.9", "depd": "2.0.0", "destroy": "1.2.0", "http-errors": "2.0.0", "iconv-lite": "0.4.24", "on-finished": "2.4.1", - "qs": "6.10.3", - "raw-body": "2.5.1", + "qs": "6.11.0", + "raw-body": "2.5.2", "type-is": "~1.6.18", "unpipe": "1.0.0" }, @@ -33669,9 +33669,9 @@ } }, "content-type": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", - "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==" }, "convert-source-map": { "version": "1.7.0", @@ -33682,9 +33682,9 @@ } }, "cookie": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", - "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==" + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", + "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==" }, "cookie-signature": { "version": "1.0.6", @@ -36181,16 +36181,16 @@ } }, "express": { - "version": "4.18.1", - "resolved": "https://registry.npmjs.org/express/-/express-4.18.1.tgz", - "integrity": "sha512-zZBcOX9TfehHQhtupq57OF8lFZ3UZi08Y97dwFCkD8p9d/d2Y3M+ykKcwaMDEL+4qyUolgBDX6AblpR3fL212Q==", + "version": "4.19.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz", + "integrity": "sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==", "requires": { "accepts": "~1.3.8", "array-flatten": "1.1.1", - "body-parser": "1.20.0", + "body-parser": "1.20.2", "content-disposition": "0.5.4", "content-type": "~1.0.4", - "cookie": "0.5.0", + "cookie": "0.6.0", "cookie-signature": "1.0.6", "debug": "2.6.9", "depd": "2.0.0", @@ -36206,7 +36206,7 @@ "parseurl": "~1.3.3", "path-to-regexp": "0.1.7", "proxy-addr": "~2.0.7", - "qs": "6.10.3", + "qs": "6.11.0", "range-parser": "~1.2.1", "safe-buffer": "5.2.1", "send": "0.18.0", @@ -43698,9 +43698,9 @@ "integrity": "sha512-QFADYnsVoBMw1srW7OVKEYjG+MbIa49s54w1MA1EDY6r2r/sTcKKYqRX1f4GYvnXP7eN/Pe9HFcX+hwzmrXRHA==" }, "qs": { - "version": "6.10.3", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz", - "integrity": "sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==", + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", + "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", "requires": { "side-channel": "^1.0.4" } @@ -43748,9 +43748,9 @@ "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==" }, "raw-body": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", - "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", + "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", "requires": { "bytes": "3.1.2", "http-errors": "2.0.0", From 4e321bacee0b96e2b3c7e1ad5792024bb9d9d23f Mon Sep 17 00:00:00 2001 From: Matan Borenkraout Date: Fri, 5 Apr 2024 19:25:43 +0300 Subject: [PATCH 043/123] docs: udpate msw example (#1378) Co-authored-by: Artem Zakharchenko Co-authored-by: Tim Deschryver <28659384+timdeschryver@users.noreply.github.com> --- docs/react-testing-library/example-intro.mdx | 33 +++++++++++--------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/docs/react-testing-library/example-intro.mdx b/docs/react-testing-library/example-intro.mdx index 5344fc006..72ffb6600 100644 --- a/docs/react-testing-library/example-intro.mdx +++ b/docs/react-testing-library/example-intro.mdx @@ -65,17 +65,26 @@ test('loads and displays greeting', async () => { See the following sections for a detailed breakdown of the test +:::note +We recommend using the +[Mock Service Worker (MSW)](https://github.com/mswjs/msw) library to +declaratively mock API communication in your tests instead of stubbing +`window.fetch`, or relying on third-party adapters. + +MSW requires Node.js 18 or later. +::: + ```jsx title="__tests__/fetch.test.jsx" import React from 'react' -import {rest} from 'msw' +import {http, HttpResponse} from 'msw' import {setupServer} from 'msw/node' import {render, fireEvent, screen} from '@testing-library/react' import '@testing-library/jest-dom' import Fetch from '../fetch' const server = setupServer( - rest.get('/greeting', (req, res, ctx) => { - return res(ctx.json({greeting: 'hello there'})) + http.get('/greeting', () => { + return HttpResponse.json({greeting: 'hello there'}) }), ) @@ -96,8 +105,8 @@ test('loads and displays greeting', async () => { test('handles server error', async () => { server.use( - rest.get('/greeting', (req, res, ctx) => { - return res(ctx.status(500)) + http.get('/greeting', () => { + return new HttpResponse(null, {status: 500}) }), ) @@ -112,10 +121,6 @@ test('handles server error', async () => { }) ``` -> We recommend using [Mock Service Worker](https://github.com/mswjs/msw) library -> to declaratively mock API communication in your tests instead of stubbing -> `window.fetch`, or relying on third-party adapters. - --- ## Step-By-Step @@ -127,7 +132,7 @@ test('handles server error', async () => { import React from 'react' // import API mocking utilities from Mock Service Worker -import {rest} from 'msw' +import {http, HttpResponse} from 'msw' import {setupServer} from 'msw/node' // import react-testing methods @@ -156,9 +161,9 @@ component makes. // declare which API requests to mock const server = setupServer( // capture "GET /greeting" requests - rest.get('/greeting', (req, res, ctx) => { + http.get('/greeting', (req, res, ctx) => { // respond using a mocked JSON body - return res(ctx.json({greeting: 'hello there'})) + return HttpResponse.json({greeting: 'hello there'}) }), ) @@ -176,8 +181,8 @@ test('handles server error', async () => { server.use( // override the initial "GET /greeting" request handler // to return a 500 Server Error - rest.get('/greeting', (req, res, ctx) => { - return res(ctx.status(500)) + http.get('/greeting', (req, res, ctx) => { + return new HttpResponse(null, {status: 500}) }), ) From 0796527a922dd49e5baad485fd9f1c8907f1e639 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Sat, 6 Apr 2024 08:14:13 +0300 Subject: [PATCH 044/123] docs: add kettanaito as a contributor for doc (#1379) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] --------- Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 1 + 2 files changed, 10 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index b3e0b4fce..1acb7d59e 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2628,6 +2628,15 @@ "doc", "review" ] + }, + { + "login": "kettanaito", + "name": "Artem Zakharchenko", + "avatar_url": "https://avatars.githubusercontent.com/u/14984911?v=4", + "profile": "https://kettanaito.com/", + "contributions": [ + "doc" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index 480466dbf..f7071cf32 100644 --- a/README.md +++ b/README.md @@ -508,6 +508,7 @@ Thanks goes to these wonderful people smk267
smk267

🚇 Dylan Gordon
Dylan Gordon

📖 Michael Cousins
Michael Cousins

📖 👀 + Artem Zakharchenko
Artem Zakharchenko

📖 From e99027a2704d56203285c0ad58aac1d4236aa28e Mon Sep 17 00:00:00 2001 From: Sebastian Silbermann Date: Mon, 8 Apr 2024 16:09:26 +0200 Subject: [PATCH 045/123] react: legacyRoot is only supported in React <= 18 (#1380) --- docs/react-testing-library/api.mdx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/react-testing-library/api.mdx b/docs/react-testing-library/api.mdx index 359bc1134..67009798c 100644 --- a/docs/react-testing-library/api.mdx +++ b/docs/react-testing-library/api.mdx @@ -107,6 +107,8 @@ your components. ### `legacyRoot` +**WARNING**: This option is only available when tests run with React 18 and earlier. + By default we'll render with support for concurrent features (i.e. [`ReactDOMClient.createRoot`](https://reactjs.org/docs/react-dom-client.html#createroot)). However, if you're dealing with a legacy app that requires rendering like in From 2830b7fe1795848552c11283f96d30f511d9d425 Mon Sep 17 00:00:00 2001 From: Matan Borenkraout Date: Mon, 8 Apr 2024 17:27:31 +0300 Subject: [PATCH 046/123] docs: use warning admonition for `legacyRoot` (#1381) * docs: use warning admonition for `legacyRoot` * fix admonition --- docs/react-testing-library/api.mdx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/react-testing-library/api.mdx b/docs/react-testing-library/api.mdx index 67009798c..493d75194 100644 --- a/docs/react-testing-library/api.mdx +++ b/docs/react-testing-library/api.mdx @@ -107,7 +107,11 @@ your components. ### `legacyRoot` -**WARNING**: This option is only available when tests run with React 18 and earlier. +:::warning + +This option is only available when tests run with React 18 and earlier. + +::: By default we'll render with support for concurrent features (i.e. [`ReactDOMClient.createRoot`](https://reactjs.org/docs/react-dom-client.html#createroot)). @@ -342,7 +346,7 @@ function renderHook< Props, Q extends Queries = typeof queries, Container extends Element | DocumentFragment = HTMLElement, - BaseElement extends Element | DocumentFragment = Container, + BaseElement extends Element | DocumentFragment = Container >( render: (initialProps: Props) => Result, options?: RenderHookOptions, @@ -475,4 +479,3 @@ configure({reactStrictMode: true}) When enabled, [``](https://react.dev/reference/react/StrictMode) is rendered around the inner element. Defaults to `false`. - From 93b87b8663eb6d5fa2f45bc9c8dfeb222dbeace1 Mon Sep 17 00:00:00 2001 From: Tim Deschryver <28659384+timdeschryver@users.noreply.github.com> Date: Wed, 10 Apr 2024 18:24:39 +0200 Subject: [PATCH 047/123] remove node 18 mention (#1382) --- docs/react-testing-library/example-intro.mdx | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/react-testing-library/example-intro.mdx b/docs/react-testing-library/example-intro.mdx index 72ffb6600..4cc320185 100644 --- a/docs/react-testing-library/example-intro.mdx +++ b/docs/react-testing-library/example-intro.mdx @@ -70,8 +70,6 @@ We recommend using the [Mock Service Worker (MSW)](https://github.com/mswjs/msw) library to declaratively mock API communication in your tests instead of stubbing `window.fetch`, or relying on third-party adapters. - -MSW requires Node.js 18 or later. ::: ```jsx title="__tests__/fetch.test.jsx" From a6bf3f5898ece8e6d9823a56062d524c8a98a89c Mon Sep 17 00:00:00 2001 From: Sebastian Silbermann Date: Mon, 22 Apr 2024 18:32:31 +0200 Subject: [PATCH 048/123] New install instructions for RTL (#1384) --- docs/react-testing-library/intro.mdx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/docs/react-testing-library/intro.mdx b/docs/react-testing-library/intro.mdx index bf5c4ffda..9cf2a553e 100644 --- a/docs/react-testing-library/intro.mdx +++ b/docs/react-testing-library/intro.mdx @@ -7,15 +7,20 @@ sidebar_label: Introduction [`React Testing Library`][gh] builds on top of `DOM Testing Library` by adding APIs for working with React components. -> Projects created with [`Create React App`](https://create-react-app.dev/) have -> out of the box support for **React Testing Library**. If that is not the case, -> you can add it via `npm` like so: +## Installation ```bash npm2yarn npm install --save-dev @testing-library/react ``` -- [React Testing Library on GitHub][gh] +### With TypeScript + +To get full type coverage, you need to install the types for `react-dom` as well: + +```bash npm2yarn +npm install --save-dev @testing-library/react @types/react-dom +``` + [gh]: https://github.com/testing-library/react-testing-library From a60ad6df779fbcb742b9410cdcdda87005cdcbe9 Mon Sep 17 00:00:00 2001 From: Michael Cousins Date: Wed, 24 Apr 2024 11:46:03 -0400 Subject: [PATCH 049/123] docs(svelte-testing-library): add Vite plugin to setup instructions (#1385) --- docs/svelte-testing-library/setup.mdx | 52 +++++++++++++++++---------- 1 file changed, 34 insertions(+), 18 deletions(-) diff --git a/docs/svelte-testing-library/setup.mdx b/docs/svelte-testing-library/setup.mdx index 473aa51ba..7da928a09 100644 --- a/docs/svelte-testing-library/setup.mdx +++ b/docs/svelte-testing-library/setup.mdx @@ -37,42 +37,55 @@ runner that's ESM compatible. npm install --save-dev @vitest/ui ``` -2. Add a `vitest-setup.js` file to optionally set up automatic post-test cleanup - and [`@testing-library/jest-dom`][@testing-library/jest-dom] expect matchers. +2. Add a `vitest-setup.js` file to optionally set up + [`@testing-library/jest-dom`][@testing-library/jest-dom] expect matchers. - ```ts title="vitest-setup.js" - import '@testing-library/svelte/vitest' + ```js title="vitest-setup.js" import '@testing-library/jest-dom/vitest' ``` -3. Add `vitest.config.js`, or update your existing `vite.config.js`, to process - Svelte files, resolve browser exports during tests, use the [jsdom][] (or - [happy-dom][]) environment, and run your setup file. +3. Add `vitest.config.js`, or update your existing `vite.config.js`, with the + `svelte` and `svelteTesting` Vite plugins. Set the testing environment to + your DOM library of choice and optionally configure your setup file from step + (2). ```js title="vitest.config.js" import {defineConfig} from 'vitest/config' import {svelte} from '@sveltejs/vite-plugin-svelte' + import {svelteTesting} from '@testing-library/svelte/vite' - export default defineConfig(({mode}) => ({ - plugins: [svelte()], - resolve: { - conditions: mode === 'test' ? ['browser'] : [], - }, + export default defineConfig({ + plugins: [svelte(), svelteTesting()], test: { environment: 'jsdom', setupFiles: ['./vitest-setup.js'], }, - })) + }) ``` :::note - Prepending the `browser` resolve condition to Vite's default conditions may - cause issues if you have a complex Vite configuration or dependencies that - cannot be loaded into Node.js + The `svelteTesting` plugin: + + - Adds an automatic cleanup fixture to [`test.setupFiles`][test-setup-files] + - Adds `browser` to [`resolve.conditions`][resolve-conditions] + + If needed, you can disable either behavior. Disabling both options is + equivalent to omitting the plugin. + + ```js + svelteTesting({ + // disable auto cleanup + autoCleanup: false, + // disable browser resolution condition + resolveBrowser: false, + }) + ``` - See [testing-library/svelte-testing-library#222][] for more information and - alternative configuration options to ensure Svelte's browser bundle is used. + Resolving the `browser` condition may cause issues if you have a complex Vite + configuration or dependencies that cannot be loaded into Node.js. See + [testing-library/svelte-testing-library#222][] for more information and + alternative configuration options to ensure Svelte's browser code is used. ::: 4. Add test scripts to your `package.json` to run the tests with Vitest @@ -104,6 +117,9 @@ runner that's ESM compatible. [vitest dom]: https://vitest.dev/guide/environment.html [testing-library/svelte-testing-library#222]: https://github.com/testing-library/svelte-testing-library/issues/222 +[test-setup-files]: https://vitest.dev/config/#setupfiles +[resolve-conditions]: + https://vitejs.dev/config/shared-options.html#resolve-conditions ## Jest From bf1f4376c67f709ae22d50a9a16d91170a5b4e6b Mon Sep 17 00:00:00 2001 From: Tim Deschryver <28659384+timdeschryver@users.noreply.github.com> Date: Fri, 26 Apr 2024 08:11:16 +0200 Subject: [PATCH 050/123] docs: include v16 in version compatibility table (#1387) --- docs/angular-testing-library/version-compatibility.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/angular-testing-library/version-compatibility.mdx b/docs/angular-testing-library/version-compatibility.mdx index 7765c43cc..90cac77fc 100644 --- a/docs/angular-testing-library/version-compatibility.mdx +++ b/docs/angular-testing-library/version-compatibility.mdx @@ -8,7 +8,7 @@ Library and Angular. | Angular | Angular Testing Library | | ------- | ----------------------- | -| 17.x | 15.x, 14.x, 13.x | +| 17.x | 16.x, 15.x, 14.x, 13.x | | 16.x | 14.x, 13.x | | >= 15.1 | 14.x, 13.x | | < 15.1 | 12.x, 11.x | From 882dff9dd21e4508bca37aed062b3ab50523c5e4 Mon Sep 17 00:00:00 2001 From: Michael Cousins Date: Mon, 29 Apr 2024 11:54:34 -0400 Subject: [PATCH 051/123] docs(svelte-testing-library): add sveltekit setup instructions (#1389) Closes #1388 --- docs/svelte-testing-library/setup.mdx | 31 +++++++++++++++++++++------ 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/docs/svelte-testing-library/setup.mdx b/docs/svelte-testing-library/setup.mdx index 7da928a09..f7b14938c 100644 --- a/docs/svelte-testing-library/setup.mdx +++ b/docs/svelte-testing-library/setup.mdx @@ -49,7 +49,7 @@ runner that's ESM compatible. your DOM library of choice and optionally configure your setup file from step (2). - ```js title="vitest.config.js" + ```js title="vite.config.js" import {defineConfig} from 'vitest/config' import {svelte} from '@sveltejs/vite-plugin-svelte' import {svelteTesting} from '@testing-library/svelte/vite' @@ -63,6 +63,22 @@ runner that's ESM compatible. }) ``` + Or, if you're using [SvelteKit][sveltekit]: + + ```js title="vite.config.js" + import {defineConfig} from 'vitest/config' + import {sveltekit} from '@sveltejs/kit/vite' + import {svelteTesting} from '@testing-library/svelte/vite' + + export default defineConfig({ + plugins: [sveltekit(), svelteTesting()], + test: { + environment: 'jsdom', + setupFiles: ['./vitest-setup.js'], + }, + }) + ``` + :::note The `svelteTesting` plugin: @@ -115,6 +131,7 @@ runner that's ESM compatible. [happy-dom]: https://github.com/capricorn86/happy-dom [@vitest/ui]: https://vitest.dev/guide/ui.html [vitest dom]: https://vitest.dev/guide/environment.html +[sveltekit]: https://kit.svelte.dev/ [testing-library/svelte-testing-library#222]: https://github.com/testing-library/svelte-testing-library/issues/222 [test-setup-files]: https://vitest.dev/config/#setupfiles @@ -155,13 +172,13 @@ you must use Jest in [ESM mode][jest esm mode]. ```js title="jest.config.js" module.exports = { - "transform": { - "^.+\\.svelte$": "svelte-jester" + transform: { + '^.+\\.svelte$': 'svelte-jester', }, - "moduleFileExtensions": ["js", "svelte"], - "extensionsToTreatAsEsm": ["svelte"] - "testEnvironment": "jsdom", - "setupFilesAfterEnv": ["/jest-setup.js"] + moduleFileExtensions: ['js', 'svelte'], + extensionsToTreatAsEsm: ['.svelte'], + testEnvironment: 'jsdom', + setupFilesAfterEnv: ['/jest-setup.js'], } ``` From 288b86f1c76da868d132b95ad05e9448462169fb Mon Sep 17 00:00:00 2001 From: Michael Cousins Date: Mon, 29 Apr 2024 14:56:54 -0400 Subject: [PATCH 052/123] docs(svelte-testing-library): update API docs for v5 release (#1369) --- docs/svelte-testing-library/api.mdx | 337 ++++++++++++++++++++-------- 1 file changed, 247 insertions(+), 90 deletions(-) diff --git a/docs/svelte-testing-library/api.mdx b/docs/svelte-testing-library/api.mdx index 0c3851b2f..4355dc682 100644 --- a/docs/svelte-testing-library/api.mdx +++ b/docs/svelte-testing-library/api.mdx @@ -4,149 +4,306 @@ title: API sidebar_label: API --- -- [`@testing-library/dom`](#testing-library-dom) +`@testing-library/svelte` re-exports everything from +[`@testing-library/dom`][@testing-library/dom], as well as: + - [`render`](#render) +- [`act`](#act) - [`cleanup`](#cleanup) -- [`act`](#act-async) -- [`fireEvent`](#fireevent-async) - ---- +- [`fireEvent` (async)](#fireevent-async) -## `@testing-library/dom` - -This library re-exports everything from the DOM Testing Library -(`@testing-library/dom`). See the [documentation](queries/about.mdx) to see what -goodies you can use. - -📝 `fireEvent` is an `async` method when imported from -`@testing-library/svelte`. This is because it calls [`tick`][svelte-tick] which -tells Svelte to apply any new changes to the DOM. +[@testing-library/dom]: ../dom-testing-library/api.mdx ## `render` +Render your component to the DOM with Svelte. By default, the component will be +rendered into a `
` appended to `document.body`. + ```js import {render} from '@testing-library/svelte' +import MyComponent from './MyComponent.svelte' -const view = render(YourComponent, {ComponentOptions}, {RenderOptions}) +const result = render(MyComponent, componentOptions, renderOptions) ``` ### Component Options -These are the options you pass when instantiating your Svelte `Component`. -Please refer to the -[Client-side component API](https://svelte.dev/docs#run-time-client-side-component-api-creating-a-component). +You may customize how the component is created and mounted. These options are +passed directly to Svelte. -📝 If the only option you're passing in is `props`, then you can just pass them -in directly. +If you only need to send props to your component, you may pass props directly, +as long as those props don't share a name with a component option. ```js -// With options. -const view = render(YourComponent, { - target: MyTarget, +// pass props to the component +render(YourComponent, {myProp: 'value'}) + +// pass props and other options to the component +render(YourComponent, { props: {myProp: 'value'}, + context: new Map([[('theme': 'dark')]]), }) - -// Props only. -const view = render(YourComponent, {myProp: 'value'}) ``` +The most common options you will need are: + +| Option | Description | Default | +| --------- | ------------------------------------------------------- | ----------------------------------- | +| `props` | Props to pass to the component. | N/A | +| `context` | A `Map` of context values to render the component with. | N/A | +| `target` | An `HTMLElement` to render the component into. | `
` appended to `document.body` | + +If you specify the `target` option, the `target` element will _not_ be appended +to `document.body` automatically, and it will be used as the base element for +[bound queries](#queries) and [`debug`](#debug). + +Refer to the [Svelte client-side component API docs][svelte-component-api] for +all available options. + +[svelte-component-api]: https://svelte.dev/docs/client-side-component-api + ### Render Options -| Option | Description | Default | -| ----------- | ----------------------------------------------------------------------------------- | --------------- | -| `container` | The HTML element the component is mounted into. | `document.body` | -| `queries` | Queries to bind to the container. See [within](dom-testing-library/api-within.mdx). | `null` | +You may also customize how Svelte Testing Library renders your component. Most +of the time, you shouldn't need to modify these options. + +:::caution + +Prior to `@testing-library/svelte@5.0.0`, the `baseElement` option was named +`container`. + +::: + +| Option | Description | Default | +| ------------- | --------------------------------------------------- | ------------------------------------------ | +| `baseElement` | The base element for queries and [`debug`](#debug). | `componentOptions.target ?? document.body` | +| `queries` | [Custom Queries][custom-queries]. | N/A | + +[custom-queries]: ../dom-testing-library/api-custom-queries.mdx + +### Render Results + +| Result | Description | +| ----------------------------- | ---------------------------------------------------------- | +| [`baseElement`](#baseelement) | The base DOM element used for queries. | +| [`component`](#component) | The mounted Svelte component. | +| [`container`](#container) | The DOM element the component is mounted to. | +| [`debug`](#debug) | Log elements using [`prettyDOM`][pretty-dom]. | +| [`rerender`](#rerender) | Update the component's props. | +| [`unmount`](#unmount) | Unmount and destroy the component. | +| [`...queries`](#queries) | [Query functions][query-functions] bound to `baseElement`. | + +[pretty-dom]: ../dom-testing-library/api-debugging.mdx#prettydom +[query-functions]: ../queries/about.mdx + +#### `baseElement` + +_Added in `@testing-library/svelte@5.0.0`_ + +The base DOM element that queries are bound to. Corresponds to +`renderOptions.baseElement`. If you do not use `componentOptions.target` nor +`renderOptions.baseElement`, this will be `document.body`. + +#### `container` + +The DOM element the component is mounted in. Corresponds to +`componentOptions.target`. In general, avoid using `container` directly to query +for elements; use [testing-library queries][query-functions] instead. + +:::tip + +Use `container.firstChild` to get the first rendered element of your component. + +::: + +:::caution + +Prior to `@testing-library/svelte@5.0.0`, `container` was set to the base +element. Use `container.firstChild.firstChild` to get the first rendered element +of the component in earlier versions. + +::: + +#### `component` + +The Svelte component instance. See the [Svelte component +API][svelte-component-api] for more details. + +:::tip + +Avoid using `component` except to test developer-facing APIs, like exported +functions. Instead, interact with the DOM. Read [Avoid the Test User][test-user] +by Kent C. Dodds to understand the difference between the **end user** and +**developer user**. + +::: + +[test-user]: https://kentcdodds.com/blog/avoid-the-test-user + +#### `debug` + +Log the `baseElement` or a given element using [`prettyDOM`][pretty-dom]. + +:::tip + +If your `baseElement` is the default `document.body`, we recommend using +[`screen.debug`][screen-debug]. + +::: + +```js +import {render, screen} from '@testing-library/svelte' + +const {debug} = render(MyComponent, {myProp: 'value'}) + +const button = screen.getByRole('button') -### Results +// log `document.body` +screen.debug() -| Result | Description | -| ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `container` | The HTML element the component is mounted into. | -| `component` | The newly created Svelte component. Generally, this should only be used when testing exported functions, or when you're testing developer facing API's. Outside of said cases avoid using the component directly to build tests, instead of interacting with the rendered Svelte component, work with the DOM. Have a read of [Avoid the Test User](https://kentcdodds.com/blog/avoid-the-test-user) by Kent C. Dodds to understand the difference between the **end user** and **developer user**. | -| `debug` | Logs the `container` using [prettyDom](dom-testing-library/api-debugging.mdx/#prettydom). | -| `unmount` | Unmounts the component from the `target` by calling `component.$destroy()`. | -| `rerender` | Calls render again destroying the old component, and mounting the new component on the original `target` with any new options passed in. | -| `...queries` | Returns all [query functions](queries/about.mdx) that are bound to the `container`. If you pass in `query` arguments than this will be those, otherwise all. | +// log your custom `target` or `baseElement` +debug() + +// log a specific element +screen.debug(button) +debug(button) +``` + +[screen-debug]: ../dom-testing-library/api-debugging.mdx#screendebug + +#### `rerender` + +Update one or more of the component's props and wait for Svelte to update. + +```js +const {rerender} = render(MyComponent, {myProp: 'value'}) + +await rerender({myProp: 'new value'})) +``` + +:::caution + +Prior to `@testing-library/svelte@5.0.0`, calling `rerender` would destroy and +remount the component. Use `component.$set` and [`act`](#act) to update props in +earlier versions: + +```js +const {component} = render(MyComponent, {myProp: 'value'}) + +await act(() => component.$set({myProp: 'new value'})) +``` + +::: + +#### `unmount` + +Unmount and destroy the Svelte component. + +```js +const {unmount} = render(MyComponent, {myProp: 'value'}) + +unmount() +``` + +#### Queries + +[Query functions][query-functions] bound to the [`baseElement`](#baseelement). +If you passed [custom queries][custom-queries] to `render`, those will be +available instead of the default queries. + +:::tip + +If your [`baseElement`](#baseelement) is the default `document.body`, we +recommend using [`screen`][screen] rather than bound queries. + +::: + +```js +import {render, screen} from '@testing-library/svelte' + +const {getByRole} = render(MyComponent, {myProp: 'value'}) + +// query `document.body` +const button = screen.getByRole('button') + +// query using a custom `target` or `baseElement` +const button = getByRole('button') +``` + +[screen]: ../queries/about.mdx#screen ## `cleanup` -> This is called automatically if your testing framework (such as mocha, Jest or -> Jasmine) injects a global `afterEach()` function into the testing environment. -> If not, you will need to call `cleanup()` after each test. +Destroy all components and remove any elements added to `document.body`. + +:::info + +`cleanup` is called automatically if your testing framework adds a global +`afterEach` method (e.g. Mocha, Jest, or Jasmine), or if you use +`import '@testing-library/svelte/vitest'` in your [Vitest setup +file][vitest-setup]. Usually, you shouldn't need to call `cleanup` yourself. -Unmounts the component from the container and destroys the container. +If you'd like to disable automatic cleanup in a framework that uses a global +`afterEach` method, set `process.env.STL_SKIP_AUTO_CLEANUP`. -📝 When you import anything from the library, this automatically runs after each -test. If you'd like to disable this then set `process.env.STL_SKIP_AUTO_CLEANUP` -to true or import `dont-clean-up-after-each` from the library. +::: ```js import {render, cleanup} from '@testing-library/svelte' +// Default: runs after each test afterEach(() => { cleanup() -}) // Default on import: runs it after each test. +}) render(YourComponent) -cleanup() // Or like this for more control. +// Called manually for more control +cleanup() ``` -## `act` (`async`) - -An `async` helper method that takes in a `function` or `Promise` that is -immediately called/resolved, and then calls [`tick`][svelte-tick] so all pending -state changes are flushed, and the view now reflects any changes made to the -DOM. +[vitest-setup]: ./setup.mdx#vitest -## `fireEvent` (`async`) +## `act` -Calls `@testing-library/dom` [fireEvent](dom-testing-library/api-events.mdx). It -is an `async` method due to calling [`tick`][svelte-tick] which tells Svelte to -flush all pending state changes, basically it updates the DOM to reflect the new -changes. +Ensure all pending updates from Svelte are applied to the DOM. Optionally, you +may pass a function to be called before updates are applied. If the function +returns a `Promise`, it will be resolved first. -**Component** +Uses Svelte's [`tick`][svelte-tick] method to apply updates. -```html - +const {component} = render(MyComponent) - +await act(() => { + component.updateSomething() +}) ``` -**Test** +[svelte-tick]: https://svelte.dev/docs/svelte#tick -```js -import '@testing-library/jest-dom' +## `fireEvent` (async) -import {render, fireEvent, screen} from '@testing-library/svelte' +Fire an event and wait for Svelte to update the DOM. An asynchronous wrapper of +DOM Testing Library's [`fireEvent`][fire-event]. -import Comp from '..' +:::tip -test('count increments when button is clicked', async () => { - render(Comp) - const button = screen.getByText('Count is 0') +Where possible, we recommend [`@testing-library/user-event`][user-event] instead +of `fireEvent`. - // Option 1. - await fireEvent.click(button) - expect(button).toHaveTextContent('Count is 1') +::: - // Option 2. - await fireEvent( - button, - new MouseEvent('click', { - bubbles: true, - cancelable: true, - }), - ) - expect(button).toHaveTextContent('Count is 2') -}) +```js +import {fireEvent, render, screen} from '@testing-library/svelte' + +render(MyComponent) + +const button = screen.getByRole('button') +await fireEvent.click(button) ``` -[svelte-tick]: https://svelte.dev/docs/svelte#tick +[fire-event]: ../dom-testing-library/api-events.mdx +[user-event]: ../user-event/intro.mdx From e86206781adddcb911a2e3e13c7afd108f393b19 Mon Sep 17 00:00:00 2001 From: Matan Borenkraout Date: Wed, 1 May 2024 21:38:39 +0300 Subject: [PATCH 053/123] docs: recommend installing `@types/react` (#1390) --- docs/react-testing-library/intro.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/react-testing-library/intro.mdx b/docs/react-testing-library/intro.mdx index 9cf2a553e..fdb38ddea 100644 --- a/docs/react-testing-library/intro.mdx +++ b/docs/react-testing-library/intro.mdx @@ -15,10 +15,10 @@ npm install --save-dev @testing-library/react ### With TypeScript -To get full type coverage, you need to install the types for `react-dom` as well: +To get full type coverage, you need to install the types for `react` and `react-dom` as well: ```bash npm2yarn -npm install --save-dev @testing-library/react @types/react-dom +npm install --save-dev @testing-library/react @types/react-dom @types/react ``` From 9739ce9f383958596ab7bc8ab9b000f3c9b200c2 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Thu, 9 May 2024 11:21:45 +0300 Subject: [PATCH 054/123] docs: add vadimshvetsov as a contributor for doc (#1345) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] * docs: remove profile for vadimshvetsov --------- Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> Co-authored-by: Matan Borenkraout --- .all-contributorsrc | 9 +++++++++ README.md | 1 + 2 files changed, 10 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 1acb7d59e..d5d3c6aac 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2637,6 +2637,15 @@ "contributions": [ "doc" ] + }, + { + "login": "vadimshvetsov", + "name": "Vadim Shvetsov", + "avatar_url": "https://avatars.githubusercontent.com/u/16336572?v=4", + "profile": "https://github.com/vadimshvetsov", + "contributions": [ + "doc" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index f7071cf32..b86cfb29c 100644 --- a/README.md +++ b/README.md @@ -506,6 +506,7 @@ Thanks goes to these wonderful people smk267
smk267

🚇 + Vadim Shvetsov
Vadim Shvetsov

📖 Dylan Gordon
Dylan Gordon

📖 Michael Cousins
Michael Cousins

📖 👀 Artem Zakharchenko
Artem Zakharchenko

📖 From b2be4bb67a08803fedfc998cfa3e65f78cf2bb10 Mon Sep 17 00:00:00 2001 From: Domantas Petrauskas Date: Wed, 15 May 2024 13:43:39 +0300 Subject: [PATCH 055/123] docs: clarify fake timer usage with user-event (#1391) Closes #1180 --- docs/guides-using-fake-timers.mdx | 25 ++++++++++++++----------- docs/user-event/options.mdx | 17 +++++++++++++++-- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/docs/guides-using-fake-timers.mdx b/docs/guides-using-fake-timers.mdx index 68bee9c5d..bc7ab201e 100644 --- a/docs/guides-using-fake-timers.mdx +++ b/docs/guides-using-fake-timers.mdx @@ -10,11 +10,8 @@ flaky. To solve these problems, or if you need to rely on specific timestamps in your code, most testing frameworks offer the option to replace the real timers in -your tests with fake ones. This should be used sporadically and not on a regular -basis since using it contains some overhead. - -When using fake timers in your tests, all of the code inside your test uses fake -timers. +your tests with fake ones. This has a side effect - when using fake timers in +your tests, _all_ of the code inside your test uses fake timers. The common pattern to setup fake timers is usually within the `beforeEach`, for example: @@ -26,12 +23,10 @@ beforeEach(() => { }) ``` -When using fake timers, you need to remember to restore the timers after your -test runs. - -The main reason to do that is to prevent 3rd party libraries running after your -test finishes (e.g cleanup functions), from being coupled to your fake timers -and use real timers instead. +Since fake timers are mocking native timer functions, it is necessary to restore +the timers after your test runs, just like regular mocks. This prevents fake +timers leaking into other test cases and cleanup functions, where real timers +are expected. For that you usually call `useRealTimers` in `afterEach`. @@ -51,3 +46,11 @@ afterEach(() => { jest.useRealTimers() }) ``` + +:::note + +Combining fake timers with `user-event` may cause test timeouts. Refer to +[`advanceTimers`](user-event/options.mdx#advancetimers) option to prevent this +issue. + +::: diff --git a/docs/user-event/options.mdx b/docs/user-event/options.mdx index 13ec10768..014912680 100644 --- a/docs/user-event/options.mdx +++ b/docs/user-event/options.mdx @@ -8,8 +8,21 @@ can be applied per [`setup()`](setup.mdx). ### advanceTimers -If you are using fake timers, you need to advance your timers when we internally -[delay](#delay) subsequent code. +`user-event` adds a [delay](#delay) between some subsequent inputs. When using +[fake timers](/guides-using-fake-timers.mdx) it is necessary to set this option +to your test runner's time advancement function. For example: + +```js +const user = userEvent.setup({advanceTimers: jest.advanceTimersByTime}) +``` + +:::caution + +You may find suggestions to set `delay: null` to prevent test timeouts when +using fake timers. That is not recommended, as it may cause unexpected +behaviour. Starting from v14.1, we suggest using `advanceTimers` option instead. + +::: ```ts (delay: number) => Promise | void From ddafad76bf46c62e537f733ff7537478c4a7d143 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Wed, 15 May 2024 15:57:46 +0200 Subject: [PATCH 056/123] docs: add domnantas as a contributor for doc (#1393) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] --------- Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index d5d3c6aac..82a57d738 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2646,6 +2646,15 @@ "contributions": [ "doc" ] + }, + { + "login": "domnantas", + "name": "Domantas Petrauskas", + "avatar_url": "https://avatars.githubusercontent.com/u/51953549?v=4", + "profile": "https://domnantas.lt/", + "contributions": [ + "doc" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index b86cfb29c..8a295dc49 100644 --- a/README.md +++ b/README.md @@ -506,10 +506,11 @@ Thanks goes to these wonderful people smk267
smk267

🚇 - Vadim Shvetsov
Vadim Shvetsov

📖 Dylan Gordon
Dylan Gordon

📖 Michael Cousins
Michael Cousins

📖 👀 Artem Zakharchenko
Artem Zakharchenko

📖 + Vadim Shvetsov
Vadim Shvetsov

📖 + Domantas Petrauskas
Domantas Petrauskas

📖 From 27490f82b6a1a02d036b39a7b39adadac8362253 Mon Sep 17 00:00:00 2001 From: Matan Borenkraout Date: Wed, 22 May 2024 16:39:55 +0300 Subject: [PATCH 057/123] docs: fix note not closed (#1395) --- docs/react-testing-library/example-intro.mdx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/react-testing-library/example-intro.mdx b/docs/react-testing-library/example-intro.mdx index 4cc320185..a5d67830f 100644 --- a/docs/react-testing-library/example-intro.mdx +++ b/docs/react-testing-library/example-intro.mdx @@ -66,10 +66,12 @@ test('loads and displays greeting', async () => { See the following sections for a detailed breakdown of the test :::note + We recommend using the [Mock Service Worker (MSW)](https://github.com/mswjs/msw) library to declaratively mock API communication in your tests instead of stubbing `window.fetch`, or relying on third-party adapters. + ::: ```jsx title="__tests__/fetch.test.jsx" From c6a349ca607cf14fcebb4d49f066e60790413f48 Mon Sep 17 00:00:00 2001 From: Efim <126895483+Efim-Kapliy@users.noreply.github.com> Date: Tue, 28 May 2024 14:43:42 +0300 Subject: [PATCH 058/123] docs: replace the TabItem values with general ones (#1394) --- docs/react-testing-library/setup.mdx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/react-testing-library/setup.mdx b/docs/react-testing-library/setup.mdx index 61ce15879..38ddc56ca 100644 --- a/docs/react-testing-library/setup.mdx +++ b/docs/react-testing-library/setup.mdx @@ -31,10 +31,10 @@ make your test util file accessible without using relative paths. The example below sets up data providers using the [`wrapper`](api.mdx#wrapper) option to `render`. - + - + ```diff title="my-component.test.jsx" - import { render, fireEvent } from '@testing-library/react'; @@ -70,7 +70,7 @@ export {customRender as render} - + ```diff title="my-component.test.tsx" - import { render, fireEvent } from '@testing-library/react'; @@ -250,10 +250,10 @@ passing a [`queries`](api.mdx#render-options) option. If you want to add custom queries globally, you can do this by defining your customized `render`, `screen` and `within` methods: - + - + ```js title="test-utils.js" import {render, queries, within} from '@testing-library/react' @@ -278,7 +278,7 @@ export {customScreen as screen, customWithin as within, customRender as render} - + ```ts title="test-utils.ts" import {render, queries, within, RenderOptions} from '@testing-library/react' From 167be7b263c452c8137791e1a31f16fa48428f7f Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Tue, 28 May 2024 13:49:55 +0200 Subject: [PATCH 059/123] docs: add Efim-Kapliy as a contributor for doc (#1396) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] --------- Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 1 + 2 files changed, 10 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 82a57d738..21515caef 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2655,6 +2655,15 @@ "contributions": [ "doc" ] + }, + { + "login": "Efim-Kapliy", + "name": "Efim", + "avatar_url": "https://avatars.githubusercontent.com/u/126895483?v=4", + "profile": "https://portfolio.edkt.ru/", + "contributions": [ + "doc" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index 8a295dc49..3bb8a806d 100644 --- a/README.md +++ b/README.md @@ -511,6 +511,7 @@ Thanks goes to these wonderful people Artem Zakharchenko
Artem Zakharchenko

📖 Vadim Shvetsov
Vadim Shvetsov

📖 Domantas Petrauskas
Domantas Petrauskas

📖 + Efim
Efim

📖 From 5c2c9d93828e97e5b295571587e2a9849842c49f Mon Sep 17 00:00:00 2001 From: denisx Date: Sat, 1 Jun 2024 18:48:30 +0300 Subject: [PATCH 060/123] feat: fix layout shifts (#1392) * feat/fix layout shifts * fix: name refactoring; --- docusaurus.config.js | 7 +++++- src/components/GridBlock/index.jsx | 10 ++++---- src/pages/index.js | 38 ++++++++++++++++++++++++++++-- 3 files changed, 47 insertions(+), 8 deletions(-) diff --git a/docusaurus.config.js b/docusaurus.config.js index 034cec28f..389079706 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -256,6 +256,8 @@ module.exports = { logo: { alt: 'An octopus representing the DOM Testing Library Logo', src: 'img/octopus-64x64.png', + width: 32, + height: 32, }, items: [ { @@ -314,7 +316,8 @@ module.exports = { }, { label: 'Stack Overflow', - href: 'https://stackoverflow.com/questions/tagged/react-testing-library', + href: + 'https://stackoverflow.com/questions/tagged/react-testing-library', }, { label: 'Discord', @@ -355,6 +358,8 @@ module.exports = { logo: { src: 'img/octopus-128x128.png', alt: 'An octopus representing the DOM Testing Library Logo', + width: 128, + height: 128, }, }, algolia: { diff --git a/src/components/GridBlock/index.jsx b/src/components/GridBlock/index.jsx index aba112f89..1ff8ae580 100644 --- a/src/components/GridBlock/index.jsx +++ b/src/components/GridBlock/index.jsx @@ -9,7 +9,7 @@ import React from 'react' import classNames from 'classnames' import {MarkdownBlock} from '../MarkdownBlock' -const renderBlockImage = (image, imageLink, imageAlt) => { +const renderBlockImage = (image, imageLink, imageAlt, imageWidth, imageHeight) => { if (!image) { return null } @@ -18,10 +18,10 @@ const renderBlockImage = (image, imageLink, imageAlt) => {
{imageLink ? ( - {imageAlt} + {imageAlt} ) : ( - {imageAlt} + {imageAlt} )}
) @@ -67,11 +67,11 @@ export const GridBlock = props => { const topLeftImage = (block.imageAlign === 'top' || block.imageAlign === 'left') && - renderBlockImage(block.image, block.imageLink, block.imageAlt) + renderBlockImage(block.image, block.imageLink, block.imageAlt, block.imageWidth, block.imageHeight) const bottomRightImage = (block.imageAlign === 'bottom' || block.imageAlign === 'right') && - renderBlockImage(block.image, block.imageLink, block.imageAlt) + renderBlockImage(block.image, block.imageLink, block.imageAlt, block.imageWidth, block.imageHeight) return (
diff --git a/src/pages/index.js b/src/pages/index.js index f4857df84..c5ba1cc8a 100755 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -30,7 +30,12 @@ const HomeSplash = props => { const Logo = props => (
- Project Logo + Project Logo
) @@ -55,7 +60,11 @@ const HomeSplash = props => { return ( - +
@@ -82,6 +91,8 @@ export default class Index extends React.Component { imageAlign={props.imageAlign || 'center'} contents={props.children} layout={props.layout} + imageHeight={props.imageHeight} + imageWidth={props.imageWidth} /> ) @@ -109,6 +120,7 @@ export default class Index extends React.Component { "## The Problem \n - You want tests for your UI that avoid including implementation details and rather focus on making your tests give you the confidence for which they are intended. \n - You want your tests to be maintainable so refactors _(changes to implementation but not functionality)_ don't break your tests and slow you and your team down.", image: `${baseUrl}img/interrobang-128x128.png`, imageAlt: 'The problem (picture of a question mark)', + imageHeight: 128, imageAlign: 'left', }, ]} @@ -124,6 +136,7 @@ export default class Index extends React.Component { image: `${baseUrl}img/star-128x128.png`, imageAlign: 'right', imageAlt: 'The solution (picture of a star)', + imageHeight: 128, content: '## The Solution \n The Testing Library family of libraries is a very light-weight solution for testing without all the implementation details. The main utilities it provides involve querying for nodes similarly to how users would find them. In this way, testing-library helps ensure your tests give you confidence in your UI code.', }, @@ -136,6 +149,7 @@ export default class Index extends React.Component { image: `${baseUrl}img/trophy-128x128.png`, imageAlign: 'left', imageAlt: 'The guiding principle (picture of a brick wall)', + imageHeight: 128, content: '_The more your tests resemble the way your software is used, the more confidence they can give you._', }, @@ -153,6 +167,8 @@ export default class Index extends React.Component { imageAlign: 'top', title: 'Write Maintainable Tests', imageAlt: '', + imageWidth: 80, + imageHeight: 80, }, { content: 'Interact with your app the same way as your users', @@ -160,6 +176,8 @@ export default class Index extends React.Component { imageAlign: 'top', title: 'Develop with Confidence', imageAlt: '', + imageWidth: 80, + imageHeight: 80, }, { content: @@ -168,6 +186,8 @@ export default class Index extends React.Component { imageAlign: 'top', title: 'Accessible by Default', imageAlt: '', + imageWidth: 80, + imageHeight: 80, }, ]} @@ -181,72 +201,84 @@ export default class Index extends React.Component { imageAlign: 'top', title: '[React](./docs/react-testing-library/intro)', imageAlt: 'React logo', + imageHeight: 80, }, { image: `${baseUrl}img/vue-400x400.png`, imageAlign: 'top', title: '[Vue](./docs/vue-testing-library/intro)', imageAlt: 'Vue logo', + imageHeight: 80, }, { image: `${baseUrl}img/angular-128x128.png`, imageAlign: 'top', title: '[Angular](./docs/angular-testing-library/intro)', imageAlt: 'Angular logo', + imageHeight: 80, }, { image: `${baseUrl}img/svelte-logo.png`, imageAlign: 'top', title: '[Svelte](./docs/svelte-testing-library/intro)', imageAlt: 'Svelte logo', + imageHeight: 80, }, { image: `${baseUrl}img/preact-128x128.png`, imageAlign: 'top', title: '[Preact](./docs/preact-testing-library/intro)', imageAlt: 'Preact logo', + imageHeight: 80, }, { image: `${baseUrl}img/reason-200x200.png`, imageAlign: 'top', title: '[ReasonReact](./docs/bs-react-testing-library/intro)', imageAlt: 'ReasonReact logo', + imageHeight: 80, }, { image: `${baseUrl}img/react-native-128x128.png`, imageAlign: 'top', title: '[React Native](./docs/react-native-testing-library/intro)', imageAlt: 'React Native logo', + imageHeight: 80, }, { image: `${baseUrl}img/cypress-128x128.png`, imageAlign: 'top', title: '[Cypress](./docs/cypress-testing-library/intro)', imageAlt: 'Cypress logo', + imageHeight: 80, }, { image: `${baseUrl}img/puppeteer-275x275.png`, imageAlign: 'top', title: '[Puppeteer](./docs/pptr-testing-library/intro)', imageAlt: 'Puppeteer logo', + imageHeight: 80, }, { image: `${baseUrl}img/testcafe-128x128.jpg`, imageAlign: 'top', title: `[Testcafe](./docs/testcafe-testing-library/intro)`, imageAlt: 'Testcafe logo', + imageHeight: 80, }, { image: `${baseUrl}img/nightwatch-128x128.png`, imageAlign: 'top', title: '[Nightwatch](./docs/nightwatch-testing-library/intro)', imageAlt: 'Nightwatch logo', + imageHeight: 80, }, { image: `${baseUrl}img/construction-128x128.png`, imageAlign: 'top', title: '[And more...](./docs/user-event/intro)', imageAlt: '', + imageHeight: 80, }, ]} @@ -289,6 +321,7 @@ export default class Index extends React.Component { imageLink: 'https://osawards.com/react/2019', imageAlt: 'Winner of the Open Source Awards 2019 in the category "The most impactful contribution to the community"', + imageHeight: 273, }, { image: `${baseUrl}img/highest-satisfaction-638x574.png`, @@ -296,6 +329,7 @@ export default class Index extends React.Component { imageLink: 'https://2020.stateofjs.com/en-US/awards/', imageAlt: 'Winner of the State of JS 2020 award for the technology with the highest percentage of satisfied users', + imageHeight: 180, }, ]} From 03949d5b4ca1bfbe8a4bd8494313f680aaced2d0 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Sat, 1 Jun 2024 18:54:18 +0300 Subject: [PATCH 061/123] docs: add denisx as a contributor for code (#1397) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] --------- Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 3 +++ 2 files changed, 12 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 21515caef..c79b63380 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2664,6 +2664,15 @@ "contributions": [ "doc" ] + }, + { + "login": "denisx", + "name": "denisx", + "avatar_url": "https://avatars.githubusercontent.com/u/427776?v=4", + "profile": "https://github.com/denisx", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index 3bb8a806d..7df419735 100644 --- a/README.md +++ b/README.md @@ -513,6 +513,9 @@ Thanks goes to these wonderful people Domantas Petrauskas
Domantas Petrauskas

📖 Efim
Efim

📖 + + denisx
denisx

💻 + From 33e4f5e125deddc1a4bb4bd47115169888477e87 Mon Sep 17 00:00:00 2001 From: Matan Borenkraout Date: Sat, 1 Jun 2024 20:06:54 +0300 Subject: [PATCH 062/123] docs: fix all contributors badge (#1398) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7df419735..6aee4256e 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ and [related projects](https://github.com/testing-library) https://api.netlify.com/api/v1/badges/24366204-84ca-41e9-b573-2a64f0845e46/deploy-status [build]: https://app.netlify.com/sites/testing-library/deploys [allcontributors-badge]: - https://img.shields.io/badge/all_contributors-2-orange.svg?style=flat-square + https://img.shields.io/github/all-contributors/testing-library/testing-library-docs?color=ee8449&style=flat-square [coc-badge]: https://img.shields.io/badge/code%20of-conduct-ff69b4.svg?style=flat-square [coc]: From 0c01661a4dfd4fd951de3b0fc5521ff70174f8cc Mon Sep 17 00:00:00 2001 From: Matan Borenkraout Date: Mon, 3 Jun 2024 19:05:44 +0300 Subject: [PATCH 063/123] docs: move dtl to peerdeps for rtl (#1386) Co-authored-by: Sebastian Silbermann --- docs/react-testing-library/intro.mdx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/docs/react-testing-library/intro.mdx b/docs/react-testing-library/intro.mdx index fdb38ddea..7d8d026c4 100644 --- a/docs/react-testing-library/intro.mdx +++ b/docs/react-testing-library/intro.mdx @@ -9,19 +9,22 @@ APIs for working with React components. ## Installation +To get started with `React Testing Library`, you'll need to install it together +with its peerDependency `@testing-library/dom`: + ```bash npm2yarn -npm install --save-dev @testing-library/react +npm install --save-dev @testing-library/react @testing-library/dom ``` ### With TypeScript -To get full type coverage, you need to install the types for `react` and `react-dom` as well: +To get full type coverage, you need to install the types for `react` and `react-dom` as +well: ```bash npm2yarn -npm install --save-dev @testing-library/react @types/react-dom @types/react +npm install --save-dev @testing-library/react @testing-library/dom @types/react @types/react-dom ``` - [gh]: https://github.com/testing-library/react-testing-library ## The problem From 78661f3e85179e0ad67fb64202b41d669aac9673 Mon Sep 17 00:00:00 2001 From: Giovanni Gualiato Date: Thu, 13 Jun 2024 07:20:10 +0100 Subject: [PATCH 064/123] docs: update react doc links (#1399) --- docs/react-testing-library/api.mdx | 14 +++++++------- docs/react-testing-library/cheatsheet.mdx | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/react-testing-library/api.mdx b/docs/react-testing-library/api.mdx index 493d75194..a6a969ebb 100644 --- a/docs/react-testing-library/api.mdx +++ b/docs/react-testing-library/api.mdx @@ -101,7 +101,7 @@ well as what is printed when you use `debug()`. ### `hydrate` If hydrate is set to true, then it will render with -[ReactDOM.hydrate](https://reactjs.org/docs/react-dom.html#hydrate). This may be +[ReactDOM.hydrate](https://react.dev/reference/react-dom/hydrate#hydrate). This may be useful if you are using server-side rendering and use ReactDOM.hydrate to mount your components. @@ -114,10 +114,10 @@ This option is only available when tests run with React 18 and earlier. ::: By default we'll render with support for concurrent features (i.e. -[`ReactDOMClient.createRoot`](https://reactjs.org/docs/react-dom-client.html#createroot)). +[`ReactDOMClient.createRoot`](https://react.dev/reference/react-dom/client/createRoot)). However, if you're dealing with a legacy app that requires rendering like in React 17 (i.e. -[`ReactDOM.render`](https://reactjs.org/docs/react-dom.html#render)) then you +[`ReactDOM.render`](https://react.dev/reference/react-dom/render)) then you should enable this option by setting `legacyRoot: true`. ### `wrapper` @@ -176,7 +176,7 @@ The containing DOM node of your rendered React Element (rendered using > `container.firstChild`. > > NOTE: When that root element is a -> [React Fragment](https://reactjs.org/docs/fragments.html), +> [React Fragment](https://react.dev/reference/react/Fragment), > `container.firstChild` will only get the first child of that Fragment, not the > Fragment itself. @@ -327,10 +327,10 @@ errors in your tests). ## `act` This is a light wrapper around the -[`react-dom/test-utils` `act` function](https://reactjs.org/docs/test-utils.html#act). +[`react` `act` function](https://react.dev/reference/react/act). All it does is forward all arguments to the act function if your version of react supports `act`. It is recommended to use the import from -`@testing-library/react` over `react-dom/test-utils` for consistency reasons. +`@testing-library/react` over `react` for consistency reasons. ## `renderHook` @@ -432,7 +432,7 @@ expect(result.current).toBe('Alice') ``` Note that the value is held in `result.current`. Think of `result` as a -[ref](https://reactjs.org/docs/glossary.html#refs) for the most recently +[ref](https://react.dev/learn/referencing-values-with-refs) for the most recently **committed** value. ### `rerender` diff --git a/docs/react-testing-library/cheatsheet.mdx b/docs/react-testing-library/cheatsheet.mdx index 53da683d3..a50d82543 100644 --- a/docs/react-testing-library/cheatsheet.mdx +++ b/docs/react-testing-library/cheatsheet.mdx @@ -124,7 +124,7 @@ See [Events API](dom-testing-library/api-events.mdx) - **click** `fireEvent.click(node)` - [See all supported events](https://github.com/testing-library/dom-testing-library/blob/master/src/event-map.js) - **act** wrapper around - [react-dom/test-utils act](https://reactjs.org/docs/test-utils.html#act); + [react act](https://react.dev/reference/react/act); React Testing Library wraps render and fireEvent in a call to `act` already so most cases should not require using it manually From b9ae55436477eb4729f2c15a0286ed5038c11d6b Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Thu, 13 Jun 2024 09:22:23 +0300 Subject: [PATCH 065/123] docs: add ggualiato as a contributor for doc (#1400) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] --------- Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 1 + 2 files changed, 10 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index c79b63380..d84900e10 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2673,6 +2673,15 @@ "contributions": [ "code" ] + }, + { + "login": "ggualiato", + "name": "Giovanni Gualiato", + "avatar_url": "https://avatars.githubusercontent.com/u/26698704?v=4", + "profile": "https://github.com/ggualiato", + "contributions": [ + "doc" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index 6aee4256e..a0cfcf594 100644 --- a/README.md +++ b/README.md @@ -515,6 +515,7 @@ Thanks goes to these wonderful people denisx
denisx

💻 + Giovanni Gualiato
Giovanni Gualiato

📖 From 29df9b5fd0968f4aff03581ef781a37a92ec4818 Mon Sep 17 00:00:00 2001 From: Michael Cousins Date: Tue, 25 Jun 2024 11:07:56 -0400 Subject: [PATCH 066/123] docs(svelte-testing-library): add Svelte 5 setup instructions for Jest (#1401) --- docs/svelte-testing-library/setup.mdx | 29 ++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/docs/svelte-testing-library/setup.mdx b/docs/svelte-testing-library/setup.mdx index f7b14938c..2e0d8de9e 100644 --- a/docs/svelte-testing-library/setup.mdx +++ b/docs/svelte-testing-library/setup.mdx @@ -171,7 +171,7 @@ you must use Jest in [ESM mode][jest esm mode]. 3. Configure Jest to use jsdom, transform Svelte files, and use your setup file ```js title="jest.config.js" - module.exports = { + export default { transform: { '^.+\\.svelte$': 'svelte-jester', }, @@ -182,6 +182,33 @@ you must use Jest in [ESM mode][jest esm mode]. } ``` + :::note + + If you are using Svelte 5, you must use `svelte-jester@5` or later, and you + will need to make additional changes to your Jest configuration. + + - Update `transform` to compile `.svelte.(js|ts)` modules + - Allow `@testing-library/svelte` to be transformed, even though it's in + `node_modules` + + ```diff title="jest.config.js" + export default { + transform: { + - '^.+\\.svelte$': 'svelte-jester', + + '^.+\\.svelte(\\.(js|ts))?$': 'svelte-jester', + }, + + transformIgnorePatterns: [ + + '/node_modules/(?!@testing-library/svelte/)', + + ], + moduleFileExtensions: ['js', 'svelte'], + extensionsToTreatAsEsm: ['.svelte'], + testEnvironment: 'jsdom', + setupFilesAfterEnv: ['/jest-setup.js'], + } + ``` + + ::: + 4. Add the following to your `package.json` ```json title="package.json" From 9b7ae3f920c8dfebc0221328e7c6914a87e12451 Mon Sep 17 00:00:00 2001 From: Tim Deschryver <28659384+timdeschryver@users.noreply.github.com> Date: Tue, 2 Jul 2024 20:03:10 +0200 Subject: [PATCH 067/123] docs: update docs for ATL v17 (#1402) --- docs/angular-testing-library/intro.mdx | 10 +++++++++- .../version-compatibility.mdx | 15 ++++++++------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/docs/angular-testing-library/intro.mdx b/docs/angular-testing-library/intro.mdx index 421ebf013..a7820b7f0 100644 --- a/docs/angular-testing-library/intro.mdx +++ b/docs/angular-testing-library/intro.mdx @@ -8,9 +8,17 @@ sidebar_label: Introduction builds on top of [`DOM Testing Library`](https://github.com/testing-library/dom-testing-library) by adding APIs for working with Angular components. +Starting from ATL version 17, you also need to install `@testing-library/dom`: ```bash npm2yarn -npm install --save-dev @testing-library/angular +npm install --save-dev @testing-library/angular @testing-library/dom +``` + +Or, you can use the `ng add` command. +This sets up your project to use Angular Testing Library, which also includes the installation of `@testing-library/dom`. + +```bash +ng add @testing-library/angular ``` - [`@testing-library/angular-testing-library` on GitHub](https://github.com/testing-library/angular-testing-library) diff --git a/docs/angular-testing-library/version-compatibility.mdx b/docs/angular-testing-library/version-compatibility.mdx index 90cac77fc..8ca501f1c 100644 --- a/docs/angular-testing-library/version-compatibility.mdx +++ b/docs/angular-testing-library/version-compatibility.mdx @@ -6,10 +6,11 @@ title: Version compatibility An overview of the compatibility between different versions of Angular Testing Library and Angular. -| Angular | Angular Testing Library | -| ------- | ----------------------- | -| 17.x | 16.x, 15.x, 14.x, 13.x | -| 16.x | 14.x, 13.x | -| >= 15.1 | 14.x, 13.x | -| < 15.1 | 12.x, 11.x | -| 14.x | 12.x, 11.x | +| Angular | Angular Testing Library | +| ------- | ---------------------------- | +| 18.x | 17.x, 16.x, 15.x, 14.x, 13.x | +| 17.x | 17.x, 16.x, 15.x, 14.x, 13.x | +| 16.x | 14.x, 13.x | +| >= 15.1 | 14.x, 13.x | +| < 15.1 | 12.x, 11.x | +| 14.x | 12.x, 11.x | From 194802bf3ef3cf16666d10a86e15bd64c64fece9 Mon Sep 17 00:00:00 2001 From: Steph Nathai Date: Wed, 14 Aug 2024 03:32:10 -0400 Subject: [PATCH 068/123] chore(a11y): improving a11y score to 100% for home and doc pages (#1406) * chore(a11y): improving a11y score to 100% for home and doc pages * chore(a11y): addressing comments --- src/css/custom.css | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/css/custom.css b/src/css/custom.css index 7c519d8fa..10e003c1f 100644 --- a/src/css/custom.css +++ b/src/css/custom.css @@ -2,8 +2,16 @@ --ifm-light-background-color: var(--ifm-color-emphasis-100); } -html[data-theme='dark'] { - --ifm-link-color: #679df5; +[data-theme='dark']:root { + --ifm-color-primary: #7FA8F1; + --ifm-link-color: #7FA8F1; + --docsearch-muted-color: white; +} + +[data-theme='light']:root { + --ifm-color-primary: #1554B7; + --ifm-link-color: #1554B7; + --docsearch-muted-color: #494B5F; } .wrapper { @@ -75,6 +83,10 @@ html[data-theme='dark'] { line-height: 1em; } +.theme-doc-markdown { + --ifm-link-decoration: underline; +} + @media only screen and (min-width: 480px) { .projectTitle { font-size: 300%; From 832b3b5675f68c646fa2756fa6247503bd57d6ae Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Wed, 14 Aug 2024 15:19:44 +0200 Subject: [PATCH 069/123] docs: add StephNathai as a contributor for a11y (#1408) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] --------- Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 3 ++- README.md | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index d84900e10..d757861f6 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2472,7 +2472,8 @@ "avatar_url": "https://avatars.githubusercontent.com/u/11414958?v=4", "profile": "https://github.com/StephNathai", "contributions": [ - "code" + "code", + "a11y" ] }, { diff --git a/README.md b/README.md index a0cfcf594..00c9f07ae 100644 --- a/README.md +++ b/README.md @@ -484,7 +484,7 @@ Thanks goes to these wonderful people Milan Jaritz
Milan Jaritz

📖 Rokas Brazdžionis
Rokas Brazdžionis

📖 Laforge Thomas
Laforge Thomas

📖 - Steph Nathai
Steph Nathai

💻 + Steph Nathai
Steph Nathai

💻 ️️️️♿️ Frieder Bluemle
Frieder Bluemle

📖 From c32011613c2456c6b9196aaaab4748491341ac2a Mon Sep 17 00:00:00 2001 From: Saud Baig <143418574+saubaig456@users.noreply.github.com> Date: Wed, 14 Aug 2024 08:21:19 -0500 Subject: [PATCH 070/123] update deferBlockBehavior documentation (#1404) --- docs/angular-testing-library/api.mdx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/angular-testing-library/api.mdx b/docs/angular-testing-library/api.mdx index dad1e3f3b..4644d8293 100644 --- a/docs/angular-testing-library/api.mdx +++ b/docs/angular-testing-library/api.mdx @@ -157,8 +157,7 @@ Set the defer blocks behavior. For more info see the [Angular docs](https://angular.io/api/core/testing/DeferBlockBehavior) -**default** : `undefined` (uses the Angular default, which is -`DeferBlockBehavior.Manual`) +**default** : `undefined` (uses `DeferBlockBehavior.Manual`, which is different from the Angular default of `DeferBlockBehavior.Playthrough`) **example**: From 6cca9ac3069db3d6d6950b3aa22654f7b8b15820 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Wed, 14 Aug 2024 15:32:54 +0200 Subject: [PATCH 071/123] docs: add saubaig456 as a contributor for doc (#1409) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] --------- Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 1 + 2 files changed, 10 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index d757861f6..b0e77da5c 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2683,6 +2683,15 @@ "contributions": [ "doc" ] + }, + { + "login": "saubaig456", + "name": "Saud Baig", + "avatar_url": "https://avatars.githubusercontent.com/u/143418574?v=4", + "profile": "https://github.com/saubaig456", + "contributions": [ + "doc" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index 00c9f07ae..7ae7d67a8 100644 --- a/README.md +++ b/README.md @@ -516,6 +516,7 @@ Thanks goes to these wonderful people denisx
denisx

💻 Giovanni Gualiato
Giovanni Gualiato

📖 + Saud Baig
Saud Baig

📖 From 2f823ef7b4c0b53a70656b6776b150d1e35e887f Mon Sep 17 00:00:00 2001 From: Ren Adachi <49895682+moeyashi@users.noreply.github.com> Date: Mon, 19 Aug 2024 18:51:59 +0900 Subject: [PATCH 072/123] docs(byrole.mdx): add tips for input type password (#1410) * docs(byrole.mdx): add tips for input type password * fix(byrole.mdx): for better explanation see #1410 --- docs/queries/byrole.mdx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/queries/byrole.mdx b/docs/queries/byrole.mdx index 7c70db2f7..edccdb484 100644 --- a/docs/queries/byrole.mdx +++ b/docs/queries/byrole.mdx @@ -73,6 +73,12 @@ not replace the functionality of these attributes. For example its description if `fancy.jpg` could not be loaded. Whether you want to assert this functionality in your test or not is up to you. +:::tip input type password + +Unfortunately, the spec defines that `` has no implicit role. This means that in order to query this type of element we must fallback to a less powerful query such as `[ByLabelText](queries/bylabeltext.mdx)`. + +::: + ## Options ### `hidden` From a0924647f79be9069c610f613ce91d7c05568b9e Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 19 Aug 2024 12:53:49 +0300 Subject: [PATCH 073/123] docs: add moeyashi as a contributor for doc (#1411) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] --------- Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 1 + 2 files changed, 10 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index b0e77da5c..f9f261465 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2692,6 +2692,15 @@ "contributions": [ "doc" ] + }, + { + "login": "moeyashi", + "name": "Ren Adachi", + "avatar_url": "https://avatars.githubusercontent.com/u/49895682?v=4", + "profile": "https://github.com/moeyashi", + "contributions": [ + "doc" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index 7ae7d67a8..0250fcf7d 100644 --- a/README.md +++ b/README.md @@ -517,6 +517,7 @@ Thanks goes to these wonderful people denisx
denisx

💻 Giovanni Gualiato
Giovanni Gualiato

📖 Saud Baig
Saud Baig

📖 + Ren Adachi
Ren Adachi

📖 From 11de92ffbb06ca9d82e8793c70ebf96094ee9f42 Mon Sep 17 00:00:00 2001 From: Ren Adachi <49895682+moeyashi@users.noreply.github.com> Date: Tue, 20 Aug 2024 14:11:26 +0900 Subject: [PATCH 074/123] fix byrole broken link (#1412) --- docs/queries/byrole.mdx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/queries/byrole.mdx b/docs/queries/byrole.mdx index edccdb484..53ecd33be 100644 --- a/docs/queries/byrole.mdx +++ b/docs/queries/byrole.mdx @@ -75,7 +75,9 @@ this functionality in your test or not is up to you. :::tip input type password -Unfortunately, the spec defines that `` has no implicit role. This means that in order to query this type of element we must fallback to a less powerful query such as `[ByLabelText](queries/bylabeltext.mdx)`. +Unfortunately, the spec defines that `` has no implicit +role. This means that in order to query this type of element we must fallback to +a less powerful query such as [`ByLabelText`](queries/bylabeltext.mdx). ::: From 9f0b530e4e95bf80fd3edfa695fd593332793682 Mon Sep 17 00:00:00 2001 From: Tim Deschryver <28659384+timdeschryver@users.noreply.github.com> Date: Sat, 24 Aug 2024 21:16:26 +0200 Subject: [PATCH 075/123] angular: update angular API (#1413) --- docs/angular-testing-library/api.mdx | 123 ++++++++++++++++++--------- 1 file changed, 83 insertions(+), 40 deletions(-) diff --git a/docs/angular-testing-library/api.mdx b/docs/angular-testing-library/api.mdx index 4644d8293..14e3d9af1 100644 --- a/docs/angular-testing-library/api.mdx +++ b/docs/angular-testing-library/api.mdx @@ -76,58 +76,40 @@ export async function render( ## Component RenderOptions -### `componentInputs` -An object to set `@Input` properties of the component. Uses `setInput` to set -the input property. Throws if the component property is not annotated with the -`@Input` attribute. +### `inputs` -**default** : `{}` +An object to set `@Input` or `input()` properties of the component. -**example**: +**default** : `{}` ```typescript await render(AppComponent, { - componentInputs: { + inputs: { counterValue: 10, + // explicitly define aliases using `aliasedInput` + ...aliasedInput('someAlias', 'someValue'), }, }) ``` -### `componentOutputs` - -An object to set `@Output` properties of the component. - -**default** : `{}` - -**example**: - -```typescript -await render(AppComponent, { - componentOutputs: { - clicked: (value) => { ... } - } -}) -``` - -### `componentProperties` +### `on` -An object to set `@Input` and `@Output` properties of the component. Doesn't -have a fine-grained control as `componentInputs` and `componentOutputs`. +An object with callbacks to subscribe to `EventEmitters` and `Observables` of +the component. **default** : `{}` -**example**: +```ts +// using a manual callback +const sendValue = (value) => { ... } +// using a (jest) spy +const sendValueSpy = jest.fn() -```typescript await render(AppComponent, { - componentProperties: { - // an input - counterValue: 10, - // an output - send: (value) => { ... } - // a public property - name: 'Tim' + on: { + send: (value) => sendValue(value), + send: sendValueSpy } }) ``` @@ -157,7 +139,8 @@ Set the defer blocks behavior. For more info see the [Angular docs](https://angular.io/api/core/testing/DeferBlockBehavior) -**default** : `undefined` (uses `DeferBlockBehavior.Manual`, which is different from the Angular default of `DeferBlockBehavior.Playthrough`) +**default** : `undefined` (uses `DeferBlockBehavior.Manual`, which is different +from the Angular default of `DeferBlockBehavior.Playthrough`) **example**: @@ -403,6 +386,64 @@ await render(AppComponent, { }) ``` + +### ~~`componentInputs`~~ (deprecated) + +An object to set `@Input` properties of the component. Uses `setInput` to set +the input property. Throws if the component property is not annotated with the +`@Input` attribute. + +**default** : `{}` + +**example**: + +```typescript +await render(AppComponent, { + componentInputs: { + counterValue: 10, + }, +}) +``` + +### ~~`componentOutputs`~~ (deprecated) + +An object to set `@Output` properties of the component. + +**default** : `{}` + +**example**: + +```typescript +await render(AppComponent, { + componentOutputs: { + clicked: (value) => { ... } + } +}) +``` + +### ~~`componentProperties`~~ (deprecated) + +An object to set `@Input` and `@Output` properties of the component. Doesn't +have a fine-grained control as `inputs` and `on`. + +**default** : `{}` + +**example**: + +```typescript +await render(AppComponent, { + componentProperties: { + // an input + counterValue: 10, + // an output + send: (value) => { ... } + // a public property + name: 'Tim' + } +}) +``` + + ## `RenderResult` ### `container` @@ -430,13 +471,15 @@ properties that are not defined are cleared. ```typescript const {rerender} = await render(Counter, { - componentInputs: {count: 4, name: 'Sarah'}, + inputs: {count: 4, name: 'Sarah'}, }) expect(screen.getByTestId('count-value').textContent).toBe('4') expect(screen.getByTestId('name-value').textContent).toBe('Sarah') -await rerender({componentInputs: {count: 7}}) +await rerender({ + inputs: {count: 7} +}) // count is updated to 7 expect(screen.getByTestId('count-value').textContent).toBe('7') @@ -449,13 +492,13 @@ input properties that aren't provided won't be cleared. ```typescript const {rerender} = await render(Counter, { - componentInputs: {count: 4, name: 'Sarah'}, + inputs: {count: 4, name: 'Sarah'}, }) expect(screen.getByTestId('count-value').textContent).toBe('4') expect(screen.getByTestId('name-value').textContent).toBe('Sarah') -await rerender({componentInputs: {count: 7}, partialUpdate: true}) +await rerender({inputs: {count: 7}, partialUpdate: true}) // count is updated to 7 expect(screen.getByTestId('count-value').textContent).toBe('7') From f334c874607771ccdf38f60199ca38e95c2523a0 Mon Sep 17 00:00:00 2001 From: Tim Deschryver <28659384+timdeschryver@users.noreply.github.com> Date: Thu, 29 Aug 2024 11:07:28 +0200 Subject: [PATCH 076/123] freshen up Angular example (#1414) --- docs/angular-testing-library/examples.mdx | 126 +++++++--------------- 1 file changed, 36 insertions(+), 90 deletions(-) diff --git a/docs/angular-testing-library/examples.mdx b/docs/angular-testing-library/examples.mdx index 5829ccf78..d12de6340 100644 --- a/docs/angular-testing-library/examples.mdx +++ b/docs/angular-testing-library/examples.mdx @@ -8,126 +8,72 @@ title: Examples > or follow the > [guided example](https://timdeschryver.dev/blog/getting-the-most-value-out-of-your-angular-component-tests) -```ts title="counter.component.ts" -@Component({ - selector: 'counter', - template: ` - - Current Count: {{ counter }} - - `, -}) -export class CounterComponent { - @Input() counter = 0 - - increment() { - this.counter += 1 - } - - decrement() { - this.counter -= 1 - } -} -``` - -```ts title="counter.component.spec.ts" -import {render, screen, fireEvent} from '@testing-library/angular' -import {CounterComponent} from './counter.component.ts' - -describe('Counter', () => { - test('should render counter', async () => { - await render(CounterComponent, { - componentProperties: {counter: 5}, - }) - - expect(screen.getByText('Current Count: 5')).toBeInTheDocument() - }) - - test('should increment the counter on click', async () => { - await render(CounterComponent, { - componentProperties: {counter: 5}, - }) - - fireEvent.click(screen.getByText('+')) - - expect(screen.getByText('Current Count: 6')).toBeInTheDocument() - }) -}) -``` - -## With Standalone Components - -Angular Testing Library can also test your standalone components. In fact, it -even becomes easier because you don't have to set up the whole Angular TestBed. -This was previously only -[possible when you used Single Component Angular Modules (SCAMs)](https://timdeschryver.dev/blog/single-component-angular-modules-and-component-tests-go-hand-in-hand). - -Let's migrate the counter component to a standalone component, and let's take a -look at how this affects the test. +Angular Testing Library can be used with standalone components and also with Angular components that uses Modules. +The example below shows how to test a standalone component, but the same principles apply to Angular components that uses Modules. +In fact, there should be no difference in how you test both types of components, only the setup might be different. ```ts title="counter.component.ts" @Component({ - selector: 'counter', + selector: 'app-counter', template: ` + {{ hello() }} - Current Count: {{ counter }} + Current Count: {{ counter() }} `, - standalone: true, }) export class CounterComponent { - @Input() counter = 0 + counter = model(0); + hello = input('Hi', { alias: 'greeting' }); increment() { - this.counter += 1 + this.counter.set(this.counter() + 1); } decrement() { - this.counter -= 1 + this.counter.set(this.counter() - 1); } } ``` -Just as you would've expected, this doesn't affect the test cases. Writing tests -for standalone components remains the same as for "regular" components. - -```ts title="counter.component.spec.ts" -import {render, screen, fireEvent} from '@testing-library/angular' -import {CounterComponent} from './counter.component.ts' +```typescript title="counter.component.spec.ts" +import { render, screen, fireEvent, aliasedInput } from '@testing-library/angular'; +import { CounterComponent } from './counter.component'; describe('Counter', () => { - test('should render counter', async () => { - await render(CounterComponent, { - componentProperties: {counter: 5}, - }) - - expect(screen.getByText('Current Count: 5')).toBeInTheDocument() - }) - - test('should increment the counter on click', async () => { + it('should render counter', async () => { await render(CounterComponent, { - componentProperties: {counter: 5}, - }) - - fireEvent.click(screen.getByText('+')) - - expect(screen.getByText('Current Count: 6')).toBeInTheDocument() - }) -}) + inputs: { + counter: 5, + // aliases need to be specified using aliasedInput + ...aliasedInput('greeting', 'Hello Alias!'), + }, + }); + + expect(screen.getByText('Current Count: 5')).toBeVisible(); + expect(screen.getByText('Hello Alias!')).toBeVisible(); + }); + + it('should increment the counter on click', async () => { + await render(CounterComponent, { inputs: { counter: 5 } }); + + const incrementButton = screen.getByRole('button', { name: '+' }); + fireEvent.click(incrementButton); + + expect(screen.getByText('Current Count: 6')).toBeVisible(); + }); +}); ``` -To override an import of a standalone component for your component test, you can -use the [`componentImports` property](api.mdx#componentImports). - ## More examples More examples can be found in the [GitHub project](https://github.com/testing-library/angular-testing-library/tree/master/apps/example-app/src/app/examples). These examples include: -- `@Input` and `@Output` properties +- `input` and `output` properties - Forms -- Integration with services +- Integration injected services - And [more](https://github.com/testing-library/angular-testing-library/tree/master/apps/example-app/src/app/examples) From bcebbc579cc8b950f1f610ab81e4cac6d2ce663f Mon Sep 17 00:00:00 2001 From: "Sebastian \"Sebbie\" Silbermann" Date: Fri, 30 Aug 2024 19:31:23 +0200 Subject: [PATCH 077/123] add docs for thrown errors from render (#1416) Closes #1060 --- docs/react-testing-library/faq.mdx | 41 ++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/docs/react-testing-library/faq.mdx b/docs/react-testing-library/faq.mdx index 1d93c926d..c2b02f934 100644 --- a/docs/react-testing-library/faq.mdx +++ b/docs/react-testing-library/faq.mdx @@ -98,6 +98,47 @@ As you write your tests, keep in mind:
+How do I test thrown errors in a Component or Hook? + +If a component throws during render, the origin of the state update will throw if wrapped in `act`. +By default, `render` and `fireEvent` are wrapped in `act`. +You can just wrap it in a try-catch or use dedicated matchers if your test runner supports these. +For example, in Jest you can use `toThrow`: + +```jsx +function Thrower() { + throw new Error('I throw') +} + +test('it throws', () => { + expect(() => render()).toThrow('I throw') +}) +``` + +The same applies to Hooks and `renderHook`: + +```jsx +function useThrower() { + throw new Error('I throw') +} + +test('it throws', () => { + expect(() => renderHook(useThrower)).toThrow('I throw') +}) +``` + +:::info + +React 18 will call `console.error` with an extended error message. +React 19 will call `console.warn` with an extended error message unless the state update is wrapped in `act`. +`render`, `renderHook` and `fireEvent` are wrapped in `act` by default. + +::: + +
+ +
+ If I can't use shallow rendering, how do I mock out components in tests? From 11ffbf365222eeb348cc14345fffd88fca6855f9 Mon Sep 17 00:00:00 2001 From: "Sebastian \"Sebbie\" Silbermann" Date: Wed, 4 Sep 2024 17:40:15 +0200 Subject: [PATCH 078/123] Docs for `onCaughtError`, `onRecoverableError` and how to test error boundaries (#1417) --- docs/react-testing-library/api.mdx | 24 ++++++++++++++ docs/react-testing-library/faq.mdx | 50 ++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) diff --git a/docs/react-testing-library/api.mdx b/docs/react-testing-library/api.mdx index a6a969ebb..06149fed6 100644 --- a/docs/react-testing-library/api.mdx +++ b/docs/react-testing-library/api.mdx @@ -12,6 +12,8 @@ as these methods: - [`baseElement`](#baseelement) - [`hydrate`](#hydrate) - [`legacyRoot`](#legacyroot) + - [`onCaughtError`](#oncaughterror) + - [`onRecoverableError`](#onrecoverableerror) - [`wrapper`](#wrapper) - [`queries`](#queries) - [`render` Result](#render-result) @@ -27,6 +29,8 @@ as these methods: - [`renderHook`](#renderhook) - [`renderHook` Options](#renderhook-options) - [`initialProps`](#initialprops) + - [`onCaughtError`](#oncaughterror) + - [`onRecoverableError`](#onrecoverableerror) - [`wrapper`](#wrapper-1) - [`renderHook` Result](#renderhook-result) - [`result`](#result) @@ -120,6 +124,16 @@ React 17 (i.e. [`ReactDOM.render`](https://react.dev/reference/react-dom/render)) then you should enable this option by setting `legacyRoot: true`. +### `onCaughtError` + +Callback called when React catches an error in an Error Boundary. +Behaves the same as [`onCaughtError` in `ReactDOMClient.createRoot`](https://react.dev/reference/react-dom/client/createRoot#parameters). + +### `onRecoverableError` + +Callback called when React automatically recovers from errors. +Behaves the same as [`onRecoverableError` in `ReactDOMClient.createRoot`](https://react.dev/reference/react-dom/client/createRoot#parameters). + ### `wrapper` Pass a React Component as the `wrapper` option to have it rendered around the @@ -403,6 +417,16 @@ test('returns logged in user', () => { > } > ``` +### `onCaughtError` + +Callback called when React catches an error in an Error Boundary. +Behaves the same as [`onCaughtError` in `ReactDOMClient.createRoot`](https://react.dev/reference/react-dom/client/createRoot#parameters). + +### `onRecoverableError` + +Callback called when React automatically recovers from errors. +Behaves the same as [`onRecoverableError` in `ReactDOMClient.createRoot`](https://react.dev/reference/react-dom/client/createRoot#parameters). + ### `renderHook` Options `wrapper` See [`wrapper` option for `render`](#wrapper) diff --git a/docs/react-testing-library/faq.mdx b/docs/react-testing-library/faq.mdx index c2b02f934..e02e8bab0 100644 --- a/docs/react-testing-library/faq.mdx +++ b/docs/react-testing-library/faq.mdx @@ -81,6 +81,56 @@ as part of the `change` method call.
+How do I test error boundaries + +To test if an error boundary successfully catches an error, you should make sure that the fallback of the boundary is displayed when a child threw. + +Here's an example of how you can test an error boundary: + +```jsx +import React from 'react' +import {render, screen} from '@testing-library/react' + +class ErrorBoundary extends React.Component { + state = {error: null} + static getDerivedStateFromError(error) { + return {error} + } + render() { + const {error} = this.state + if (error) { + return
Something went wrong
+ } + return this.props.children + } +} + +test('error boundary catches error', () => { + const {container} = render( + + + , + ) + expect(container.textContent).toEqual('Something went wrong.') +}) + +If the error boundary did not catch the error, the test would fail since the `render` call would throw the error the Component produced. + + +:::info + +React 18 will call `console.error` with an extended error message. +React 19 will call `console.warn` with an extended error message. + +To disable the additional `console.warn` call in React 19, you can provide a custom `onCaughtError` callback e.g. `render(, {onCaughtError: () => {}})` +`onCaughtError` is not supported in React 18. + +::: + +
+ +
+ Can I write unit tests with this library? Definitely yes! You can write unit and integration tests with this library. See From 0a4248164a51927b7644746f041b332dcc7572cd Mon Sep 17 00:00:00 2001 From: Ty Mick <5317080+TyMick@users.noreply.github.com> Date: Tue, 10 Sep 2024 10:50:14 -0700 Subject: [PATCH 079/123] Add missing code block terminator (#1420) --- docs/react-testing-library/faq.mdx | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/react-testing-library/faq.mdx b/docs/react-testing-library/faq.mdx index e02e8bab0..e378f48d3 100644 --- a/docs/react-testing-library/faq.mdx +++ b/docs/react-testing-library/faq.mdx @@ -113,6 +113,7 @@ test('error boundary catches error', () => { ) expect(container.textContent).toEqual('Something went wrong.') }) +``` If the error boundary did not catch the error, the test would fail since the `render` call would throw the error the Component produced. From 941c8e34e89fe3bb7eca802dc51062e0716b1f36 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Tue, 10 Sep 2024 20:51:13 +0300 Subject: [PATCH 080/123] docs: add TyMick as a contributor for doc (#1421) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] --------- Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 1 + 2 files changed, 10 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index f9f261465..05decb63b 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2701,6 +2701,15 @@ "contributions": [ "doc" ] + }, + { + "login": "TyMick", + "name": "Ty Mick", + "avatar_url": "https://avatars.githubusercontent.com/u/5317080?v=4", + "profile": "https://tymick.me/", + "contributions": [ + "doc" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index 0250fcf7d..450ca186d 100644 --- a/README.md +++ b/README.md @@ -518,6 +518,7 @@ Thanks goes to these wonderful people Giovanni Gualiato
Giovanni Gualiato

📖 Saud Baig
Saud Baig

📖 Ren Adachi
Ren Adachi

📖 + Ty Mick
Ty Mick

📖 From f302be923b4aab42cbc346a862a1b6e838970523 Mon Sep 17 00:00:00 2001 From: Tim Deschryver <28659384+timdeschryver@users.noreply.github.com> Date: Fri, 13 Sep 2024 20:42:12 +0200 Subject: [PATCH 081/123] revert: #11ffbf365222eeb348cc14345fffd88fca6855f9 (#1423) --- docs/react-testing-library/api.mdx | 24 -------------- docs/react-testing-library/faq.mdx | 51 ------------------------------ 2 files changed, 75 deletions(-) diff --git a/docs/react-testing-library/api.mdx b/docs/react-testing-library/api.mdx index 06149fed6..a6a969ebb 100644 --- a/docs/react-testing-library/api.mdx +++ b/docs/react-testing-library/api.mdx @@ -12,8 +12,6 @@ as these methods: - [`baseElement`](#baseelement) - [`hydrate`](#hydrate) - [`legacyRoot`](#legacyroot) - - [`onCaughtError`](#oncaughterror) - - [`onRecoverableError`](#onrecoverableerror) - [`wrapper`](#wrapper) - [`queries`](#queries) - [`render` Result](#render-result) @@ -29,8 +27,6 @@ as these methods: - [`renderHook`](#renderhook) - [`renderHook` Options](#renderhook-options) - [`initialProps`](#initialprops) - - [`onCaughtError`](#oncaughterror) - - [`onRecoverableError`](#onrecoverableerror) - [`wrapper`](#wrapper-1) - [`renderHook` Result](#renderhook-result) - [`result`](#result) @@ -124,16 +120,6 @@ React 17 (i.e. [`ReactDOM.render`](https://react.dev/reference/react-dom/render)) then you should enable this option by setting `legacyRoot: true`. -### `onCaughtError` - -Callback called when React catches an error in an Error Boundary. -Behaves the same as [`onCaughtError` in `ReactDOMClient.createRoot`](https://react.dev/reference/react-dom/client/createRoot#parameters). - -### `onRecoverableError` - -Callback called when React automatically recovers from errors. -Behaves the same as [`onRecoverableError` in `ReactDOMClient.createRoot`](https://react.dev/reference/react-dom/client/createRoot#parameters). - ### `wrapper` Pass a React Component as the `wrapper` option to have it rendered around the @@ -417,16 +403,6 @@ test('returns logged in user', () => { > } > ``` -### `onCaughtError` - -Callback called when React catches an error in an Error Boundary. -Behaves the same as [`onCaughtError` in `ReactDOMClient.createRoot`](https://react.dev/reference/react-dom/client/createRoot#parameters). - -### `onRecoverableError` - -Callback called when React automatically recovers from errors. -Behaves the same as [`onRecoverableError` in `ReactDOMClient.createRoot`](https://react.dev/reference/react-dom/client/createRoot#parameters). - ### `renderHook` Options `wrapper` See [`wrapper` option for `render`](#wrapper) diff --git a/docs/react-testing-library/faq.mdx b/docs/react-testing-library/faq.mdx index e378f48d3..c2b02f934 100644 --- a/docs/react-testing-library/faq.mdx +++ b/docs/react-testing-library/faq.mdx @@ -81,57 +81,6 @@ as part of the `change` method call.
-How do I test error boundaries - -To test if an error boundary successfully catches an error, you should make sure that the fallback of the boundary is displayed when a child threw. - -Here's an example of how you can test an error boundary: - -```jsx -import React from 'react' -import {render, screen} from '@testing-library/react' - -class ErrorBoundary extends React.Component { - state = {error: null} - static getDerivedStateFromError(error) { - return {error} - } - render() { - const {error} = this.state - if (error) { - return
Something went wrong
- } - return this.props.children - } -} - -test('error boundary catches error', () => { - const {container} = render( - - - , - ) - expect(container.textContent).toEqual('Something went wrong.') -}) -``` - -If the error boundary did not catch the error, the test would fail since the `render` call would throw the error the Component produced. - - -:::info - -React 18 will call `console.error` with an extended error message. -React 19 will call `console.warn` with an extended error message. - -To disable the additional `console.warn` call in React 19, you can provide a custom `onCaughtError` callback e.g. `render(, {onCaughtError: () => {}})` -`onCaughtError` is not supported in React 18. - -::: - -
- -
- Can I write unit tests with this library? Definitely yes! You can write unit and integration tests with this library. See From 03b1695b87f8effaca6e70e01de6f51e2677f0c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enmanuel=20Dur=C3=A1n?= Date: Sat, 28 Sep 2024 15:35:43 +0100 Subject: [PATCH 082/123] docs: add note for throwSuggestions issue #1306 (#1425) * docs: add note for throwSuggestions issue #1306 * docs: issue 1306, improve consistency * Update docs/dom-testing-library/api-configuration.mdx Co-authored-by: Tim Deschryver <28659384+timdeschryver@users.noreply.github.com> * Improving formatting of the note. * Adds missing add motion syntax * Update docs/dom-testing-library/api-configuration.mdx Co-authored-by: Tim Deschryver <28659384+timdeschryver@users.noreply.github.com> * Update docs/dom-testing-library/api-configuration.mdx Co-authored-by: Tim Deschryver <28659384+timdeschryver@users.noreply.github.com> * Update docs/dom-testing-library/api-configuration.mdx Co-authored-by: Tim Deschryver <28659384+timdeschryver@users.noreply.github.com> --------- Co-authored-by: Tim Deschryver <28659384+timdeschryver@users.noreply.github.com> --- .../dom-testing-library/api-configuration.mdx | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/docs/dom-testing-library/api-configuration.mdx b/docs/dom-testing-library/api-configuration.mdx index d1dd72ca4..6f49e9709 100644 --- a/docs/dom-testing-library/api-configuration.mdx +++ b/docs/dom-testing-library/api-configuration.mdx @@ -130,6 +130,34 @@ option. screen.getByTestId('foo', {suggest: false}) // will not throw a suggestion ``` +:::note + +When this option is enabled, it may provide suggestions that lack an +intuitive implementation. Typically this happens for +[roles which cannot be named](https://w3c.github.io/aria/#namefromprohibited), +most notably paragraphs. For instance, if you attempt to use +[`getByText`](queries/bytext.mdx), you may encounter the following error: + +``` +TestingLibraryElementError: A better query is available, try this: + getByRole('paragraph') +``` + +However, there is no direct way to query paragraphs using the config object parameter, such as in +`getByRole('paragraph', { name: 'Hello World' })`. + +To address this issue, you can leverage a custom function to validate the +element's structure, as shown in the example below. +More information can be found in the [GitHub issue](https://github.com/testing-library/dom-testing-library/issues/1306) + +```js +getByRole('paragraph', { + name: (_, element) => element.textContent === 'Hello world', +}) +``` + +::: + ### `testIdAttribute` The attribute used by [`getByTestId`](queries/bytestid.mdx) and related queries. From 42482293e860cd10728b811f2fa11249ee03f192 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Sat, 28 Sep 2024 17:37:34 +0300 Subject: [PATCH 083/123] docs: add enmanuelduran as a contributor for doc (#1431) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] --------- Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 1 + 2 files changed, 10 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 05decb63b..8ab75f49a 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2710,6 +2710,15 @@ "contributions": [ "doc" ] + }, + { + "login": "enmanuelduran", + "name": "Enmanuel Durán", + "avatar_url": "https://avatars.githubusercontent.com/u/8060530?v=4", + "profile": "https://enmascript.com/", + "contributions": [ + "doc" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index 450ca186d..5baf82bc2 100644 --- a/README.md +++ b/README.md @@ -519,6 +519,7 @@ Thanks goes to these wonderful people Saud Baig
Saud Baig

📖 Ren Adachi
Ren Adachi

📖 Ty Mick
Ty Mick

📖 + Enmanuel Durán
Enmanuel Durán

📖 From 9a89a080a2428f92697ebe2a327e79f694ff7e8a Mon Sep 17 00:00:00 2001 From: Galeel Bhasha Satthar Date: Thu, 10 Oct 2024 13:43:55 +0530 Subject: [PATCH 084/123] docs(jest-native): add deprecation message --- docs/ecosystem-jest-native.mdx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/ecosystem-jest-native.mdx b/docs/ecosystem-jest-native.mdx index a0974bf0e..2ce9cb347 100644 --- a/docs/ecosystem-jest-native.mdx +++ b/docs/ecosystem-jest-native.mdx @@ -30,6 +30,14 @@ expect(queryByTestId('not-empty')).not.toBeEmpty() > `getByTestId`). Otherwise the `get*` function could throw an error before your > assertion. +> [!CAUTION] +> **This package is deprecated and is no longer actively maintained.** +> +> We encourage you to migrate to React Native Testing Library, v12.4 or later, which includes modern [built-in Jest matchers](https://callstack.github.io/react-native-testing-library/docs/api/jest-matchers) based on the matchers for this repository. +> +> The migration process should be relatively straightforward, we have a [migration guide](https://callstack.github.io/react-native-testing-library/docs/migration/jest-matchers) available. + + Check out [Jest Native's documentation](https://github.com/testing-library/jest-native) for a full list of available matchers. From 1a6d2637449622bb8325bbd50d192ccdec7daae7 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Thu, 10 Oct 2024 11:21:33 +0300 Subject: [PATCH 085/123] docs: add gbhasha as a contributor for doc (#1434) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] --------- Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 1 + 2 files changed, 10 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 8ab75f49a..b41a3434b 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2719,6 +2719,15 @@ "contributions": [ "doc" ] + }, + { + "login": "gbhasha", + "name": "Galeel Bhasha Satthar", + "avatar_url": "https://avatars.githubusercontent.com/u/501794?v=4", + "profile": "https://github.com/gbhasha", + "contributions": [ + "doc" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index 5baf82bc2..ddbac6223 100644 --- a/README.md +++ b/README.md @@ -520,6 +520,7 @@ Thanks goes to these wonderful people Ren Adachi
Ren Adachi

📖 Ty Mick
Ty Mick

📖 Enmanuel Durán
Enmanuel Durán

📖 + Galeel Bhasha Satthar
Galeel Bhasha Satthar

📖 From 7f36018e3099fd67ed8835710cd94aecb2c88d8d Mon Sep 17 00:00:00 2001 From: Matan Borenkraout Date: Thu, 10 Oct 2024 11:22:29 +0300 Subject: [PATCH 086/123] fix: use warning admonition (#1435) --- docs/ecosystem-jest-native.mdx | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/docs/ecosystem-jest-native.mdx b/docs/ecosystem-jest-native.mdx index 2ce9cb347..b201e8a9f 100644 --- a/docs/ecosystem-jest-native.mdx +++ b/docs/ecosystem-jest-native.mdx @@ -4,6 +4,20 @@ title: jest-native sidebar_label: jest-native --- +:::warning + +**This package is deprecated and is no longer actively maintained.** + +We encourage you to migrate to React Native Testing Library, v12.4 or later, +which includes modern +[built-in Jest matchers](https://callstack.github.io/react-native-testing-library/docs/api/jest-matchers) +based on the matchers for this repository. The migration process should be +relatively straightforward, we have a +[migration guide](https://callstack.github.io/react-native-testing-library/docs/migration/jest-matchers) +available. + +::: + [`Jest Native`](https://github.com/testing-library/jest-native) is a companion library for `React Native Testing Library` that provides custom element matchers for Jest. @@ -30,14 +44,6 @@ expect(queryByTestId('not-empty')).not.toBeEmpty() > `getByTestId`). Otherwise the `get*` function could throw an error before your > assertion. -> [!CAUTION] -> **This package is deprecated and is no longer actively maintained.** -> -> We encourage you to migrate to React Native Testing Library, v12.4 or later, which includes modern [built-in Jest matchers](https://callstack.github.io/react-native-testing-library/docs/api/jest-matchers) based on the matchers for this repository. -> -> The migration process should be relatively straightforward, we have a [migration guide](https://callstack.github.io/react-native-testing-library/docs/migration/jest-matchers) available. - - Check out [Jest Native's documentation](https://github.com/testing-library/jest-native) for a full list of available matchers. From be5c31a7c88ae301f61dfb87bc6f740cd6e40294 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 13 Oct 2024 11:05:44 +0300 Subject: [PATCH 087/123] chore(deps): bump express from 4.19.2 to 4.21.1 (#1439) Bumps [express](https://github.com/expressjs/express) from 4.19.2 to 4.21.1. - [Release notes](https://github.com/expressjs/express/releases) - [Changelog](https://github.com/expressjs/express/blob/4.21.1/History.md) - [Commits](https://github.com/expressjs/express/compare/4.19.2...4.21.1) --- updated-dependencies: - dependency-name: express dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 588 +++++++++++++++++++++++++++------------------- 1 file changed, 343 insertions(+), 245 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2f644dde5..dd4b61fc0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6391,15 +6391,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/array-includes/node_modules/object-inspect": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.11.0.tgz", - "integrity": "sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/array-includes/node_modules/object.assign": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", @@ -7193,9 +7184,9 @@ "dev": true }, "node_modules/body-parser": { - "version": "1.20.2", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", - "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", + "version": "1.20.3", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.3.tgz", + "integrity": "sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g==", "dependencies": { "bytes": "3.1.2", "content-type": "~1.0.5", @@ -7205,7 +7196,7 @@ "http-errors": "2.0.0", "iconv-lite": "0.4.24", "on-finished": "2.4.1", - "qs": "6.11.0", + "qs": "6.13.0", "raw-body": "2.5.2", "type-is": "~1.6.18", "unpipe": "1.0.0" @@ -7669,12 +7660,18 @@ } }, "node_modules/call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", + "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", "dependencies": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -8755,9 +8752,9 @@ } }, "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" } @@ -9840,6 +9837,22 @@ "abstract-leveldown": "~0.12.1" } }, + "node_modules/define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/define-lazy-prop": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz", @@ -10458,9 +10471,9 @@ } }, "node_modules/encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", "engines": { "node": ">= 0.8" } @@ -10562,6 +10575,25 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/es-define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", + "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", + "dependencies": { + "get-intrinsic": "^1.2.4" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "engines": { + "node": ">= 0.4" + } + }, "node_modules/es-module-lexer": { "version": "0.9.3", "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.9.3.tgz", @@ -11094,15 +11126,6 @@ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "dev": true }, - "node_modules/eslint-plugin-import/node_modules/object-inspect": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.11.0.tgz", - "integrity": "sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/eslint-plugin-import/node_modules/object.assign": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", @@ -11461,15 +11484,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/eslint-plugin-react/node_modules/object-inspect": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.11.0.tgz", - "integrity": "sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/eslint-plugin-react/node_modules/object.assign": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", @@ -12110,36 +12124,36 @@ } }, "node_modules/express": { - "version": "4.19.2", - "resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz", - "integrity": "sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==", + "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.2", + "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", - "encodeurl": "~1.0.2", + "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "etag": "~1.8.1", - "finalhandler": "1.2.0", + "finalhandler": "1.3.1", "fresh": "0.5.2", "http-errors": "2.0.0", - "merge-descriptors": "1.0.1", + "merge-descriptors": "1.0.3", "methods": "~1.1.2", "on-finished": "2.4.1", "parseurl": "~1.3.3", - "path-to-regexp": "0.1.7", + "path-to-regexp": "0.1.10", "proxy-addr": "~2.0.7", - "qs": "6.11.0", + "qs": "6.13.0", "range-parser": "~1.2.1", "safe-buffer": "5.2.1", - "send": "0.18.0", - "serve-static": "1.15.0", + "send": "0.19.0", + "serve-static": "1.16.2", "setprototypeof": "1.2.0", "statuses": "2.0.1", "type-is": "~1.6.18", @@ -12566,12 +12580,12 @@ } }, "node_modules/finalhandler": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", - "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.1.tgz", + "integrity": "sha512-6BN9trH7bp3qvnrRyzsBz+g3lZxTNZTbVO2EV1CS0WIcDbawYVdYvGflME/9QP0h0pYlCDBCTjYa9nZzMDpyxQ==", "dependencies": { "debug": "2.6.9", - "encodeurl": "~1.0.2", + "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "on-finished": "2.4.1", "parseurl": "~1.3.3", @@ -13091,9 +13105,12 @@ } }, "node_modules/function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, "node_modules/functional-red-black-tree": { "version": "1.0.1", @@ -13166,13 +13183,18 @@ } }, "node_modules/get-intrinsic": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", - "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", + "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", "dependencies": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1" + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "hasown": "^2.0.0" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -13334,6 +13356,17 @@ "node": ">=8" } }, + "node_modules/gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "dependencies": { + "get-intrinsic": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/got": { "version": "9.6.0", "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", @@ -13457,10 +13490,32 @@ "node": ">=0.10.0" } }, - "node_modules/has-symbols": { + "node_modules/has-property-descriptors": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", - "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "dependencies": { + "es-define-property": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-proto": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", + "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", "engines": { "node": ">= 0.4" }, @@ -13559,6 +13614,17 @@ "minimalistic-assert": "^1.0.1" } }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/hast-to-hyperscript": { "version": "9.0.1", "resolved": "https://registry.npmjs.org/hast-to-hyperscript/-/hast-to-hyperscript-9.0.1.tgz", @@ -19605,9 +19671,12 @@ } }, "node_modules/merge-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==" + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz", + "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==", + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, "node_modules/merge-stream": { "version": "2.0.0", @@ -20188,9 +20257,12 @@ } }, "node_modules/object-inspect": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.8.0.tgz", - "integrity": "sha512-jLdtEOB112fORuypAyl/50VRVIBIdVQOSUUGQHzJ4xBSbit81zRarz7GThkEFZy1RceYrWYcPcBFPQwHyAc1gA==", + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.2.tgz", + "integrity": "sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g==", + "engines": { + "node": ">= 0.4" + }, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -20316,15 +20388,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/object.entries/node_modules/object-inspect": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.11.0.tgz", - "integrity": "sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/object.entries/node_modules/object.assign": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", @@ -20457,15 +20520,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/object.fromentries/node_modules/object-inspect": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.11.0.tgz", - "integrity": "sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/object.fromentries/node_modules/object.assign": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", @@ -20978,9 +21032,9 @@ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" }, "node_modules/path-to-regexp": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" + "version": "0.1.10", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.10.tgz", + "integrity": "sha512-7lf7qcQidTku0Gu3YDPc8DJ1q7OOucfa/BSsIwjuh56VU7katFvuM8hULfkwB3Fns/rsVF7PwPKVw1sl5KQS9w==" }, "node_modules/path-type": { "version": "4.0.0", @@ -22012,11 +22066,11 @@ "integrity": "sha512-QFADYnsVoBMw1srW7OVKEYjG+MbIa49s54w1MA1EDY6r2r/sTcKKYqRX1f4GYvnXP7eN/Pe9HFcX+hwzmrXRHA==" }, "node_modules/qs": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", - "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz", + "integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==", "dependencies": { - "side-channel": "^1.0.4" + "side-channel": "^1.0.6" }, "engines": { "node": ">=0.6" @@ -23662,9 +23716,9 @@ } }, "node_modules/send": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", - "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz", + "integrity": "sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw==", "dependencies": { "debug": "2.6.9", "depd": "2.0.0", @@ -23697,6 +23751,14 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" }, + "node_modules/send/node_modules/encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/send/node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", @@ -23836,19 +23898,35 @@ } }, "node_modules/serve-static": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", - "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", + "version": "1.16.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz", + "integrity": "sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==", "dependencies": { - "encodeurl": "~1.0.2", + "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "parseurl": "~1.3.3", - "send": "0.18.0" + "send": "0.19.0" }, "engines": { "node": ">= 0.8.0" } }, + "node_modules/set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/set-value": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz", @@ -23958,22 +24036,18 @@ } }, "node_modules/side-channel": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", - "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", + "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", "dependencies": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.4", + "object-inspect": "^1.13.1" + }, + "engines": { + "node": ">= 0.4" }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/side-channel/node_modules/object-inspect": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.11.0.tgz", - "integrity": "sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg==", "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -24643,15 +24717,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/string.prototype.matchall/node_modules/object-inspect": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.11.0.tgz", - "integrity": "sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/string.prototype.matchall/node_modules/object.assign": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", @@ -31863,12 +31928,6 @@ "has-symbols": "^1.0.2" } }, - "object-inspect": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.11.0.tgz", - "integrity": "sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg==", - "dev": true - }, "object.assign": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", @@ -32493,9 +32552,9 @@ "dev": true }, "body-parser": { - "version": "1.20.2", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", - "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", + "version": "1.20.3", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.3.tgz", + "integrity": "sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g==", "requires": { "bytes": "3.1.2", "content-type": "~1.0.5", @@ -32505,7 +32564,7 @@ "http-errors": "2.0.0", "iconv-lite": "0.4.24", "on-finished": "2.4.1", - "qs": "6.11.0", + "qs": "6.13.0", "raw-body": "2.5.2", "type-is": "~1.6.18", "unpipe": "1.0.0" @@ -32867,12 +32926,15 @@ } }, "call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", + "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", "requires": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.1" } }, "call-me-maybe": { @@ -33682,9 +33744,9 @@ } }, "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==" }, "cookie-signature": { "version": "1.0.6", @@ -34479,6 +34541,16 @@ "abstract-leveldown": "~0.12.1" } }, + "define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "requires": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + } + }, "define-lazy-prop": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz", @@ -34975,9 +35047,9 @@ "integrity": "sha512-SNujglcLTTg+lDAcApPNgEdudaqQFiAbJCqzjNxJkvN9vAwCGi0uu8IUVvx+f16h+V44KCY6Y2yboroc9pilHg==" }, "encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==" + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==" }, "end-of-stream": { "version": "1.4.4", @@ -35054,6 +35126,19 @@ "string.prototype.trimstart": "^1.0.1" } }, + "es-define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", + "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", + "requires": { + "get-intrinsic": "^1.2.4" + } + }, + "es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==" + }, "es-module-lexer": { "version": "0.9.3", "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.9.3.tgz", @@ -35536,12 +35621,6 @@ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "dev": true }, - "object-inspect": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.11.0.tgz", - "integrity": "sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg==", - "dev": true - }, "object.assign": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", @@ -35788,12 +35867,6 @@ "has-symbols": "^1.0.2" } }, - "object-inspect": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.11.0.tgz", - "integrity": "sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg==", - "dev": true - }, "object.assign": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", @@ -36181,36 +36254,36 @@ } }, "express": { - "version": "4.19.2", - "resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz", - "integrity": "sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==", + "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.2", + "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", - "encodeurl": "~1.0.2", + "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "etag": "~1.8.1", - "finalhandler": "1.2.0", + "finalhandler": "1.3.1", "fresh": "0.5.2", "http-errors": "2.0.0", - "merge-descriptors": "1.0.1", + "merge-descriptors": "1.0.3", "methods": "~1.1.2", "on-finished": "2.4.1", "parseurl": "~1.3.3", - "path-to-regexp": "0.1.7", + "path-to-regexp": "0.1.10", "proxy-addr": "~2.0.7", - "qs": "6.11.0", + "qs": "6.13.0", "range-parser": "~1.2.1", "safe-buffer": "5.2.1", - "send": "0.18.0", - "serve-static": "1.15.0", + "send": "0.19.0", + "serve-static": "1.16.2", "setprototypeof": "1.2.0", "statuses": "2.0.1", "type-is": "~1.6.18", @@ -36548,12 +36621,12 @@ } }, "finalhandler": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", - "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.1.tgz", + "integrity": "sha512-6BN9trH7bp3qvnrRyzsBz+g3lZxTNZTbVO2EV1CS0WIcDbawYVdYvGflME/9QP0h0pYlCDBCTjYa9nZzMDpyxQ==", "requires": { "debug": "2.6.9", - "encodeurl": "~1.0.2", + "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "on-finished": "2.4.1", "parseurl": "~1.3.3", @@ -36912,9 +36985,9 @@ "optional": true }, "function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==" }, "functional-red-black-tree": { "version": "1.0.1", @@ -36980,13 +37053,15 @@ "dev": true }, "get-intrinsic": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", - "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", + "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", "requires": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1" + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "hasown": "^2.0.0" } }, "get-own-enumerable-property-symbols": { @@ -37104,6 +37179,14 @@ } } }, + "gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "requires": { + "get-intrinsic": "^1.1.3" + } + }, "got": { "version": "9.6.0", "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", @@ -37199,10 +37282,23 @@ } } }, - "has-symbols": { + "has-property-descriptors": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", - "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==" + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "requires": { + "es-define-property": "^1.0.0" + } + }, + "has-proto": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", + "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==" + }, + "has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==" }, "has-value": { "version": "1.0.0", @@ -37270,6 +37366,14 @@ "minimalistic-assert": "^1.0.1" } }, + "hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "requires": { + "function-bind": "^1.1.2" + } + }, "hast-to-hyperscript": { "version": "9.0.1", "resolved": "https://registry.npmjs.org/hast-to-hyperscript/-/hast-to-hyperscript-9.0.1.tgz", @@ -41970,9 +42074,9 @@ } }, "merge-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==" + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz", + "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==" }, "merge-stream": { "version": "2.0.0", @@ -42412,9 +42516,9 @@ } }, "object-inspect": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.8.0.tgz", - "integrity": "sha512-jLdtEOB112fORuypAyl/50VRVIBIdVQOSUUGQHzJ4xBSbit81zRarz7GThkEFZy1RceYrWYcPcBFPQwHyAc1gA==" + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.2.tgz", + "integrity": "sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g==" }, "object-keys": { "version": "1.1.1", @@ -42498,12 +42602,6 @@ "has-symbols": "^1.0.2" } }, - "object-inspect": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.11.0.tgz", - "integrity": "sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg==", - "dev": true - }, "object.assign": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", @@ -42596,12 +42694,6 @@ "has-symbols": "^1.0.2" } }, - "object-inspect": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.11.0.tgz", - "integrity": "sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg==", - "dev": true - }, "object.assign": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", @@ -43000,9 +43092,9 @@ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" }, "path-to-regexp": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" + "version": "0.1.10", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.10.tgz", + "integrity": "sha512-7lf7qcQidTku0Gu3YDPc8DJ1q7OOucfa/BSsIwjuh56VU7katFvuM8hULfkwB3Fns/rsVF7PwPKVw1sl5KQS9w==" }, "path-type": { "version": "4.0.0", @@ -43698,11 +43790,11 @@ "integrity": "sha512-QFADYnsVoBMw1srW7OVKEYjG+MbIa49s54w1MA1EDY6r2r/sTcKKYqRX1f4GYvnXP7eN/Pe9HFcX+hwzmrXRHA==" }, "qs": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", - "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz", + "integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==", "requires": { - "side-channel": "^1.0.4" + "side-channel": "^1.0.6" } }, "querystringify": { @@ -44935,9 +45027,9 @@ "dev": true }, "send": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", - "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz", + "integrity": "sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw==", "requires": { "debug": "2.6.9", "depd": "2.0.0", @@ -44969,6 +45061,11 @@ } } }, + "encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==" + }, "ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", @@ -45090,14 +45187,27 @@ } }, "serve-static": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", - "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", + "version": "1.16.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz", + "integrity": "sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==", "requires": { - "encodeurl": "~1.0.2", + "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "parseurl": "~1.3.3", - "send": "0.18.0" + "send": "0.19.0" + } + }, + "set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "requires": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" } }, "set-value": { @@ -45187,20 +45297,14 @@ } }, "side-channel": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", - "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", + "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", "requires": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" - }, - "dependencies": { - "object-inspect": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.11.0.tgz", - "integrity": "sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg==" - } + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.4", + "object-inspect": "^1.13.1" } }, "signal-exit": { @@ -45731,12 +45835,6 @@ "has-symbols": "^1.0.2" } }, - "object-inspect": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.11.0.tgz", - "integrity": "sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg==", - "dev": true - }, "object.assign": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", From 6cb176d8c1c57073b630bd02069d5543e8278cde Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 13 Oct 2024 11:06:02 +0300 Subject: [PATCH 088/123] chore(deps-dev): bump rollup from 2.53.2 to 2.79.2 (#1438) Bumps [rollup](https://github.com/rollup/rollup) from 2.53.2 to 2.79.2. - [Release notes](https://github.com/rollup/rollup/releases) - [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md) - [Commits](https://github.com/rollup/rollup/compare/v2.53.2...v2.79.2) --- updated-dependencies: - dependency-name: rollup dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index dd4b61fc0..773117656 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23333,9 +23333,9 @@ } }, "node_modules/rollup": { - "version": "2.53.2", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.53.2.tgz", - "integrity": "sha512-1CtEYuS5CRCzFZ7SNW5528SlDlk4VDXIRGwbm/2POQxA/G4+7/crIqJwkmnj8Q/74hGx4oVlNvh4E1CJQ5hZ6w==", + "version": "2.79.2", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.2.tgz", + "integrity": "sha512-fS6iqSPZDs3dr/y7Od6y5nha8dW1YnbgtsyotCVvoFGKbERG++CVRFv1meyGDE1SNItQA8BrnCw7ScdAhRJ3XQ==", "dev": true, "bin": { "rollup": "dist/bin/rollup" @@ -44734,9 +44734,9 @@ } }, "rollup": { - "version": "2.53.2", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.53.2.tgz", - "integrity": "sha512-1CtEYuS5CRCzFZ7SNW5528SlDlk4VDXIRGwbm/2POQxA/G4+7/crIqJwkmnj8Q/74hGx4oVlNvh4E1CJQ5hZ6w==", + "version": "2.79.2", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.2.tgz", + "integrity": "sha512-fS6iqSPZDs3dr/y7Od6y5nha8dW1YnbgtsyotCVvoFGKbERG++CVRFv1meyGDE1SNItQA8BrnCw7ScdAhRJ3XQ==", "dev": true, "requires": { "fsevents": "~2.3.2" From c87bdbf1c813a51eee05d85b05dfe9718eec8a48 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 13 Oct 2024 11:06:18 +0300 Subject: [PATCH 089/123] chore(deps): bump cookie and express (#1437) Bumps [cookie](https://github.com/jshttp/cookie) and [express](https://github.com/expressjs/express). These dependencies needed to be updated together. Updates `cookie` from 0.6.0 to 0.7.1 - [Release notes](https://github.com/jshttp/cookie/releases) - [Commits](https://github.com/jshttp/cookie/compare/v0.6.0...v0.7.1) Updates `express` from 4.19.2 to 4.21.1 - [Release notes](https://github.com/expressjs/express/releases) - [Changelog](https://github.com/expressjs/express/blob/4.21.1/History.md) - [Commits](https://github.com/expressjs/express/compare/4.19.2...4.21.1) --- updated-dependencies: - dependency-name: cookie dependency-type: indirect - dependency-name: express dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> From 4e7b5a55291561c4bbd23d04d273928b048636a9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 13 Oct 2024 11:06:29 +0300 Subject: [PATCH 090/123] chore(deps-dev): bump elliptic from 6.5.4 to 6.5.7 (#1436) Bumps [elliptic](https://github.com/indutny/elliptic) from 6.5.4 to 6.5.7. - [Commits](https://github.com/indutny/elliptic/compare/v6.5.4...v6.5.7) --- updated-dependencies: - dependency-name: elliptic dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 773117656..f779ee30e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10416,9 +10416,9 @@ } }, "node_modules/elliptic": { - "version": "6.5.4", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", - "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", + "version": "6.5.7", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.7.tgz", + "integrity": "sha512-ESVCtTwiA+XhY3wyh24QqRGBoP3rEdDUl3EDUUo9tft074fi19IrdpH7hLCMMP3CIj7jb3W96rn8lt/BqIlt5Q==", "dev": true, "dependencies": { "bn.js": "^4.11.9", @@ -35003,9 +35003,9 @@ "dev": true }, "elliptic": { - "version": "6.5.4", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", - "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", + "version": "6.5.7", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.7.tgz", + "integrity": "sha512-ESVCtTwiA+XhY3wyh24QqRGBoP3rEdDUl3EDUUo9tft074fi19IrdpH7hLCMMP3CIj7jb3W96rn8lt/BqIlt5Q==", "dev": true, "requires": { "bn.js": "^4.11.9", From 043dc677a8dcdc939945bc6887990d553eda363c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 26 Oct 2024 10:08:19 +0300 Subject: [PATCH 091/123] chore(deps): bump http-proxy-middleware from 2.0.6 to 2.0.7 (#1441) Bumps [http-proxy-middleware](https://github.com/chimurai/http-proxy-middleware) from 2.0.6 to 2.0.7. - [Release notes](https://github.com/chimurai/http-proxy-middleware/releases) - [Changelog](https://github.com/chimurai/http-proxy-middleware/blob/v2.0.7/CHANGELOG.md) - [Commits](https://github.com/chimurai/http-proxy-middleware/compare/v2.0.6...v2.0.7) --- updated-dependencies: - dependency-name: http-proxy-middleware dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index f779ee30e..ea401b624 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13970,9 +13970,9 @@ } }, "node_modules/http-proxy-middleware": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-2.0.6.tgz", - "integrity": "sha512-ya/UeJ6HVBYxrgYotAZo1KvPWlgB48kUJLDePFeneHsVujFaW5WNj2NgWCAE//B1Dl02BIfYlpNgBy8Kf8Rjmw==", + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-2.0.7.tgz", + "integrity": "sha512-fgVY8AV7qU7z/MmXJ/rxwbrtQH4jBQ9m7kp3llF0liB7glmFeVZFBepQb32T3y8n8k2+AEYuMPCpinYW+/CuRA==", "dependencies": { "@types/http-proxy": "^1.17.8", "http-proxy": "^1.18.1", @@ -37648,9 +37648,9 @@ } }, "http-proxy-middleware": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-2.0.6.tgz", - "integrity": "sha512-ya/UeJ6HVBYxrgYotAZo1KvPWlgB48kUJLDePFeneHsVujFaW5WNj2NgWCAE//B1Dl02BIfYlpNgBy8Kf8Rjmw==", + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-2.0.7.tgz", + "integrity": "sha512-fgVY8AV7qU7z/MmXJ/rxwbrtQH4jBQ9m7kp3llF0liB7glmFeVZFBepQb32T3y8n8k2+AEYuMPCpinYW+/CuRA==", "requires": { "@types/http-proxy": "^1.17.8", "http-proxy": "^1.18.1", From fb67c656da7e6aace022900fe8615f380baff41d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ian=20L=C3=A9tourneau?= Date: Wed, 30 Oct 2024 13:28:37 -0400 Subject: [PATCH 092/123] feat(qwik-testing-library): add documentation for Qwik Testing Library (#1432) --- docs/qwik-testing-library/api.mdx | 203 ++++++++++++++++++++++++++ docs/qwik-testing-library/example.mdx | 103 +++++++++++++ docs/qwik-testing-library/faq.mdx | 34 +++++ docs/qwik-testing-library/intro.mdx | 41 ++++++ docs/qwik-testing-library/setup.mdx | 165 +++++++++++++++++++++ sidebars.js | 9 ++ 6 files changed, 555 insertions(+) create mode 100644 docs/qwik-testing-library/api.mdx create mode 100644 docs/qwik-testing-library/example.mdx create mode 100644 docs/qwik-testing-library/faq.mdx create mode 100644 docs/qwik-testing-library/intro.mdx create mode 100644 docs/qwik-testing-library/setup.mdx diff --git a/docs/qwik-testing-library/api.mdx b/docs/qwik-testing-library/api.mdx new file mode 100644 index 000000000..09edcce59 --- /dev/null +++ b/docs/qwik-testing-library/api.mdx @@ -0,0 +1,203 @@ +--- +id: api +title: API +sidebar_label: API +--- + +`@noma.to/qwik-testing-library` re-exports everything from +[`@testing-library/dom`][@testing-library/dom], as well as: + +- [`render`](#render) +- [`cleanup`](#cleanup) + +[@testing-library/dom]: ../dom-testing-library/api.mdx + +## `render` + +Render your component to the DOM with Qwik. By default, when no options are +provided, the component will be rendered into a `` appended to +`document.body`. + +```tsx +import {render} from '@noma.to/qwik-testing-library' +import {MockProvider} from './MockProvider' +import {MyComponent} from './MyComponent' + +const result = await render(, { + baseElement: document.body, + container: document.createElement('host'), + wrapper: MockProvider, +}) +``` + +### Render Options + +You may also customize how Qwik Testing Library renders your component. Most of +the time, you shouldn't need to modify these options. + +| Option | Description | Default | +| ------------- | --------------------------------------------------- | -------------------------------- | +| `container` | The container in which the component is rendered. | `document.createElement('host')` | +| `baseElement` | The base element for queries and [`debug`](#debug). | `document.body` | +| `queries` | [Custom Queries][custom-queries]. | N/A | +| `wrapper` | The wrapper to provide a context to the component. | N/A | + +[custom-queries]: ../dom-testing-library/api-custom-queries.mdx + +#### `wrapper` + +You can wrap your component into a wrapper to provide a context and other +functionalities needed by the component under test. + +```tsx +import {render} from '@noma.to/qwik-testing-library' +import {QwikCityMockProvider} from '@builder.io/qwik-city' + +await render(, {wrapper: QwikCityMockProvider}) +``` + +### Render Results + +| Result | Description | +| ----------------------------- | ---------------------------------------------------------- | +| [`baseElement`](#baseelement) | The base DOM element used for queries. | +| [`container`](#container) | The DOM element the component is mounted to. | +| [`asFragment`](#asFragment) | Convert the DOM element to a `DocumentFragment`. | +| [`debug`](#debug) | Log elements using [`prettyDOM`][pretty-dom]. | +| [`unmount`](#unmount) | Unmount and destroy the component. | +| [`...queries`](#queries) | [Query functions][query-functions] bound to `baseElement`. | + +[pretty-dom]: ../dom-testing-library/api-debugging.mdx#prettydom +[query-functions]: ../queries/about.mdx + +#### `baseElement` + +The base DOM element that queries are bound to. Corresponds to +`renderOptions.baseElement`. If you do not use `renderOptions.baseElement`, this +will be `document.body`. + +#### `container` + +The DOM element the component is mounted in. Corresponds to +`renderOptions.container`. If you do not use `renderOptions.container`, this +will be `document.createElement('host')`. In general, avoid using `container` +directly to query for elements; use [testing-library queries][query-functions] +instead. + +#### `asFragment` + +Returns a `DocumentFragment` of your rendered component. This can be useful if +you need to avoid live bindings and see how your component reacts to events. + +```tsx +import {component$} from '@builder.io/qwik'; +import {render} from '@testing-library/react'; +import {userEvent} from "@testing-library/user-event"; + +const TestComponent = component$(() => { + const count = useSignal(0); + + return ( + + ) +}); + +const {getByText, asFragment} = await render() +const firstRender = asFragment() + +userEvent.click(getByText(/Click to increase/)) + +// This will snapshot only the difference between the first render, and the +// state of the DOM after the click event. +// See https://github.com/jest-community/snapshot-diff +expect(firstRender).toMatchDiffSnapshot(asFragment()) +``` + +#### `debug` + +Log the `baseElement` or a given element using [`prettyDOM`][pretty-dom]. + +:::tip + +If your `baseElement` is the default `document.body`, we recommend using +[`screen.debug`][screen-debug]. + +::: + +```tsx +import {render, screen} from '@noma.to/qwik-testing-library' + +const {debug} = await render() + +const button = screen.getByRole('button') + +// log `document.body` +screen.debug() + +// log your custom the `baseElement` +debug() + +// log a specific element +screen.debug(button) +debug(button) +``` + +[screen-debug]: ../dom-testing-library/api-debugging.mdx#screendebug + +#### `unmount` + +Unmount and destroy the Qwik component. + +```tsx +const {unmount} = await render() + +unmount() +``` + +#### Queries + +[Query functions][query-functions] bound to the [`baseElement`](#baseelement). +If you passed [custom queries][custom-queries] to `render`, those will be +available instead of the default queries. + +:::tip + +If your [`baseElement`](#baseelement) is the default `document.body`, we +recommend using [`screen`][screen] rather than bound queries. + +::: + +```tsx +import {render, screen} from '@noma.to/qwik-testing-library' + +const {getByRole} = await render() + +// query `document.body` +const button = screen.getByRole('button') + +// query using a custom `target` or `baseElement` +const button = getByRole('button') +``` + +[screen]: ../queries/about.mdx#screen + +## `cleanup` + +Destroy all components and remove any elements added to `document.body` or +`renderOptions.baseElement`. + +```tsx +import {render, cleanup} from '@noma.to/qwik-testing-library' + +// Default: runs after each test +afterEach(() => { + cleanup() +}) + +await render() + +// Called manually for more control +cleanup() +``` diff --git a/docs/qwik-testing-library/example.mdx b/docs/qwik-testing-library/example.mdx new file mode 100644 index 000000000..55e1b5f11 --- /dev/null +++ b/docs/qwik-testing-library/example.mdx @@ -0,0 +1,103 @@ +--- +id: example +title: Example +sidebar_label: Example +--- + +Below are some examples of how to use the Qwik Testing Library to test your +Qwik components. + +You can also learn more about the [**queries**][tl-queries-docs] and [**user +events**][tl-user-events-docs] to help you write your tests. + +[tl-queries-docs]: ../queries/about.mdx +[tl-user-events-docs]: ../user-event/intro.mdx + +## Qwikstart + +This is a minimal setup to get you started, with line-by-line explanations. + +```tsx title="counter.spec.tsx" +// import qwik-testing methods +import {screen, render, waitFor} from '@noma.to/qwik-testing-library' +// import the userEvent methods to interact with the DOM +import {userEvent} from '@testing-library/user-event' +// import the component to be tested +import {Counter} from './counter' + +// describe the test suite +describe('', () => { + // describe the test case + it('should increment the counter', async () => { + // setup user event + const user = userEvent.setup() + // render the component into the DOM + await render() + + // retrieve the 'increment count' button + const incrementBtn = screen.getByRole('button', {name: /increment count/}) + // click the button twice + await user.click(incrementBtn) + await user.click(incrementBtn) + + // assert that the counter is now 2 + expect(await screen.findByText(/count:2/)).toBeInTheDocument() + }) +}) +``` + +## Qwik City - `server$` calls + +If one of your Qwik components uses `server$` calls, your tests might fail with +a rather cryptic message (e.g. +`QWIK ERROR __vite_ssr_import_0__.myServerFunctionQrl is not a function` or +`QWIK ERROR Failed to parse URL from ?qfunc=DNpotUma33o`). + +We're happy to discuss it on [Discord][discord], but we consider this failure to +be a good thing: your components should be tested in isolation, so you will be +forced to mock your server functions. + +[discord]: https://qwik.dev/chat + +Here is an example of how to test a component that uses `server$` calls: + +```ts title="~/server/blog-post.ts" +import {server$} from '@builder.io/qwik-city' +import {BlogPost} from '~/lib/blog-post' + +export const getLatestPosts$ = server$(function (): Promise { + // get the latest posts + return Promise.resolve([]) +}) +``` + +```tsx title="~/components/latest-post-list.tsx" +import {render, screen, waitFor} from '@noma.to/qwik-testing-library' +import {LatestPostList} from './latest-post-list' + +vi.mock('~/server/blog-posts', () => ({ + // the mocked function should end with `Qrl` instead of `$` + getLatestPostsQrl: () => { + return Promise.resolve([ + {id: 'post-1', title: 'Post 1'}, + {id: 'post-2', title: 'Post 2'}, + ]) + }, +})) + +describe('', () => { + it('should render the latest posts', async () => { + await render() + + expect(await screen.findAllByRole('listitem')).toHaveLength(2) + }) +}) +``` + +Notice how the mocked function is ending with `Qrl` instead of `$`, despite +being named as `getLatestPosts$`. This is caused by the Qwik optimizer renaming +it to `Qrl`. So, we need to mock the `Qrl` function instead of the original `$` +one. + +If your function doesn't end with `$`, the Qwik optimizer will not rename it to +`Qrl`. diff --git a/docs/qwik-testing-library/faq.mdx b/docs/qwik-testing-library/faq.mdx new file mode 100644 index 000000000..5f380e025 --- /dev/null +++ b/docs/qwik-testing-library/faq.mdx @@ -0,0 +1,34 @@ +--- +id: faq +title: FAQ +sidebar_label: FAQ +--- + +- [How do I test file upload?](#how-do-i-test-file-upload) + +--- + +## How do I test file upload? + +Use the [upload][] utility from `@testing-library/user-event`. It works well in +both [jsdom][] and [happy-dom][]. + +```tsx +test('upload file', async () => { + const user = userEvent.setup() + + await render() + const file = new File(['hello'], 'hello.png', {type: 'image/png'}) + const input = screen.getByLabelText(/upload file/i) + + await user.upload(input, file) + + expect(input.files[0]).toBe(file) + expect(input.files.item(0)).toBe(file) + expect(input.files).toHaveLength(1) +}) +``` + +[upload]: ../user-event/api-utility.mdx#upload +[jsdom]: https://github.com/jsdom/jsdom +[happy-dom]: https://github.com/capricorn86/happy-dom diff --git a/docs/qwik-testing-library/intro.mdx b/docs/qwik-testing-library/intro.mdx new file mode 100644 index 000000000..f370c744e --- /dev/null +++ b/docs/qwik-testing-library/intro.mdx @@ -0,0 +1,41 @@ +--- +id: intro +title: Intro +sidebar_label: Introduction +--- + +[Qwik Testing Library on GitHub][gh] + +[gh]: https://github.com/ianlet/qwik-testing-library + +```bash npm2yarn +npm run qwik add testing-library +``` + +> This library is built on top of [`dom-testing-library`][dom-testing-library] +> which is where most of the logic behind the queries is. + +[dom-testing-library]: ../dom-testing-library/intro.mdx + +## The Problem + +You want to write maintainable tests for your [Qwik][qwik] components. + +[qwik]: https://qwik.dev/ + +## This Solution + +The Qwik Testing Library is a lightweight library for testing Qwik components. +It provides functions on top of `qwik` and `@testing-library/dom` so you can +mount Qwik components and query their rendered output in the DOM. Its primary +guiding principle is: + +> [The more your tests resemble the way your software is used, the more +> confidence they can give you.][guiding-principle] + +[guiding-principle]: https://twitter.com/kentcdodds/status/977018512689455106 + +**What this library is not**: + +1. A test runner or framework. +2. Specific to a testing framework. diff --git a/docs/qwik-testing-library/setup.mdx b/docs/qwik-testing-library/setup.mdx new file mode 100644 index 000000000..cc1a536a8 --- /dev/null +++ b/docs/qwik-testing-library/setup.mdx @@ -0,0 +1,165 @@ +--- +id: setup +title: Setup +sidebar_label: Setup +--- + +The easiest way to get started with Qwik Testing Library is to use the Qwik CLI +that comes with your Qwik project to automatically set it up for you: + +```bash npm2yarn +npm run qwik add testing-library +``` + +If you prefer to set it up manually or want to understand what the setup script +does, read along... + +## Manual Setup + +This module is distributed via [npm][npm] which is bundled with [node][node] and +should be installed as one of your project's `devDependencies`: + +```bash npm2yarn +npm install --save-dev @noma.to/qwik-testing-library @testing-library/dom +``` + +This library supports `qwik` versions `1.7.2` and above and +`@testing-library/dom` versions `10.1.0` and above. + +You may also be interested in installing `@testing-library/jest-dom` and +`@testing-library/user-event` so you can use [the custom jest +matchers][jest-dom] and [the user event library][user-event] to test +interactions with the DOM. + +```bash npm2yarn +npm install --save-dev @testing-library/jest-dom @testing-library/user-event +``` + +Finally, we need a DOM environment to run the tests in. This library was tested +(for now) only with `jsdom` so we recommend using it: + +```bash npm2yarn +npm install --save-dev jsdom +``` + +[npm]: https://www.npmjs.com/ +[node]: https://nodejs.org +[jest-dom]: https://github.com/testing-library/jest-dom +[user-event]: https://github.com/testing-library/user-event + +## Vitest Configuration + +We recommend using `@noma.to/qwik-testing-library` with [Vitest][vitest] as your +test runner. + +If you haven't done so already, add vitest to your project using Qwik CLI: + +```bash npm2yarn +npm run qwik add vitest +``` + +After that, we need to configure Vitest so it can run your tests. For this, +create a _separate_ `vitest.config.ts` so you don't have to modify your +project's `vite.config.ts`: + +```ts title="vitest.config.ts" +import {defineConfig, mergeConfig} from 'vitest/config' +import viteConfig from './vite.config' + +export default defineConfig(configEnv => + mergeConfig( + viteConfig(configEnv), + defineConfig({ + // qwik-testing-library needs to consider your project as a Qwik lib + // if it's already a Qwik lib, you can remove this section + build: { + target: 'es2020', + lib: { + entry: './src/index.ts', + formats: ['es', 'cjs'], + fileName: (format, entryName) => + `${entryName}.qwik.${format === 'es' ? 'mjs' : 'cjs'}`, + }, + }, + // configure your test environment + test: { + environment: 'jsdom', + setupFiles: ['./vitest.setup.ts'], + globals: true, + }, + }), + ), +) +``` + +For now, `qwik-testing-library` needs to consider your project as a lib. Hence, +the `build.lib` section in the config above. + +As the build will try to use `./src/index.ts` as the entry point, we need to +create it: + +```ts title="src/index.ts" +/** + * DO NOT DELETE THIS FILE + * + * This entrypoint is needed by @noma.to/qwik-testing-library to run your tests + */ +``` + +Then, create the `vitest.setup.ts` file: + +```ts title="vitest.setup.ts" +// Configure DOM matchers to work in Vitest +import '@testing-library/jest-dom/vitest' + +// This has to run before qdev.ts loads. `beforeAll` is too late +globalThis.qTest = false // Forces Qwik to run as if it was in a Browser +globalThis.qRuntimeQrl = true +globalThis.qDev = true +globalThis.qInspector = false +``` + +This setup will make sure that Qwik is properly configured. It also loads +`@testing-library/jest-dom/vitest` in your test runner so you can use matchers +like `expect(...).toBeInTheDocument()`. + +By default, Qwik Testing Library cleans everything up automatically for you. You +can opt out of this by setting the environment variable `QTL_SKIP_AUTO_CLEANUP` +to `true`. Then in your tests, you can call the `cleanup` function when needed. +For example: + +```ts +import {cleanup} from '@noma.to/qwik-testing-library' +import {afterEach} from 'vitest' + +afterEach(cleanup) +``` + +Now, edit your `tsconfig.json` to declare the following global types: + +```diff title="tsconfig.json" +{ + "compilerOptions": { + "types": [ ++ "vitest/globals", ++ "@testing-library/jest-dom/vitest" + ] + }, + "include": ["src"] +} +``` + +[vitest]: https://vitest.dev/ + +Finally, you can add test scripts to your `package.json` to run the tests with +Vitest + +```json title="package.json" +{ + "scripts": { + "test": "vitest run", + "test:ui": "vitest --ui", + "test:watch": "vitest" + } +} +``` diff --git a/sidebars.js b/sidebars.js index b5aa8b8cc..fc824899a 100755 --- a/sidebars.js +++ b/sidebars.js @@ -171,6 +171,15 @@ module.exports = { 'solid-testing-library/api', ], }, + { + 'Qwik Testing Library': [ + 'qwik-testing-library/intro', + 'qwik-testing-library/setup', + 'qwik-testing-library/example', + 'qwik-testing-library/api', + 'qwik-testing-library/faq', + ], + }, 'cypress-testing-library/intro', 'pptr-testing-library/intro', 'testcafe-testing-library/intro', From a084b4add92c2960de25a5de1328fc3af2296489 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Wed, 30 Oct 2024 19:15:09 +0100 Subject: [PATCH 093/123] docs: add ianlet as a contributor for doc (#1443) --- .all-contributorsrc | 9 +++++++++ README.md | 3 +++ 2 files changed, 12 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index b41a3434b..f613463ea 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2728,6 +2728,15 @@ "contributions": [ "doc" ] + }, + { + "login": "ianlet", + "name": "Ian Létourneau", + "avatar_url": "https://avatars.githubusercontent.com/u/6018732?v=4", + "profile": "https://noma.to/", + "contributions": [ + "doc" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index ddbac6223..18d59b5e9 100644 --- a/README.md +++ b/README.md @@ -522,6 +522,9 @@ Thanks goes to these wonderful people Enmanuel Durán
Enmanuel Durán

📖 Galeel Bhasha Satthar
Galeel Bhasha Satthar

📖 + + Ian Létourneau
Ian Létourneau

📖 + From ccd5df6445df983b4cd19bc0942865f7c3d1ee54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ian=20L=C3=A9tourneau?= Date: Fri, 1 Nov 2024 17:29:38 -0400 Subject: [PATCH 094/123] docs(qwik): adjust setup instructions (#1445) --- docs/qwik-testing-library/setup.mdx | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/docs/qwik-testing-library/setup.mdx b/docs/qwik-testing-library/setup.mdx index cc1a536a8..c05ff934f 100644 --- a/docs/qwik-testing-library/setup.mdx +++ b/docs/qwik-testing-library/setup.mdx @@ -4,18 +4,6 @@ title: Setup sidebar_label: Setup --- -The easiest way to get started with Qwik Testing Library is to use the Qwik CLI -that comes with your Qwik project to automatically set it up for you: - -```bash npm2yarn -npm run qwik add testing-library -``` - -If you prefer to set it up manually or want to understand what the setup script -does, read along... - -## Manual Setup - This module is distributed via [npm][npm] which is bundled with [node][node] and should be installed as one of your project's `devDependencies`: From 2e99602d193df93c9dff21cb3f1bfe0d3e9d42e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ian=20L=C3=A9tourneau?= Date: Fri, 8 Nov 2024 12:26:04 -0500 Subject: [PATCH 095/123] docs(qwik): remove qwik cli command from the intro (#1448) --- docs/qwik-testing-library/intro.mdx | 9 --------- 1 file changed, 9 deletions(-) diff --git a/docs/qwik-testing-library/intro.mdx b/docs/qwik-testing-library/intro.mdx index f370c744e..2af36492b 100644 --- a/docs/qwik-testing-library/intro.mdx +++ b/docs/qwik-testing-library/intro.mdx @@ -8,15 +8,6 @@ sidebar_label: Introduction [gh]: https://github.com/ianlet/qwik-testing-library -```bash npm2yarn -npm run qwik add testing-library -``` - -> This library is built on top of [`dom-testing-library`][dom-testing-library] -> which is where most of the logic behind the queries is. - -[dom-testing-library]: ../dom-testing-library/intro.mdx - ## The Problem You want to write maintainable tests for your [Qwik][qwik] components. From 01041786e5e0dbe7d93a97854559c490d65000e8 Mon Sep 17 00:00:00 2001 From: David Johnston Date: Sun, 10 Nov 2024 22:38:48 +1100 Subject: [PATCH 096/123] docs: Upate React example usage with MSW to mention that fetch will require polyfill (#1418) * Update example-intro.mdx Updates the example notes re: MSW to mention that jsdom doesn't include fetch and will require a polyfill * Fix link * Update example-intro.mdx * Update example-intro.mdx * Update example-intro.mdx --- docs/react-testing-library/example-intro.mdx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/react-testing-library/example-intro.mdx b/docs/react-testing-library/example-intro.mdx index a5d67830f..66722d223 100644 --- a/docs/react-testing-library/example-intro.mdx +++ b/docs/react-testing-library/example-intro.mdx @@ -74,6 +74,12 @@ declaratively mock API communication in your tests instead of stubbing ::: +:::note + +Our example here uses axios to make its API calls. If your application uses [`fetch()`](https://developer.mozilla.org/en-US/docs/Web/API/Window/fetch) to make its API calls, then be aware that by default JSDOM does not include fetch. If you are using vitest as your test runner, it will be included for you. For jest you may wish to manually polyfill `fetch()` or use the [jest-fixed-jsdom](https://github.com/mswjs/jest-fixed-jsdom) environment which includes fetch. + +::: + ```jsx title="__tests__/fetch.test.jsx" import React from 'react' import {http, HttpResponse} from 'msw' From 6dc5985f2f8015b2193a5c6b4768bb134961435f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 19 Nov 2024 14:54:41 +0200 Subject: [PATCH 097/123] chore(deps): bump cross-spawn (#1450) Bumps and [cross-spawn](https://github.com/moxystudio/node-cross-spawn). These dependencies needed to be updated together. Updates `cross-spawn` from 7.0.3 to 7.0.6 - [Changelog](https://github.com/moxystudio/node-cross-spawn/blob/master/CHANGELOG.md) - [Commits](https://github.com/moxystudio/node-cross-spawn/compare/v7.0.3...v7.0.6) Updates `cross-spawn` from 6.0.5 to 7.0.6 - [Changelog](https://github.com/moxystudio/node-cross-spawn/blob/master/CHANGELOG.md) - [Commits](https://github.com/moxystudio/node-cross-spawn/compare/v7.0.3...v7.0.6) --- updated-dependencies: - dependency-name: cross-spawn dependency-type: indirect - dependency-name: cross-spawn dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/package-lock.json b/package-lock.json index ea401b624..fda7967d6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9228,9 +9228,9 @@ } }, "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", @@ -14103,9 +14103,9 @@ } }, "node_modules/husky/node_modules/cross-spawn": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", - "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "version": "6.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.6.tgz", + "integrity": "sha512-VqCUuhcd1iB+dsv8gxPttb5iZh/D0iubSP21g36KXdEuf6I5JiioesUVjpCdHV9MZRUfVFlvwtIUyPfxo5trtw==", "dev": true, "dependencies": { "nice-try": "^1.0.4", @@ -18767,9 +18767,9 @@ "dev": true }, "node_modules/lint-staged/node_modules/cross-spawn": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", - "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "version": "6.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.6.tgz", + "integrity": "sha512-VqCUuhcd1iB+dsv8gxPttb5iZh/D0iubSP21g36KXdEuf6I5JiioesUVjpCdHV9MZRUfVFlvwtIUyPfxo5trtw==", "dev": true, "dependencies": { "nice-try": "^1.0.4", @@ -34103,9 +34103,9 @@ } }, "cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "requires": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", @@ -37738,9 +37738,9 @@ }, "dependencies": { "cross-spawn": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", - "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "version": "6.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.6.tgz", + "integrity": "sha512-VqCUuhcd1iB+dsv8gxPttb5iZh/D0iubSP21g36KXdEuf6I5JiioesUVjpCdHV9MZRUfVFlvwtIUyPfxo5trtw==", "dev": true, "requires": { "nice-try": "^1.0.4", @@ -41368,9 +41368,9 @@ "dev": true }, "cross-spawn": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", - "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "version": "6.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.6.tgz", + "integrity": "sha512-VqCUuhcd1iB+dsv8gxPttb5iZh/D0iubSP21g36KXdEuf6I5JiioesUVjpCdHV9MZRUfVFlvwtIUyPfxo5trtw==", "dev": true, "requires": { "nice-try": "^1.0.4", From 6015c0516e3fc4444cd327132011b90168c8016e Mon Sep 17 00:00:00 2001 From: brianlu2610 <68666483+brianlu2610@users.noreply.github.com> Date: Sat, 23 Nov 2024 11:00:25 -0500 Subject: [PATCH 098/123] fix(a11y): underline links in a text block as pur WCAG 2.0 (#1449) * fix(a11y): underline links surrounded by text * chore(name): updating class name to be clearer --------- Co-authored-by: Brian Lu --- src/css/custom.css | 14 +++++++++----- src/pages/help.js | 6 ++++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/css/custom.css b/src/css/custom.css index 10e003c1f..d53c680a6 100644 --- a/src/css/custom.css +++ b/src/css/custom.css @@ -3,15 +3,15 @@ } [data-theme='dark']:root { - --ifm-color-primary: #7FA8F1; - --ifm-link-color: #7FA8F1; + --ifm-color-primary: #7fa8f1; + --ifm-link-color: #7fa8f1; --docsearch-muted-color: white; } [data-theme='light']:root { - --ifm-color-primary: #1554B7; - --ifm-link-color: #1554B7; - --docsearch-muted-color: #494B5F; + --ifm-color-primary: #1554b7; + --ifm-link-color: #1554b7; + --docsearch-muted-color: #494b5f; } .wrapper { @@ -483,6 +483,10 @@ details.alert div { padding-top: 0; } +.textBlockWithLinks a { + text-decoration: underline; +} + @media only screen and (min-width: 1024px) { .projectTitle { margin-top: 80px; diff --git a/src/pages/help.js b/src/pages/help.js index a5e318d1e..2cbdb30fe 100755 --- a/src/pages/help.js +++ b/src/pages/help.js @@ -64,18 +64,20 @@ export default function Help(props) {

Need help?

Buy a course

-

+

Learn how to test JavaScript with{' '} Kent C. Dodds @@ -105,7 +107,7 @@ export default function Help(props) { community successful and improve tests for everyone in the long run.

-

+

Please consider helping us answer community questions and update documentation content via the help links above. You can also help support{' '} From baf953de2986cb14b8715b36454e9d908b95f9ee Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Sat, 23 Nov 2024 18:01:20 +0200 Subject: [PATCH 099/123] docs: add brianlu2610 as a contributor for code (#1451) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] --------- Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 1 + 2 files changed, 10 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index f613463ea..b2e9653ea 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2737,6 +2737,15 @@ "contributions": [ "doc" ] + }, + { + "login": "brianlu2610", + "name": "brianlu2610", + "avatar_url": "https://avatars.githubusercontent.com/u/68666483?v=4", + "profile": "https://github.com/brianlu2610", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index 18d59b5e9..02b96ad00 100644 --- a/README.md +++ b/README.md @@ -524,6 +524,7 @@ Thanks goes to these wonderful people Ian Létourneau
Ian Létourneau

📖 + brianlu2610
brianlu2610

💻 From dfd14dc5dec71ad15449158c812293622ee1563b Mon Sep 17 00:00:00 2001 From: Matan Borenkraout Date: Tue, 10 Dec 2024 14:29:35 +0200 Subject: [PATCH 100/123] fix: queries link in webdriverio (#1454) --- docs/webdriverio-testing-library/intro.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/webdriverio-testing-library/intro.mdx b/docs/webdriverio-testing-library/intro.mdx index db760600b..3e5cde7fa 100644 --- a/docs/webdriverio-testing-library/intro.mdx +++ b/docs/webdriverio-testing-library/intro.mdx @@ -24,7 +24,7 @@ npm install --save-dev @testing-library/webdriverio ### `setupBrowser` Accepts a WebdriverIO [browser object](https://webdriver.io/docs/browserobject) -and returns dom-testing-library [queries](/docs/queries/about) modifed to return +and returns dom-testing-library [queries](/docs/queries/about.mdx) modifed to return WebdriverIO elements like normal [selectors](https://webdriver.io/docs/selectors/). **All queries are async** and are bound to `document.body` by default. From c1e7d228a2a611f43ebd27aaffad85f1987da98e Mon Sep 17 00:00:00 2001 From: Erin Date: Wed, 11 Dec 2024 17:27:00 +1000 Subject: [PATCH 101/123] Add Vitest cleanup hint to react-testing-library setup docs (#1422) * Add Vitest cleanup hint to react-testing-library setup docs * Document Vitest auto-cleanup for React without enabling globals --- docs/react-testing-library/setup.mdx | 38 ++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/docs/react-testing-library/setup.mdx b/docs/react-testing-library/setup.mdx index 38ddc56ca..7fbfa1555 100644 --- a/docs/react-testing-library/setup.mdx +++ b/docs/react-testing-library/setup.mdx @@ -510,3 +510,41 @@ And register it using mocha's `-r` flag: ``` mocha --require ./mocha-watch-cleanup-after-each.js ``` + +### Auto Cleanup in Vitest + +If you're using Vitest and want automatic cleanup to work, you can +[enable globals](https://vitest.dev/config/#globals) through its configuration +file: + +```ts title="vitest.config.ts" +import {defineConfig} from 'vitest/config' + +export default defineConfig({ + test: { + globals: true, + }, +}) +``` + +If you don't want to enable globals, you can import `cleanup` and call it +manually in a top-level `afterEach` hook: + +```ts title="vitest.config.ts" +import {defineConfig} from 'vitest/config' + +export default defineConfig({ + test: { + setupFiles: ['vitest-cleanup-after-each.ts'], + }, +}) +``` + +```ts title="vitest-cleanup-after-each.ts" +import {cleanup} from '@testing-library/react' +import {afterEach} from 'vitest' + +afterEach(() => { + cleanup() +}) +``` From 4dd7305fd727644940d85e39bb058694ac21d906 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Wed, 11 Dec 2024 09:28:43 +0200 Subject: [PATCH 102/123] docs: add ezzatron as a contributor for doc (#1456) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] --------- Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 1 + 2 files changed, 10 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index b2e9653ea..7f0223633 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2746,6 +2746,15 @@ "contributions": [ "code" ] + }, + { + "login": "ezzatron", + "name": "Erin", + "avatar_url": "https://avatars.githubusercontent.com/u/100152?v=4", + "profile": "https://github.com/ezzatron", + "contributions": [ + "doc" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index 02b96ad00..06830fe65 100644 --- a/README.md +++ b/README.md @@ -525,6 +525,7 @@ Thanks goes to these wonderful people Ian Létourneau
Ian Létourneau

📖 brianlu2610
brianlu2610

💻 + Erin
Erin

📖 From f6996809e8c0b45234ee757a2a4689c7aaadca18 Mon Sep 17 00:00:00 2001 From: Nan Chen Date: Sat, 14 Dec 2024 07:12:23 -0500 Subject: [PATCH 103/123] docs: remove example external link referring use of archived repo (#1457) --- docs/example-external.mdx | 5 ----- 1 file changed, 5 deletions(-) diff --git a/docs/example-external.mdx b/docs/example-external.mdx index db47105d1..430e6b38f 100644 --- a/docs/example-external.mdx +++ b/docs/example-external.mdx @@ -4,11 +4,6 @@ title: External Examples sidebar_label: External Examples --- -## Code Samples - -- You can find more React Testing Library examples at - [https://react-testing-examples.netlify.app/](https://react-testing-examples.netlify.app/). - ## Playground - An interactive sandbox with visual feedback on different queries From ee4ba91933b322db1418e9022ab2a2f75cc0cdc1 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Sat, 14 Dec 2024 14:15:12 +0200 Subject: [PATCH 104/123] docs: add nchen000 as a contributor for doc (#1458) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] --------- Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 1 + 2 files changed, 10 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 7f0223633..3d523c355 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2755,6 +2755,15 @@ "contributions": [ "doc" ] + }, + { + "login": "nchen000", + "name": "Nan Chen", + "avatar_url": "https://avatars.githubusercontent.com/u/23487984?v=4", + "profile": "https://www.linkedin.com/in/nan-chen-000/", + "contributions": [ + "doc" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index 06830fe65..127894f44 100644 --- a/README.md +++ b/README.md @@ -526,6 +526,7 @@ Thanks goes to these wonderful people Ian Létourneau
Ian Létourneau

📖 brianlu2610
brianlu2610

💻 Erin
Erin

📖 + Nan Chen
Nan Chen

📖 From fc4fe337a4bbc3307f72210d3aae5edf7a8bb81a Mon Sep 17 00:00:00 2001 From: Alexander Burdiss Date: Fri, 20 Dec 2024 13:33:26 -0500 Subject: [PATCH 105/123] docs: update Vue Testing Library Sidebar Order (#1459) --- sidebars.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sidebars.js b/sidebars.js index fc824899a..5fe651bf1 100755 --- a/sidebars.js +++ b/sidebars.js @@ -115,8 +115,8 @@ module.exports = { 'vue-testing-library/examples', 'vue-testing-library/setup', 'vue-testing-library/api', - 'vue-testing-library/cheatsheet', 'vue-testing-library/faq', + 'vue-testing-library/cheatsheet', ], }, { From 39c3faa8cd010d04fe89fe7c6108769389e6e97e Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Fri, 20 Dec 2024 19:43:45 +0100 Subject: [PATCH 106/123] docs: add aburdiss as a contributor for doc (#1460) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] --------- Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 1 + 2 files changed, 10 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 3d523c355..ab5a34656 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2764,6 +2764,15 @@ "contributions": [ "doc" ] + }, + { + "login": "aburdiss", + "name": "Alexander Burdiss", + "avatar_url": "https://avatars.githubusercontent.com/u/31200600?v=4", + "profile": "http://alexanderburdiss.com/", + "contributions": [ + "doc" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index 127894f44..879cc36bb 100644 --- a/README.md +++ b/README.md @@ -527,6 +527,7 @@ Thanks goes to these wonderful people brianlu2610
brianlu2610

💻 Erin
Erin

📖 Nan Chen
Nan Chen

📖 + Alexander Burdiss
Alexander Burdiss

📖 From f8a0f346ba54d05733f7440ae64cac4e5501cdfa Mon Sep 17 00:00:00 2001 From: Tim Deschryver <28659384+timdeschryver@users.noreply.github.com> Date: Sat, 21 Dec 2024 14:43:23 +0100 Subject: [PATCH 107/123] use consistant naming in sidebar and titles (#1461) --- docs/angular-testing-library/examples.mdx | 2 +- docs/bs-react-testing-library/examples.mdx | 2 +- docs/vue-testing-library/examples.mdx | 2 +- sidebars.js | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/angular-testing-library/examples.mdx b/docs/angular-testing-library/examples.mdx index d12de6340..2e44b893c 100644 --- a/docs/angular-testing-library/examples.mdx +++ b/docs/angular-testing-library/examples.mdx @@ -1,6 +1,6 @@ --- id: examples -title: Examples +title: Example --- > Read about diff --git a/docs/bs-react-testing-library/examples.mdx b/docs/bs-react-testing-library/examples.mdx index 0fe68d08a..08e96a7c9 100644 --- a/docs/bs-react-testing-library/examples.mdx +++ b/docs/bs-react-testing-library/examples.mdx @@ -1,6 +1,6 @@ --- id: examples -title: Examples +title: Example --- You can find more bs-dom-testing-library examples at diff --git a/docs/vue-testing-library/examples.mdx b/docs/vue-testing-library/examples.mdx index 677238545..8fc574328 100644 --- a/docs/vue-testing-library/examples.mdx +++ b/docs/vue-testing-library/examples.mdx @@ -1,6 +1,6 @@ --- id: examples -title: Examples +title: Example --- ## Basic example diff --git a/sidebars.js b/sidebars.js index 5fe651bf1..dcae3a205 100755 --- a/sidebars.js +++ b/sidebars.js @@ -131,8 +131,8 @@ module.exports = { { 'Svelte Testing Library': [ 'svelte-testing-library/intro', - 'svelte-testing-library/setup', 'svelte-testing-library/example', + 'svelte-testing-library/setup', 'svelte-testing-library/api', 'svelte-testing-library/faq', ], @@ -174,8 +174,8 @@ module.exports = { { 'Qwik Testing Library': [ 'qwik-testing-library/intro', - 'qwik-testing-library/setup', 'qwik-testing-library/example', + 'qwik-testing-library/setup', 'qwik-testing-library/api', 'qwik-testing-library/faq', ], From 4371086356dfa18c8a9899eba906fd2fe703f4ff Mon Sep 17 00:00:00 2001 From: Tim Deschryver <28659384+timdeschryver@users.noreply.github.com> Date: Sat, 21 Dec 2024 21:24:42 +0100 Subject: [PATCH 108/123] docs: add Angular 19 to Version compatibility table (#1462) --- docs/angular-testing-library/version-compatibility.mdx | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/angular-testing-library/version-compatibility.mdx b/docs/angular-testing-library/version-compatibility.mdx index 8ca501f1c..64e35a4f0 100644 --- a/docs/angular-testing-library/version-compatibility.mdx +++ b/docs/angular-testing-library/version-compatibility.mdx @@ -8,6 +8,7 @@ Library and Angular. | Angular | Angular Testing Library | | ------- | ---------------------------- | +| 19.x | 17.x, 16.x, 15.x, 14.x, 13.x | | 18.x | 17.x, 16.x, 15.x, 14.x, 13.x | | 17.x | 17.x, 16.x, 15.x, 14.x, 13.x | | 16.x | 14.x, 13.x | From 55ca1b1f60d9653d92efc7d07ddfaee3daa83788 Mon Sep 17 00:00:00 2001 From: Peter Hentges Date: Wed, 8 Jan 2025 13:22:39 -0600 Subject: [PATCH 109/123] user-event: add shift-tab example (#1464) --- docs/user-event/api-convenience.mdx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/user-event/api-convenience.mdx b/docs/user-event/api-convenience.mdx index aa2876ce1..caf24ffee 100644 --- a/docs/user-event/api-convenience.mdx +++ b/docs/user-event/api-convenience.mdx @@ -191,8 +191,9 @@ test('tab', async () => { // cycle goes back to the body element expect(document.body).toHaveFocus() - await user.tab() + // simulate Shift-Tab + await user.tab({shift: true}) - expect(checkbox).toHaveFocus() + expect(number).toHaveFocus() }) ``` From 11290c102df2875efef6edccf692ff12e27ba24f Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Wed, 8 Jan 2025 20:41:51 +0100 Subject: [PATCH 110/123] docs: add peterh-capella as a contributor for doc (#1465) --- .all-contributorsrc | 9 +++++++++ README.md | 1 + 2 files changed, 10 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index ab5a34656..a1d74c1c5 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2773,6 +2773,15 @@ "contributions": [ "doc" ] + }, + { + "login": "peterh-capella", + "name": "Peter Hentges", + "avatar_url": "https://avatars.githubusercontent.com/u/1122723?v=4", + "profile": "https://github.com/peterh-capella", + "contributions": [ + "doc" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index 879cc36bb..f9eb114c2 100644 --- a/README.md +++ b/README.md @@ -528,6 +528,7 @@ Thanks goes to these wonderful people Erin
Erin

📖 Nan Chen
Nan Chen

📖 Alexander Burdiss
Alexander Burdiss

📖 + Peter Hentges
Peter Hentges

📖 From a605e9392d74d0cda59af17aae64f775c0ba6769 Mon Sep 17 00:00:00 2001 From: "Sebastian \"Sebbie\" Silbermann" Date: Thu, 16 Jan 2025 00:16:41 +0100 Subject: [PATCH 111/123] Docs for `onCaughtError`, `onRecoverableError` and how to test error boundaries (#1424) --- docs/react-testing-library/api.mdx | 24 ++++++++++++++ docs/react-testing-library/faq.mdx | 50 ++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) diff --git a/docs/react-testing-library/api.mdx b/docs/react-testing-library/api.mdx index a6a969ebb..06149fed6 100644 --- a/docs/react-testing-library/api.mdx +++ b/docs/react-testing-library/api.mdx @@ -12,6 +12,8 @@ as these methods: - [`baseElement`](#baseelement) - [`hydrate`](#hydrate) - [`legacyRoot`](#legacyroot) + - [`onCaughtError`](#oncaughterror) + - [`onRecoverableError`](#onrecoverableerror) - [`wrapper`](#wrapper) - [`queries`](#queries) - [`render` Result](#render-result) @@ -27,6 +29,8 @@ as these methods: - [`renderHook`](#renderhook) - [`renderHook` Options](#renderhook-options) - [`initialProps`](#initialprops) + - [`onCaughtError`](#oncaughterror) + - [`onRecoverableError`](#onrecoverableerror) - [`wrapper`](#wrapper-1) - [`renderHook` Result](#renderhook-result) - [`result`](#result) @@ -120,6 +124,16 @@ React 17 (i.e. [`ReactDOM.render`](https://react.dev/reference/react-dom/render)) then you should enable this option by setting `legacyRoot: true`. +### `onCaughtError` + +Callback called when React catches an error in an Error Boundary. +Behaves the same as [`onCaughtError` in `ReactDOMClient.createRoot`](https://react.dev/reference/react-dom/client/createRoot#parameters). + +### `onRecoverableError` + +Callback called when React automatically recovers from errors. +Behaves the same as [`onRecoverableError` in `ReactDOMClient.createRoot`](https://react.dev/reference/react-dom/client/createRoot#parameters). + ### `wrapper` Pass a React Component as the `wrapper` option to have it rendered around the @@ -403,6 +417,16 @@ test('returns logged in user', () => { > } > ``` +### `onCaughtError` + +Callback called when React catches an error in an Error Boundary. +Behaves the same as [`onCaughtError` in `ReactDOMClient.createRoot`](https://react.dev/reference/react-dom/client/createRoot#parameters). + +### `onRecoverableError` + +Callback called when React automatically recovers from errors. +Behaves the same as [`onRecoverableError` in `ReactDOMClient.createRoot`](https://react.dev/reference/react-dom/client/createRoot#parameters). + ### `renderHook` Options `wrapper` See [`wrapper` option for `render`](#wrapper) diff --git a/docs/react-testing-library/faq.mdx b/docs/react-testing-library/faq.mdx index c2b02f934..4ea9ad541 100644 --- a/docs/react-testing-library/faq.mdx +++ b/docs/react-testing-library/faq.mdx @@ -81,6 +81,56 @@ as part of the `change` method call.

+How do I test error boundaries + +To test if an error boundary successfully catches an error, you should make sure that if the fallback of the boundary is displayed when a child threw. + +Here's an example of how you can test an error boundary: + +```jsx +import React from 'react' +import {render, screen} from '@testing-library/react' + +class ErrorBoundary extends React.Component { + state = {error: null} + static getDerivedStateFromError(error) { + return {error} + } + render() { + const {error} = this.state + if (error) { + return
Something went wrong
+ } + return this.props.children + } +} + +test('error boundary catches error', () => { + const {container} = render( + + + , + ) + expect(container.textContent).toEqual('Something went wrong.') +}) + +If the error boundary did not catch the error, the test would fail since the `render` call would throw the error the Component produced. + + +:::info + +React 18 will call `console.error` with an extended error message. +React 19 will call `console.warn` with an extended error message. + +To disable the additional `console.warn` call in React 19, you can provide a custom `onCaughtError` callback e.g. `render(, {onCaughtError: () => {}})` +`onCaughtError` is not supported in React 18. + +::: + +
+ +
+ Can I write unit tests with this library? Definitely yes! You can write unit and integration tests with this library. See From d49f5a13b1199e9ecaa59d47944fa045159c4281 Mon Sep 17 00:00:00 2001 From: David Johnston Date: Thu, 20 Feb 2025 19:06:13 +1100 Subject: [PATCH 112/123] Update faq.mdx - fix code block and formatting (#1473) --- docs/react-testing-library/faq.mdx | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/react-testing-library/faq.mdx b/docs/react-testing-library/faq.mdx index 4ea9ad541..b939e8e61 100644 --- a/docs/react-testing-library/faq.mdx +++ b/docs/react-testing-library/faq.mdx @@ -113,6 +113,7 @@ test('error boundary catches error', () => { ) expect(container.textContent).toEqual('Something went wrong.') }) +``` If the error boundary did not catch the error, the test would fail since the `render` call would throw the error the Component produced. From 1ea4229f10fd910e306e87e8eec0350ad3186b1d Mon Sep 17 00:00:00 2001 From: neknalb Date: Mon, 3 Mar 2025 22:20:49 +0100 Subject: [PATCH 113/123] docs(svelte): add missing documentation about using `@testing-library/jest-dom` with TypeScript (#1472) --- docs/svelte-testing-library/setup.mdx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/svelte-testing-library/setup.mdx b/docs/svelte-testing-library/setup.mdx index 2e0d8de9e..849335f21 100644 --- a/docs/svelte-testing-library/setup.mdx +++ b/docs/svelte-testing-library/setup.mdx @@ -138,6 +138,18 @@ runner that's ESM compatible. [resolve-conditions]: https://vitejs.dev/config/shared-options.html#resolve-conditions +### TypeScript + +Include [`@testing-library/jest-dom`][@testing-library/jest-dom] to the TypeScript `types` to make the TypeScript compiler aware about the [`@testing-library/jest-dom`][@testing-library/jest-dom] matchers. + +```json title="tsconfig.json" +{ + "compilerOptions": { + "types": ["@testing-library/jest-dom"], + } +} +``` + ## Jest [`@testing-library/svelte`][@testing-library/svelte] is ESM-only, which means From bc8a4510a7666ec10d2faddc6ec87e35b97be44b Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Tue, 4 Mar 2025 20:03:11 +0100 Subject: [PATCH 114/123] docs: add neknalb as a contributor for doc (#1474) --- .all-contributorsrc | 9 +++++++++ README.md | 1 + 2 files changed, 10 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index a1d74c1c5..550dac1ee 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2782,6 +2782,15 @@ "contributions": [ "doc" ] + }, + { + "login": "neknalb", + "name": "neknalb", + "avatar_url": "https://avatars.githubusercontent.com/u/23031302?v=4", + "profile": "https://github.com/neknalb", + "contributions": [ + "doc" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index f9eb114c2..e3fbeef59 100644 --- a/README.md +++ b/README.md @@ -529,6 +529,7 @@ Thanks goes to these wonderful people Nan Chen
Nan Chen

📖 Alexander Burdiss
Alexander Burdiss

📖 Peter Hentges
Peter Hentges

📖 + neknalb
neknalb

📖 From df795434c2e73f2aab5540fb26da384d8d84e4e7 Mon Sep 17 00:00:00 2001 From: fetsorn Date: Sun, 23 Mar 2025 18:32:24 +0300 Subject: [PATCH 115/123] docs: fix typo in api.mdx (#1477) --- docs/solid-testing-library/api.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/solid-testing-library/api.mdx b/docs/solid-testing-library/api.mdx index f1eb1703c..659dad040 100644 --- a/docs/solid-testing-library/api.mdx +++ b/docs/solid-testing-library/api.mdx @@ -15,7 +15,7 @@ There are several key differences, to be aware of. - [`renderHook`](#renderHook) - [`renderDirective`](#renderDirective) - [`Async methods`](#async-methods) -- [`Know issues`](#known-issues) +- [`Known issues`](#known-issues) ## `render` From f4eb6a52e814cbe636ee5c0ebc92b72a5ca61121 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Sun, 23 Mar 2025 17:08:56 +0100 Subject: [PATCH 116/123] docs: add fetsorn as a contributor for doc (#1478) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] --------- Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 3 +++ 2 files changed, 12 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 550dac1ee..9bc2e912d 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2791,6 +2791,15 @@ "contributions": [ "doc" ] + }, + { + "login": "fetsorn", + "name": "fetsorn", + "avatar_url": "https://avatars.githubusercontent.com/u/12858105?v=4", + "profile": "https://github.com/fetsorn", + "contributions": [ + "doc" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index e3fbeef59..a723c897d 100644 --- a/README.md +++ b/README.md @@ -531,6 +531,9 @@ Thanks goes to these wonderful people Peter Hentges
Peter Hentges

📖 neknalb
neknalb

📖 + + fetsorn
fetsorn

📖 + From d26e8cada5890fe06e61f4394811b186f38d6715 Mon Sep 17 00:00:00 2001 From: Bernardo Belchior Date: Wed, 2 Apr 2025 18:13:59 +0100 Subject: [PATCH 117/123] Update docs with `reactStrictMode` in `render` (#1479) --- docs/react-testing-library/api.mdx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/docs/react-testing-library/api.mdx b/docs/react-testing-library/api.mdx index 06149fed6..449c76f52 100644 --- a/docs/react-testing-library/api.mdx +++ b/docs/react-testing-library/api.mdx @@ -16,6 +16,7 @@ as these methods: - [`onRecoverableError`](#onrecoverableerror) - [`wrapper`](#wrapper) - [`queries`](#queries) + - [`reactStrictMode`](#render-options-reactstrictmode) - [`render` Result](#render-result) - [`...queries`](#queries-1) - [`container`](#container-1) @@ -31,7 +32,8 @@ as these methods: - [`initialProps`](#initialprops) - [`onCaughtError`](#oncaughterror) - [`onRecoverableError`](#onrecoverableerror) - - [`wrapper`](#wrapper-1) + - [`wrapper`](#renderhook-options-wrapper) + - [`reactStrictMode`](#renderhook-options-reactstrictmode) - [`renderHook` Result](#renderhook-result) - [`result`](#result) - [`rerender`](#rerender-1) @@ -161,6 +163,11 @@ utility functions to create custom queries. Custom queries can also be added globally by following the [custom render guide](setup.mdx#custom-render). +### `render` Options `reactStrictMode` + +When enabled, [``](https://react.dev/reference/react/StrictMode) is rendered around the inner element. +If defined, overrides the value of `reactStrictMode` set in [`configure`](https://testing-library.com/docs/react-testing-library/api/#configure-options). + ## `render` Result The `render` method returns an object that has a few properties: @@ -431,6 +438,11 @@ Behaves the same as [`onRecoverableError` in `ReactDOMClient.createRoot`](https: See [`wrapper` option for `render`](#wrapper) + +### `renderHook` Options `reactStrictMode` + +See [`reactStrictMode` option for `render`](#render-options-reactstrictmode) + ## `renderHook` Result The `renderHook` method returns an object that has a few properties: @@ -503,3 +515,5 @@ configure({reactStrictMode: true}) When enabled, [``](https://react.dev/reference/react/StrictMode) is rendered around the inner element. Defaults to `false`. + +This setting can be changed for a single test by providing `reactStrictMode` in the options argument of the [`render`](#render-options-reactstrictmode) function. \ No newline at end of file From 1b9e3966c7092a941d5faaadce5d3e1302b76f6b Mon Sep 17 00:00:00 2001 From: Alexander Burdiss Date: Fri, 2 May 2025 10:44:16 -0400 Subject: [PATCH 118/123] docs: Add TypeScript Examples to vue-testing-library (#1463) --- docs/vue-testing-library/examples.mdx | 114 ++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) diff --git a/docs/vue-testing-library/examples.mdx b/docs/vue-testing-library/examples.mdx index 8fc574328..e52eba3bc 100644 --- a/docs/vue-testing-library/examples.mdx +++ b/docs/vue-testing-library/examples.mdx @@ -3,8 +3,16 @@ id: examples title: Example --- +import Tabs from '@theme/Tabs' +import TabItem from '@theme/TabItem' + ## Basic example + + + + ```html