{"_id":"vitest-fetch-mock","_rev":"11-6a9349b8b22b820b7237c6819e88527a","name":"vitest-fetch-mock","dist-tags":{"latest":"0.4.5"},"versions":{"0.1.0":{"name":"vitest-fetch-mock","version":"0.1.0","keywords":["vitest","mock","fetch"],"author":{"name":"Ian VanSchooten","email":"ian.vanschooten@gmail.com"},"license":"MIT","_id":"vitest-fetch-mock@0.1.0","maintainers":[{"name":"ianvs","email":"ian.vanschooten@gmail.com"}],"contributors":[{"url":"http://jefflau.net/","name":"Jeff Lau","email":"jeff-lau@live.com"}],"homepage":"https://github.com/IanVS/vitest-fetch-mock#readme","bugs":{"url":"https://github.com/IanVS/vitest-fetch-mock/issues"},"dist":{"shasum":"076768ff0979743fca385ff642f7d9910f983682","tarball":"https://registry.npmjs.org/vitest-fetch-mock/-/vitest-fetch-mock-0.1.0.tgz","fileCount":5,"integrity":"sha512-HpabFgokq0Q/cLwYNCTxwH6jV1TTUNg6IZxnLW4mFXgtDWcUQPJoiKS+LiOSf5cllXj2iCkIA8Cmuq5jU4oZQg==","signatures":[{"sig":"MEUCIQCcbIAV2seYIPIwX71l6rjpf4l6pc3zvrmKWE2q4u1ptAIgCw8jZ10QgmAPyhLVosvSsfdugF5z0ZnSt9hMcSiQisQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":55099,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiK7tCACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo5WQ/7Bvpez89B/vhZ943Gyhf91C+298orFyBzQUPAMduYQ2xcMNT6\r\nMumDMgpYiM3W2X7pYYoZMhRhLE6T/uux05o/ufhMz82R46LoFL0p+Zj5FSyC\r\nQh7ojis2ahjdtCGwYI4EclB3II5JQ2N5QgzYJ7RsKnBcvFGV2zVAV6FiXAvD\r\natkwDTwxZYGxTw+Uh2vmpDW/5z1m9j2OEruvGcqCz/qTL3oHaqXnaaZZr6EW\r\nJo/n46SxFR1zNjdyAagN9j500+hZ8iqC/Fkubth5ByIlCj1IJqWck/r6un0I\r\nZqLRCRL/tm9R2vJMDIztjnNc17EdU57fike6T/NLZKwjoueC6YkTEEjghgmy\r\nKlc5OveSczO1F7nXK/buFTKca+AaMcsuZOBnfp0WEFTPLmqhxdYnQO/kQ8/v\r\njq6jtnzxcLoEurgDmrlqdRv/asJUKu9eA39xmxr5XN9NU+U0onNAXOxIzf0J\r\nmDH1+B5yimEC/jRGy+GyigH9wt4+/LIKPMhRCyrjDCr1AXjXwTKuMM38k89k\r\nB+wjbBaQiD/tihkjPMTY6IJNkZZ6BwEg+3In0+bSM1I2Zibh0uqJl4NuHbMH\r\nfHV2oj6K/IXECryQxeKAyO5wvPu5DUJTQAbJjTZaIYsHRNUwz0DoI5DPPzfX\r\nyYyjwiCiOGn1HiKG50ixDcLKghxO0jKwlwQ=\r\n=YcHX\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","type":"module","types":"types","module":"src/index.js","engines":{"node":">=14.14.0"},"gitHead":"255accdbbfbc0250bb0528e8838f3b251918723f","scripts":{"tsc":"tsc","lint":"eslint .","test":"vitest run && npm run tsc && npm run lint"},"_npmUser":{"name":"ianvs","email":"ian.vanschooten@gmail.com"},"repository":{"url":"git+https://github.com/IanVS/vitest-fetch-mock.git","type":"git"},"_npmVersion":"8.3.0","description":"fetch mock for vitest","directories":{},"_nodeVersion":"16.4.0","dependencies":{"cross-fetch":"^3.0.6"},"_hasShrinkwrap":false,"devDependencies":{"jsdom":"^19.0.0","eslint":"^7.11.0","vitest":"^0.6.0","prettier":"^2.1.2","typescript":"^4.6.2","@types/node":"^10.17.40","regenerator-runtime":"^0.13.7","@typescript-eslint/parser":"^5.14.0","@typescript-eslint/eslint-plugin":"^5.14.0"},"peerDependencies":{"vitest":"*"},"_npmOperationalInternal":{"tmp":"tmp/vitest-fetch-mock_0.1.0_1647033154721_0.5342353726646953","host":"s3://npm-registry-packages"}},"0.2.0":{"name":"vitest-fetch-mock","version":"0.2.0","keywords":["vitest","mock","fetch"],"author":{"name":"Ian VanSchooten","email":"ian.vanschooten@gmail.com"},"license":"MIT","_id":"vitest-fetch-mock@0.2.0","maintainers":[{"name":"ianvs","email":"ian.vanschooten@gmail.com"}],"contributors":[{"url":"http://jefflau.net/","name":"Jeff Lau","email":"jeff-lau@live.com"}],"homepage":"https://github.com/IanVS/vitest-fetch-mock#readme","bugs":{"url":"https://github.com/IanVS/vitest-fetch-mock/issues"},"dist":{"shasum":"3609fe7a7b0178d7ee9070814a2a3592de29e5a7","tarball":"https://registry.npmjs.org/vitest-fetch-mock/-/vitest-fetch-mock-0.2.0.tgz","fileCount":5,"integrity":"sha512-ebd80Gx4mz7CbHs71PA8M3WQIcfL7pjoA50316Ld0na4dniKKUbnQorDr9XYgcnLHL1vUO459HJm05x3TXX/lA==","signatures":[{"sig":"MEQCIA128cHu+g5i3gsTzCtFeTWo9uoU6TkpibohF2Z42kasAiAz6eqyDbubk4DH+RNvRHu4REz/wBjz1Bg1RZGGj/JQbw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":55088,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJixjq8ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrKSQ//XYTz8oT+5eUH/f1OBC83Gn/z6gmenzD6kW5FYgeH2LwSA41e\r\njvJD6lA/qvaHALqLNYmIWpMoa3MRSTC9LWurD3DCtanzzYfGTuE6hrEq/NzV\r\nj+Nz3HOZBiQoab9U57jnqH81PBTCySz94dmpCnpwOknDKAKIUV6VjNCb0u+h\r\nU2LkYynLDbC2R9LbHByurdtxtUPd4byFqTwtgBmT0Tp49U7pCLUEB3lVAYtG\r\n1JxYPDsl69XfaFgpXOKaMmksB43X5CJyv/Bmj0azwNUjDbtTZoih5rlldaKJ\r\ntyR0Hva8D8VsqzAbOzv6bA8PN/GEN1Gm1CYqK3kjl2DJCYPkM15u4hR3hAU7\r\nHPMTYjsH16BjhN0OW5utI+Ykjq0vOylqXD0BjiRKwTyveM/5s8Nq6Grks8SA\r\nOjHYp77kgmDYJyvH9zqpBbguN8ykEs0okhfXaS7bpggxxp/TLEGzP6mApf+f\r\nJ+X4YZdeZmtbXUoVoBN3T/8b88JYJTTU4EZ3Rtp/ibNt183pqvybRC2EeB7c\r\ntumCC5LZKX+r3OD+Hqc69up7VWezhsl3B84JUMJOybReF7sR6ZOt5ypdsqG6\r\njdEkglmdMlYySZnw1a5L4XRTN/1ObBWUtKY8MnZDPod8bTjhJmDdnGXsBDyq\r\nzwYXHZCdNBvKeFKVkFnIygd2BPbTsp/Jhc0=\r\n=7Hku\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","type":"module","types":"types","module":"src/index.js","engines":{"node":">=14.14.0"},"gitHead":"2bab3d37e4c4765115ca2c9d68be16b07d4f8408","scripts":{"tsc":"tsc","lint":"eslint .","test":"vitest run && npm run tsc && npm run lint"},"_npmUser":{"name":"ianvs","email":"ian.vanschooten@gmail.com"},"repository":{"url":"git+https://github.com/IanVS/vitest-fetch-mock.git","type":"git"},"_npmVersion":"8.12.1","description":"fetch mock for vitest","directories":{},"_nodeVersion":"16.14.2","dependencies":{"cross-fetch":"^3.0.6"},"_hasShrinkwrap":false,"devDependencies":{"jsdom":"^19.0.0","eslint":"^7.11.0","vitest":"^0.17.0","prettier":"^2.1.2","typescript":"^4.6.2","@types/node":"^10.17.40","regenerator-runtime":"^0.13.7","@typescript-eslint/parser":"^5.14.0","@typescript-eslint/eslint-plugin":"^5.14.0"},"peerDependencies":{"vitest":"^0.16.0"},"_npmOperationalInternal":{"tmp":"tmp/vitest-fetch-mock_0.2.0_1657158332678_0.8082737206004016","host":"s3://npm-registry-packages"}},"0.2.1":{"name":"vitest-fetch-mock","version":"0.2.1","keywords":["vitest","mock","fetch"],"author":{"name":"Ian VanSchooten","email":"ian.vanschooten@gmail.com"},"license":"MIT","_id":"vitest-fetch-mock@0.2.1","maintainers":[{"name":"ianvs","email":"ian.vanschooten@gmail.com"}],"contributors":[{"url":"http://jefflau.net/","name":"Jeff Lau","email":"jeff-lau@live.com"}],"homepage":"https://github.com/IanVS/vitest-fetch-mock#readme","bugs":{"url":"https://github.com/IanVS/vitest-fetch-mock/issues"},"dist":{"shasum":"54fb75138f4546ad113e45138b2840492cda6f00","tarball":"https://registry.npmjs.org/vitest-fetch-mock/-/vitest-fetch-mock-0.2.1.tgz","fileCount":5,"integrity":"sha512-u6wjTy3huKLx9VDzChOpt3BS9jIhCTbruqLIlkhXZ8dRMzNAsmiTIskI39+uqNegkFMQeEefBqKYZ3UC142AJA==","signatures":[{"sig":"MEUCIB65Q9Tj93Zbf8u3mHu7218PizGF4GT/hcnI27VCiNE9AiEA0SkPruPDD/+dfGRhMjV3UOFn9Q/LcwV0W5j1vi4q7dc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":55089,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJixxDJACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmowfA/+K/5kBPNYNfFUxIv/bKvgzlNCfaN3AsE20tNDcWANF+tgbQFd\r\nfjmZXd64ESI8GLemXyf4xgBAgucdhxS1KCRJww3dC59uEdvC45MLaXa//P9H\r\nUW9tu44EW7z/Nte6kyUksxGkWFfMQvn/SDtumBNXrRcBKkxWvDoyM0qksV7c\r\nIpC+1+OfIE/XCZs8HWg1bppLmAlxRGhETLVcuTU+KUTFGb+jn4L1g6JR7Mv7\r\n+x9WKyRnOZb9YhNZtrRfeYyepMQJe0xm7iXGFTgkj0qAq1M+FNALW2z+mFTc\r\nr9HToRWatT/CumAC8kPPJZYizdhQhR/U1HkYFRD1c1izBNDlKIrsIJom4pio\r\nyfEOPKXasJQ2h2SUnG0L4p3gQmGK6Kher3uU9dKS7LhsCeuubfbKjuryRkJ6\r\nwmArlA1sLP9BHX1bvnGFdBEhTqVXZ5sUXAnzBRdoqcq9mvg+n/burv3eNXL0\r\nF25ne4PGPBN4RKkCKHM69XPUy7yWymm0wMyVqlhOI27XWrAyXNvS+51FppQN\r\nrzISsz/uwrRSQqdqmMekIkjpNdszDkkg4ckbn95Ow5Dp+pepC1erDMMfzffH\r\nvGu9CovCjbhUHpD6U3DvLHQoJg/wZUwisVXmy8+FvkNkRZ/CyokCqxtGrHyW\r\n+0bJvtQu7wTWgqMBzctxfDrtYe2zTZqDtd0=\r\n=nNY/\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","type":"module","types":"types","module":"src/index.js","engines":{"node":">=14.14.0"},"gitHead":"7dc7d6a71555bf01c71b59a6433573a647d6efce","scripts":{"tsc":"tsc","lint":"eslint .","test":"vitest run && npm run tsc && npm run lint"},"_npmUser":{"name":"ianvs","email":"ian.vanschooten@gmail.com"},"repository":{"url":"git+https://github.com/IanVS/vitest-fetch-mock.git","type":"git"},"_npmVersion":"8.12.1","description":"fetch mock for vitest","directories":{},"_nodeVersion":"16.14.2","dependencies":{"cross-fetch":"^3.0.6"},"_hasShrinkwrap":false,"devDependencies":{"jsdom":"^19.0.0","eslint":"^7.11.0","vitest":"^0.17.0","prettier":"^2.1.2","typescript":"^4.6.2","@types/node":"^10.17.40","regenerator-runtime":"^0.13.7","@typescript-eslint/parser":"^5.14.0","@typescript-eslint/eslint-plugin":"^5.14.0"},"peerDependencies":{"vitest":">=0.16.0"},"_npmOperationalInternal":{"tmp":"tmp/vitest-fetch-mock_0.2.1_1657213129003_0.03957101435766219","host":"s3://npm-registry-packages"}},"0.2.2":{"name":"vitest-fetch-mock","version":"0.2.2","keywords":["vitest","mock","fetch"],"author":{"name":"Ian VanSchooten","email":"ian.vanschooten@gmail.com"},"license":"MIT","_id":"vitest-fetch-mock@0.2.2","maintainers":[{"name":"ianvs","email":"ian.vanschooten@gmail.com"}],"contributors":[{"url":"http://jefflau.net/","name":"Jeff Lau","email":"jeff-lau@live.com"}],"homepage":"https://github.com/IanVS/vitest-fetch-mock#readme","bugs":{"url":"https://github.com/IanVS/vitest-fetch-mock/issues"},"dist":{"shasum":"f6849dcf7a8e862a509e1cee2fa3bb0cb534f468","tarball":"https://registry.npmjs.org/vitest-fetch-mock/-/vitest-fetch-mock-0.2.2.tgz","fileCount":5,"integrity":"sha512-XmH6QgTSjCWrqXoPREIdbj40T7i1xnGmAsTAgfckoO75W1IEHKR8hcPCQ7SO16RsdW1t85oUm6pcQRLeBgjVYQ==","signatures":[{"sig":"MEUCIQDLXN37wgPflFh/HzT3A0Ddhk1zh8/CnNrm/oJThBCtYwIgQluKXeBtpBQin5DZg3cS4r/iO3VOMs2RJj7TbjrOGPg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":56050,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj9jynACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqHfQ//ZAWNOdfQQKUYQiLcZz7s6o+XugEf3ruagV+seK4Yt4dlzsqJ\r\nG8p9Udyx2oDH3sSlD5qms+MwGNNnuq4VtLTmGDkZpYoAA5aTEdkFh+KdeVeH\r\n75l/hjWpVlAh9czHuVZcaFXRENofVIJMTsEICLhFfoP1kF2E+pwWz4XktwPG\r\nqtCGuadtwzuEugZ/EAWRwM34hxenxiRKIJI/ge/uVh7r5IzpJ249x08wkgPk\r\nPDwjKnZha7PtFMg3aqZcOnVoOJpnwg/nsgTjLPl9sUFJxD3xgwa4IaNNpHfq\r\nIgIxbO7oTyd4FKiwgsgNuB/CCF9OZnysiI+QLDkmPQdCcotRIQ9QHgQ6FVfZ\r\neZwqqVQ0Vg/qciZLanNAJnYQMjapnGlOXxi2p0RNGzJB6Qdt/Sy2XVc8X9Va\r\n9jUnXKxEC6T1qHgqCMHSNH2f3JFKi6sEky7JkjTzk4r829lF81oR4cB/82cE\r\njrgHVF5kRwjjMHpAhVPNMsA9tyI92EQj5iyRly+TFtiIRLWz0P9LS9HQQNCd\r\nz2tQgKHjJ43BlV3qG0EboykR2drtZmuxTHlugSK7rzkpo1gIYvQNQTbS+ieL\r\nE7ubaLAUUCSHxkrKTL78wyfTE4P0g6T9DC0xcxnUlzGgBOHyShMPI5inn2p3\r\n4Mf2rkzl5+pXCSLqpuVSThL4Y7RZ2dunPYs=\r\n=XM1x\r\n-----END PGP SIGNATURE-----\r\n"},"main":"src/index.js","type":"module","types":"types","module":"src/index.js","engines":{"node":">=14.14.0"},"gitHead":"7450d033c809929462d2af50fa294cf4731150fd","scripts":{"tsc":"tsc","lint":"eslint .","test":"vitest run && npm run tsc && npm run lint"},"_npmUser":{"name":"ianvs","email":"ian.vanschooten@gmail.com"},"repository":{"url":"git+https://github.com/IanVS/vitest-fetch-mock.git","type":"git"},"_npmVersion":"8.12.1","description":"fetch mock for vitest","directories":{},"_nodeVersion":"16.14.2","dependencies":{"cross-fetch":"^3.0.6"},"_hasShrinkwrap":false,"devDependencies":{"jsdom":"^19.0.0","eslint":"^7.11.0","vitest":"^0.17.0","prettier":"^2.1.2","typescript":"^4.6.2","@types/node":"^10.17.40","regenerator-runtime":"^0.13.7","@typescript-eslint/parser":"^5.14.0","@typescript-eslint/eslint-plugin":"^5.14.0"},"peerDependencies":{"vitest":">=0.16.0"},"_npmOperationalInternal":{"tmp":"tmp/vitest-fetch-mock_0.2.2_1677081767103_0.7739459801684718","host":"s3://npm-registry-packages"}},"0.3.0":{"name":"vitest-fetch-mock","version":"0.3.0","keywords":["vitest","mock","fetch"],"author":{"name":"Ian VanSchooten","email":"ian.vanschooten@gmail.com"},"license":"MIT","_id":"vitest-fetch-mock@0.3.0","maintainers":[{"name":"ianvs","email":"ian.vanschooten@gmail.com"}],"contributors":[{"url":"http://jefflau.net/","name":"Jeff Lau","email":"jeff-lau@live.com"}],"homepage":"https://github.com/IanVS/vitest-fetch-mock#readme","bugs":{"url":"https://github.com/IanVS/vitest-fetch-mock/issues"},"dist":{"shasum":"a519293b61be1ce43377d720500bbfa89861e509","tarball":"https://registry.npmjs.org/vitest-fetch-mock/-/vitest-fetch-mock-0.3.0.tgz","fileCount":5,"integrity":"sha512-g6upWcL8/32fXL43/5f4VHcocuwQIi9Fj5othcK9gPO8XqSEGtnIZdenr2IaipDr61ReRFt+vaOEgo8jiUUX5w==","signatures":[{"sig":"MEQCIB6AvaEGPwKpj5R1nUaC4wM3ZKS1SnLN6lNBmr1Ub7b2AiBiRRjBXeS925h/iEsYiAFnNpKKBLKnrk491dy9EjxLcg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":56185},"main":"src/index.js","type":"module","types":"./src/index.d.ts","module":"src/index.js","engines":{"node":">=14.14.0"},"gitHead":"8686d8279902f79e0542694bc6f842c0ab4da310","scripts":{"tsc":"tsc","lint":"eslint . && prettier --check .","test":"vitest run"},"_npmUser":{"name":"ianvs","email":"ian.vanschooten@gmail.com"},"repository":{"url":"git+https://github.com/IanVS/vitest-fetch-mock.git","type":"git"},"_npmVersion":"10.7.0","description":"fetch mock for vitest","directories":{},"_nodeVersion":"20.15.1","dependencies":{"cross-fetch":"^4.0.0"},"_hasShrinkwrap":false,"devDependencies":{"jsdom":"^24.1.0","eslint":"^8.56.0","vitest":"^2.0.2","prettier":"^3.3.2","typescript":"~5.5.3","@types/node":"^20.14.10","@typescript-eslint/parser":"^7.16.0","@typescript-eslint/eslint-plugin":"^7.16.0"},"peerDependencies":{"vitest":">=2.0.0"},"_npmOperationalInternal":{"tmp":"tmp/vitest-fetch-mock_0.3.0_1720714833521_0.905925288913709","host":"s3://npm-registry-packages"}},"0.4.0":{"name":"vitest-fetch-mock","version":"0.4.0","keywords":["vitest","mock","fetch"],"author":{"name":"Ian VanSchooten","email":"ian.vanschooten@gmail.com"},"license":"MIT","_id":"vitest-fetch-mock@0.4.0","maintainers":[{"name":"ianvs","email":"ian.vanschooten@gmail.com"}],"contributors":[{"url":"http://jefflau.net/","name":"Jeff Lau","email":"jeff-lau@live.com"}],"homepage":"https://github.com/IanVS/vitest-fetch-mock#readme","bugs":{"url":"https://github.com/IanVS/vitest-fetch-mock/issues"},"dist":{"shasum":"4eb60b7281fcbfd9e0dae0d538dad1738d904434","tarball":"https://registry.npmjs.org/vitest-fetch-mock/-/vitest-fetch-mock-0.4.0.tgz","fileCount":6,"integrity":"sha512-ttAOb8S6GVhYvDAXl/CSfTwT1KT8iocPBGzW1/z3M7N+PrRz3yXjsiyHSdatqkuDlFVEB07ajMi9CzaN+srQsw==","signatures":[{"sig":"MEYCIQDOrzNSi6cwdD45YSGMzkZkxR6o7nNwoNv15uxXf5LqvwIhAItuwFZZpEZQW6IEKwvzQ7+oSO/v0kS4YnD1Wo1ZFXLZ","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":70089},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18.0.0"},"gitHead":"6b4ba2e4155143eb55432007eb6f05bf0dbf1cc0","scripts":{"lint":"eslint src","test":"vitest run","build":"tsc -p tsconfig.build.json","format":"prettier src --write","lint:fix":"eslint src --fix","test:watch":"vitest run --watch","type-check":"tsc","format:check":"prettier src --check"},"_npmUser":{"name":"ianvs","email":"ian.vanschooten@gmail.com"},"repository":{"url":"git+https://github.com/IanVS/vitest-fetch-mock.git","type":"git"},"_npmVersion":"10.7.0","description":"fetch mock for vitest","directories":{},"_nodeVersion":"20.15.1","_hasShrinkwrap":false,"devDependencies":{"jsdom":"^24.1.0","eslint":"^8.56.0","vitest":"2.0.2","prettier":"^3.3.2","typescript":"~5.5.0","@types/node":"^22.0.0","@typescript-eslint/parser":"^7.16.0","@typescript-eslint/eslint-plugin":"^7.16.0"},"peerDependencies":{"vitest":">=2.0.0"},"_npmOperationalInternal":{"tmp":"tmp/vitest-fetch-mock_0.4.0_1729862574174_0.8732654564338302","host":"s3://npm-registry-packages"}},"0.4.1":{"name":"vitest-fetch-mock","version":"0.4.1","keywords":["vitest","mock","fetch"],"author":{"name":"Ian VanSchooten","email":"ian.vanschooten@gmail.com"},"license":"MIT","_id":"vitest-fetch-mock@0.4.1","maintainers":[{"name":"ianvs","email":"ian.vanschooten@gmail.com"}],"contributors":[{"url":"http://jefflau.net/","name":"Jeff Lau","email":"jeff-lau@live.com"}],"homepage":"https://github.com/IanVS/vitest-fetch-mock#readme","bugs":{"url":"https://github.com/IanVS/vitest-fetch-mock/issues"},"dist":{"shasum":"2a865f0685e168c7c425616d0b2708d2b3050fc4","tarball":"https://registry.npmjs.org/vitest-fetch-mock/-/vitest-fetch-mock-0.4.1.tgz","fileCount":6,"integrity":"sha512-Y6VEV2AgJps1t9NUdhID/vUwarAuhOkPHShfoEruIlQr5+O31hgJ4YmZpU8kVWD3KQjEyZqPeMibWehd7rMq+A==","signatures":[{"sig":"MEUCIEX6BFlXQuYvt94cd2PB0aQDC/I53pgSbWM/y+9wGbrMAiEA4hM0JWD9ckI5mzwuTmDn+dw7pTKD8PubAcBBxE5UoW4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":69145},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18.0.0"},"gitHead":"66aeefd26577e48693df2c79dd232cb8217fbebb","scripts":{"lint":"eslint src","test":"vitest run","build":"tsc -p tsconfig.build.json","format":"prettier src --write","lint:fix":"eslint src --fix","test:watch":"vitest run --watch","type-check":"tsc","format:check":"prettier src --check"},"_npmUser":{"name":"ianvs","email":"ian.vanschooten@gmail.com"},"repository":{"url":"git+https://github.com/IanVS/vitest-fetch-mock.git","type":"git"},"_npmVersion":"10.7.0","description":"fetch mock for vitest","directories":{},"_nodeVersion":"20.15.1","_hasShrinkwrap":false,"devDependencies":{"jsdom":"^24.1.0","eslint":"^8.56.0","vitest":"^2.1.3","prettier":"^3.3.2","typescript":"~5.5.0","@types/node":"^22.0.0","@vitest/coverage-v8":"^2.1.3","@typescript-eslint/parser":"^7.16.0","@typescript-eslint/eslint-plugin":"^7.16.0"},"peerDependencies":{"vitest":">=2.0.0"},"_npmOperationalInternal":{"tmp":"tmp/vitest-fetch-mock_0.4.1_1730126649285_0.8842212056278977","host":"s3://npm-registry-packages"}},"0.4.2":{"name":"vitest-fetch-mock","version":"0.4.2","keywords":["vitest","mock","fetch"],"author":{"name":"Ian VanSchooten","email":"ian.vanschooten@gmail.com"},"license":"MIT","_id":"vitest-fetch-mock@0.4.2","maintainers":[{"name":"ianvs","email":"ian.vanschooten@gmail.com"}],"contributors":[{"url":"http://jefflau.net/","name":"Jeff Lau","email":"jeff-lau@live.com"}],"homepage":"https://github.com/IanVS/vitest-fetch-mock#readme","bugs":{"url":"https://github.com/IanVS/vitest-fetch-mock/issues"},"dist":{"shasum":"d39f2de9cc5af86e32ff7b14b6d311b241a5f140","tarball":"https://registry.npmjs.org/vitest-fetch-mock/-/vitest-fetch-mock-0.4.2.tgz","fileCount":6,"integrity":"sha512-MuN/TCAvvUs9sLMdOPKqdXEUOD0E5cNW/LN7Tro3KkrLBsvUaH7iQWcznNUU4ml+GqX6ZbNguDmFQ2tliKqhCg==","signatures":[{"sig":"MEUCIQDJqs1Bccgztp2eEDP3NcKEi4FROEZZJGpdab3LXjRXxQIgMH73MzmMHBQ3B0mBhgFOV8aVz5A67BC/qaaBin/nxE8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":70492},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18.0.0"},"gitHead":"e2766750e9c3c2910ba257b71437316334b43a70","scripts":{"lint":"eslint src tests","test":"vitest run","build":"tsc -p tsconfig.build.json","format":"prettier src tests --write","lint:fix":"eslint src tests --fix","test:watch":"vitest run --watch","type-check":"tsc","format:check":"prettier src tests --check"},"_npmUser":{"name":"ianvs","email":"ian.vanschooten@gmail.com"},"repository":{"url":"git+https://github.com/IanVS/vitest-fetch-mock.git","type":"git"},"_npmVersion":"10.7.0","description":"fetch mock for vitest","directories":{},"_nodeVersion":"20.15.1","_hasShrinkwrap":false,"devDependencies":{"jsdom":"^24.1.0","eslint":"^8.56.0","vitest":"^2.1.3","prettier":"^3.3.2","typescript":"~5.5.0","@types/node":"^22.0.0","@vitest/coverage-v8":"^2.1.3","@typescript-eslint/parser":"^7.16.0","@typescript-eslint/eslint-plugin":"^7.16.0"},"peerDependencies":{"vitest":">=2.0.0"},"_npmOperationalInternal":{"tmp":"tmp/vitest-fetch-mock_0.4.2_1730992160855_0.23794842411555872","host":"s3://npm-registry-packages"}},"0.4.3":{"name":"vitest-fetch-mock","version":"0.4.3","keywords":["vitest","mock","fetch"],"author":{"name":"Ian VanSchooten","email":"ian.vanschooten@gmail.com"},"license":"MIT","_id":"vitest-fetch-mock@0.4.3","maintainers":[{"name":"ianvs","email":"ian.vanschooten@gmail.com"}],"contributors":[{"url":"http://jefflau.net/","name":"Jeff Lau","email":"jeff-lau@live.com"}],"homepage":"https://github.com/IanVS/vitest-fetch-mock#readme","bugs":{"url":"https://github.com/IanVS/vitest-fetch-mock/issues"},"dist":{"shasum":"0c361e6e2821f8ac213165155536303a99597257","tarball":"https://registry.npmjs.org/vitest-fetch-mock/-/vitest-fetch-mock-0.4.3.tgz","fileCount":6,"integrity":"sha512-PhuEh+9HCsXFMRPUJilDL7yVDFufoxqk7ze+CNks64UGlfFXaJTn1bLABiNlEc0u25RERXQGj0Tm+M9i6UY9HQ==","signatures":[{"sig":"MEYCIQC0D6uEoch3bDSSfkbJbuffQOHwl1VZut0On1fTk2f2SwIhAItQjpkxjQTkZTPkRtcJEfEhsj2fT7eg8AA/KhBonXG8","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":70516},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18.0.0"},"gitHead":"a641820dc20d16661f77030d3a24929067b71ed6","scripts":{"lint":"eslint src tests","test":"vitest run","build":"tsc -p tsconfig.build.json","format":"prettier src tests --write","lint:fix":"eslint src tests --fix","test:watch":"vitest run --watch","type-check":"tsc","format:check":"prettier src tests --check"},"_npmUser":{"name":"ianvs","email":"ian.vanschooten@gmail.com"},"repository":{"url":"git+https://github.com/IanVS/vitest-fetch-mock.git","type":"git"},"_npmVersion":"10.7.0","description":"fetch mock for vitest","directories":{},"_nodeVersion":"20.15.1","_hasShrinkwrap":false,"devDependencies":{"jsdom":"^24.1.0","eslint":"^8.56.0","vitest":"^2.1.3","prettier":"^3.3.2","typescript":"~5.5.0","@types/node":"^22.0.0","@vitest/coverage-v8":"^2.1.3","@typescript-eslint/parser":"^7.16.0","@typescript-eslint/eslint-plugin":"^7.16.0"},"peerDependencies":{"vitest":">=2.0.0"},"_npmOperationalInternal":{"tmp":"tmp/vitest-fetch-mock_0.4.3_1734716719786_0.5172529357910796","host":"s3://npm-registry-packages-npm-production"}},"0.4.4":{"name":"vitest-fetch-mock","version":"0.4.4","keywords":["vitest","mock","fetch"],"author":{"name":"Ian VanSchooten","email":"ian.vanschooten@gmail.com"},"license":"MIT","_id":"vitest-fetch-mock@0.4.4","maintainers":[{"name":"ianvs","email":"ian.vanschooten@gmail.com"}],"contributors":[{"url":"http://jefflau.net/","name":"Jeff Lau","email":"jeff-lau@live.com"}],"homepage":"https://github.com/IanVS/vitest-fetch-mock#readme","bugs":{"url":"https://github.com/IanVS/vitest-fetch-mock/issues"},"dist":{"shasum":"b76990bf4265e0fcbe20863d84d00940df4f6f8f","tarball":"https://registry.npmjs.org/vitest-fetch-mock/-/vitest-fetch-mock-0.4.4.tgz","fileCount":6,"integrity":"sha512-i2RNEAKBgnLWwj5DVz8ouzaHaPVg1xaYgAUmU5p+baJ149upnO+yJLPchAiY9ij8hf0PDkJVVke1pftBxmT05g==","signatures":[{"sig":"MEUCIQCSYN/2HrDBEXD9nwh3ZoCSwejzb7o5hg3pYfnASHuqVQIgV+oZ5NbArzadZwaipc7Zv0luH1zIdADX5VTr5wfJdH0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":70745},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18.0.0"},"gitHead":"33b5dcc00d989c7c56cd13723aa68a5f730d103f","scripts":{"lint":"eslint src tests","test":"vitest run","build":"tsc -p tsconfig.build.json","format":"prettier src tests --write","lint:fix":"eslint src tests --fix","test:watch":"vitest run --watch","type-check":"tsc","format:check":"prettier src tests --check"},"_npmUser":{"name":"ianvs","email":"ian.vanschooten@gmail.com"},"repository":{"url":"git+https://github.com/IanVS/vitest-fetch-mock.git","type":"git"},"_npmVersion":"10.9.2","description":"fetch mock for vitest","directories":{},"_nodeVersion":"22.13.1","_hasShrinkwrap":false,"packageManager":"pnpm@9.15.0+sha512.76e2379760a4328ec4415815bcd6628dee727af3779aaa4c914e3944156c4299921a89f976381ee107d41f12cfa4b66681ca9c718f0668fa0831ed4c6d8ba56c","devDependencies":{"jsdom":"^24.1.0","eslint":"^8.56.0","vitest":"^2.1.3","prettier":"^3.3.2","typescript":"~5.5.0","@types/node":"^22.0.0","@vitest/coverage-v8":"^2.1.3","@typescript-eslint/parser":"^7.16.0","@typescript-eslint/eslint-plugin":"^7.16.0"},"peerDependencies":{"vitest":">=2.0.0"},"_npmOperationalInternal":{"tmp":"tmp/vitest-fetch-mock_0.4.4_1740579277396_0.04171110223834229","host":"s3://npm-registry-packages-npm-production"}},"0.4.5":{"name":"vitest-fetch-mock","version":"0.4.5","description":"fetch mock for vitest","type":"module","main":"./dist/index.js","module":"./dist/index.js","types":"./dist/index.d.ts","scripts":{"type-check":"tsc","test":"vitest run","test:watch":"vitest run --watch","lint":"eslint src tests","lint:fix":"eslint src tests --fix","format":"prettier src tests --write","format:check":"prettier src tests --check","build":"tsc -p tsconfig.build.json"},"repository":{"type":"git","url":"git+https://github.com/IanVS/vitest-fetch-mock.git"},"keywords":["vitest","mock","fetch"],"author":{"name":"Ian VanSchooten","email":"ian.vanschooten@gmail.com"},"contributors":[{"name":"Jeff Lau","email":"jeff-lau@live.com","url":"http://jefflau.net/"}],"license":"MIT","bugs":{"url":"https://github.com/IanVS/vitest-fetch-mock/issues"},"homepage":"https://github.com/IanVS/vitest-fetch-mock#readme","engines":{"node":">=18.0.0"},"devDependencies":{"@types/node":"^22.0.0","@typescript-eslint/eslint-plugin":"^7.16.0","@typescript-eslint/parser":"^7.16.0","@vitest/coverage-v8":"^2.1.3","eslint":"^8.56.0","jsdom":"^24.1.0","prettier":"^3.3.2","typescript":"~5.5.0","vitest":"^2.1.3"},"peerDependencies":{"vitest":">=2.0.0"},"_id":"vitest-fetch-mock@0.4.5","gitHead":"4f3b03234c12a76db542d32deeed1e02d02a052d","_nodeVersion":"20.15.1","_npmVersion":"10.7.0","dist":{"integrity":"sha512-nhWdCQIGtaSEUVl96pMm0WggyDGPDv5FUy/Q9Hx3cs2RGmh3Q/uRsLClGbdG3kXBkJ3br5yTUjB2MeW25TwdOA==","shasum":"f9cd7d9f05028c56fc307ca8c6a6dc1fe72c2047","tarball":"https://registry.npmjs.org/vitest-fetch-mock/-/vitest-fetch-mock-0.4.5.tgz","fileCount":6,"unpackedSize":70586,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIA8bji5RVOEO5tm2hZL6BShoX+Z1i6PKMxP7OnNd8cYlAiEAze4FcrkFR1BFZASu37Wx83QlaFBt4UqI9PMFQElZjHU="}]},"_npmUser":{"name":"ianvs","email":"ian.vanschooten@gmail.com"},"directories":{},"maintainers":[{"name":"ianvs","email":"ian.vanschooten@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/vitest-fetch-mock_0.4.5_1741022833203_0.9590039168982432"},"_hasShrinkwrap":false}},"time":{"created":"2022-03-11T21:12:34.720Z","modified":"2025-03-03T17:27:13.855Z","0.1.0":"2022-03-11T21:12:34.871Z","0.2.0":"2022-07-07T01:45:32.819Z","0.2.1":"2022-07-07T16:58:49.174Z","0.2.2":"2023-02-22T16:02:47.283Z","0.3.0":"2024-07-11T16:20:33.675Z","0.4.0":"2024-10-25T13:22:54.480Z","0.4.1":"2024-10-28T14:44:09.576Z","0.4.2":"2024-11-07T15:09:21.052Z","0.4.3":"2024-12-20T17:45:19.960Z","0.4.4":"2025-02-26T14:14:37.626Z","0.4.5":"2025-03-03T17:27:13.366Z"},"bugs":{"url":"https://github.com/IanVS/vitest-fetch-mock/issues"},"author":{"name":"Ian VanSchooten","email":"ian.vanschooten@gmail.com"},"license":"MIT","homepage":"https://github.com/IanVS/vitest-fetch-mock#readme","keywords":["vitest","mock","fetch"],"repository":{"type":"git","url":"git+https://github.com/IanVS/vitest-fetch-mock.git"},"description":"fetch mock for vitest","contributors":[{"name":"Jeff Lau","email":"jeff-lau@live.com","url":"http://jefflau.net/"}],"maintainers":[{"name":"ianvs","email":"ian.vanschooten@gmail.com"}],"readme":"# Vitest Fetch Mock\n\n![Node.js CI](https://github.com/IanVS/vitest-fetch-mock/workflows/Node.js%20CI/badge.svg)\n\nThis project was forked from [jest-fetch-mock](https://github.com/jefflau/jest-fetch-mock), and tweaked slightly to run\nwith Vitest instead of Jest. It is mostly compatible with `jest-fetch-mock`, with the main difference being that you\nneed to create fetchMock with a function call, and provide `vi` to it, rather than relying on a global `vi` or (`jest`\nin jest-fetch-mock's case). See [Usage](#usage) for more details.\n\nFetch is the canonical way to do HTTP requests in the browser and other modern runtimes. Vitest Fetch Mock allows you to\neasily mock your `fetch` calls and return the response you need to fake the HTTP requests. It's easy to setup and you\ndon't need a library like `nock` to get going and it uses Vitest's built-in support for mocking under the surface. This\nmeans that any of the `vi.fn()` methods are also available. For more information on the Vitest mock API, check their\ndocs [here](https://vitest.dev/guide/mocking.html)\n\nAs of version 0.4.0, `vitest-fetch-mock` mocks the global\n[Fetch](https://developer.mozilla.org/en-US/docs/Web/API/Window/fetch) method, which is present in all modern runtimes\nand browsers. Previous versions used a fetch polyfill to run in older versions of Node.js. See\n[Compatibility](#compatibility) for details.\n\n## Contents\n\n- [Usage](#usage)\n  - [Compatibility](#compatibility)\n  - [Package Installation](#package-installation)\n  - [Setup for all tests](#to-setup-for-all-tests)\n  - [Setup for an individual test](#to-setup-for-an-individual-test)\n- [API](#api)\n- [Examples](#examples)\n  - [Simple mock and assert](#simple-mock-and-assert)\n  - [Mocking all fetches](#mocking-all-fetches)\n  - [Mocking a failed fetch](#mocking-a-failed-fetch)\n  - [Mocking multiple fetches with different responses](#mocking-multiple-fetches-with-different-responses)\n  - [Mocking multiple fetches with `fetch.mockResponses`](#mocking-multiple-fetches-with-fetchmockresponses)\n  - [Reset mocks between tests with `fetch.resetMocks`](#reset-mocks-between-tests-with-fetchresetmocks)\n  - [Using `fetch.mock` to inspect the mock state of each fetch call](#using-fetchmock-to-inspect-the-mock-state-of-each-fetch-call)\n  - [Using functions to mock slow servers](#using-functions-to-mock-slow-servers)\n\n## Usage\n\n### Compatibility\n\nThe most recent versions of vitest-fetch-mock support Vitest 2 and Node.js 18 and above. If you are using Vitest version\n1.x or an older version of node, please install `vitest-fetch-mock0.2.2`.\n\n### Package Installation\n\nTo setup your fetch mock you need to do the following things:\n\n```\n$ npm install --save-dev vitest-fetch-mock\n```\n\nCreate a `setupVitest` file to setup the mock or add this to an existing `setupFile`. :\n\n### To setup for all tests\n\n```js\n//setupVitest.js or similar file\nimport createFetchMock from 'vitest-fetch-mock';\nimport { vi } from 'vitest';\n\nconst fetchMocker = createFetchMock(vi);\n\n// sets globalThis.fetch and globalThis.fetchMock to our mocked version\nfetchMocker.enableMocks();\n```\n\nAdd the setup file to your vitest [config](https://vitest.dev/config/#setupfiles):\n\n```JSON\n\"test\": {\n  \"setupFiles\": [\n    \"./setupVitest.js\"\n  ]\n}\n```\n\nWith this done, you'll have `fetch` and `fetchMock` available on the global scope. Fetch will be used as usual by your\ncode and you'll use `fetchMock` in your tests\n\n#### Default not mocked\n\nIf you would like to have the 'fetchMock' available in all tests but not enabled then add `fetchMock.dontMock()` after\nthe `...enableMocks()` line in `setupVitest.js`:\n\n```js\nimport createFetchMock from 'vitest-fetch-mock';\nimport { vi } from 'vitest';\nconst fetchMocker = createFetchMock(vi);\n\n// adds the 'fetchMock' global variable and rewires 'fetch' global to call 'fetchMock' instead of the real implementation\nfetchMocker.enableMocks();\n\n// changes default behavior of fetchMock to use the real 'fetch' implementation and not mock responses\nfetchMocker.dontMock();\n```\n\nIf you want a single test file to return to the default behavior of mocking all responses, add the following to the test\nfile:\n\n```js\nbeforeEach(() => {\n  // if you have an existing `beforeEach` just add the following line to it\n  fetchMocker.doMock();\n});\n```\n\nTo enable mocking for a specific URL only:\n\n```js\nbeforeEach(() => {\n  // if you have an existing `beforeEach` just add the following lines to it\n  fetchMocker.mockIf(/^https?:\\/\\/example.com.*$/, (req) => {\n    if (req.url.endsWith('/path1')) {\n      return 'some response body';\n    } else if (req.url.endsWith('/path2')) {\n      return {\n        body: 'another response body',\n        headers: {\n          'X-Some-Response-Header': 'Some header value',\n        },\n      };\n    } else {\n      return {\n        status: 404,\n        body: 'Not Found',\n      };\n    }\n  });\n});\n```\n\nIf you have changed the default behavior to use the real implementation, you can guarantee the next call to fetch will\nbe mocked by using the `mockOnce` function:\n\n```js\nfetchMocker.mockOnce('the next call to fetch will always return this as the body');\n```\n\nThis function behaves exactly like `fetchMocker.once` but guarantees the next call to `fetch` will be mocked even if the\ndefault behavior of fetchMock is to use the real implementation. You can safely convert all you `fetchMocker.once` calls\nto `fetchMocker.mockOnce` without a risk of changing their behavior.\n\n### To setup for an individual test\n\nAdd the following line to the start of your test case (before any other imports)\n\n```js\nimport createFetchMock from 'vitest-fetch-mock';\nimport { vi } from 'vitest';\n\nconst fetchMocker = createFetchMock(vi);\nfetchMocker.enableMocks();\n```\n\n#### TypeScript importing\n\nIf you are using TypeScript and receive errors about the `fetchMock` global not existing, add a `global.d.ts` file to\nthe root of your project (or add the following line to an existing global file):\n\n```typescript\nimport 'vitest-fetch-mock';\n```\n\n## API\n\n### Mock Responses\n\n- `fetch.mockResponse(bodyOrFunction, init): fetch` - Mock all fetch calls\n- `fetch.mockResponseOnce(bodyOrFunction, init): fetch` - Mock each fetch call independently\n- `fetch.once(bodyOrFunction, init): fetch` - Alias for `mockResponseOnce(bodyOrFunction, init)`\n- `fetch.mockResponses(...responses): fetch` - Mock multiple fetch calls independently\n  - Each argument is an array taking `[bodyOrFunction, init]`\n- `fetch.mockReject(errorOrFunction): fetch` - Mock all fetch calls, letting them fail directly\n- `fetch.mockRejectOnce(errorOrFunction): fetch` - Let the next fetch call fail directly\n- `fetch.mockAbort(): fetch` - Causes all fetch calls to reject with an \"Aborted!\" error\n- `fetch.mockAbortOnce(): fetch` - Causes the next fetch call to reject with an \"Aborted!\" error\n\n### Functions\n\nInstead of passing body, it is also possible to pass a function that returns a promise. The promise should resolve with\na string or an object containing body and init props\n\ni.e:\n\n```js\nfetch.mockResponse(() => callMyApi().then((res) => ({ body: 'ok' })));\n// OR\nfetch.mockResponse(() => callMyApi().then((res) => 'ok'));\n```\n\nThe function may take an optional \"request\" parameter of type `http.Request`:\n\n```js\nfetch.mockResponse((req) =>\n  req.url === 'http://myapi/' ? callMyApi().then((res) => 'ok') : Promise.reject(new Error('bad url'))\n);\n```\n\nNote: the request \"url\" is parsed and then printed using the equivalent of `new URL(input).href` so it may not match\nexactly with the URL's passed to `fetch` if they are not fully qualified. For example, passing \"http://foo.com\" to\n`fetch` will result in the request URL being \"http://foo.com/\" (note the trailing slash).\n\nThe same goes for rejects:\n\n```js\nfetch.mockReject(() => doMyAsyncJob().then((res) => Promise.reject(res.errorToRaise)));\n// OR\nfetch.mockReject((req) =>\n  req.headers.get('content-type') === 'text/plain'\n    ? Promise.reject('invalid content type')\n    : doMyAsyncJob().then((res) => Promise.reject(res.errorToRaise))\n);\n```\n\n### Mock utilities\n\n- `fetch.resetMocks()` - Clear previously set mocks so they do not bleed into other mocks\n- `fetch.enableMocks()` - Enable fetch mocking by overriding `global.fetch` and mocking `node-fetch`\n- `fetch.disableMocks()` - Disable fetch mocking and restore default implementation of `fetch` and/or `node-fetch`\n- `fetch.mock` - The mock state for your fetch calls. Make assertions on the arguments given to `fetch` when called by\n  the functions you are testing. For more information check the\n  [vitest docs](https://vitest.dev/api/#mockinstance-properties)\n\nFor information on the arguments body and init can take, you can look at the MDN docs on the Response Constructor\nfunction, which `vitest-fetch-mock` uses under the surface.\n\nhttps://developer.mozilla.org/en-US/docs/Web/API/Response/Response\n\nEach mocked response or err or will return a [MockInstance Function](https://vitest.dev/api/#getmockname). You can use\nmethods like `.toHaveBeenCalledWith` to ensure that the mock function was called with specific arguments. For more\nmethods detail, take a look at [this](https://vitest.dev/api/#expect).\n\n## Examples\n\nIn most of the complicated examples below, I am testing my action creators in Redux, but it doesn't have to be used with\nRedux.\n\n### Simple mock and assert\n\nIn this simple example I won't be using any libraries. It is a simple fetch request, in this case to google.com. First\nwe setup the `beforeEach` callback to reset our mocks. This isn't strictly necessary in this example, but since we will\nprobably be mocking fetch more than once, we need to reset it across our tests to assert on the arguments given to\nfetch. Make sure the function wrapping your test is marked as async.\n\nOnce we've done that we can start to mock our response. We want to give it an object with a `data` property and a string\nvalue of `12345` and wrap it in `JSON.stringify` to JSONify it. Here we use `mockResponseOnce`, but we could also use\n`once`, which is an alias for a call to `mockResponseOnce`.\n\nWe then call the function that we want to test with the arguments we want to test with. We use `await` to wait until the\nresponse resolves, and then assert we have got the correct data back.\n\nFinally we can assert on the `.mock` state that Vitest provides for us to test what arguments were given to fetch and\nhow many times it was called\n\n```js\n//api.js\nexport function APIRequest(who) {\n  if (who === 'google') {\n    return fetch('https://google.com').then((res) => res.json());\n  } else {\n    return 'no argument provided';\n  }\n}\n```\n\n```js\n//api.test.js\nimport { APIRequest } from './api';\n\ndescribe('testing api', () => {\n  beforeEach(() => {\n    fetch.resetMocks();\n  });\n\n  it('calls google and returns data to me', async () => {\n    fetch.mockResponseOnce(JSON.stringify({ data: '12345' }));\n\n    //assert on the response\n    const res = await APIRequest('google');\n    expect(res.data).toEqual('12345');\n\n    //assert on the times called and arguments given to fetch\n    expect(fetch.requests().length).toEqual(1);\n    expect(fetch.requests()[0].url).toEqual('https://google.com/');\n  });\n});\n```\n\n### Mocking all fetches\n\nIn this example I am mocking just one fetch call. Any additional fetch calls in the same function will also have the\nsame mock response. For more complicated functions with multiple fetch calls, you can check out example 3.\n\n```js\nimport configureMockStore from 'redux-mock-store'; // mock store\nimport thunk from 'redux-thunk';\n\nconst middlewares = [thunk];\nconst mockStore = configureMockStore(middlewares);\n\nimport { getAccessToken } from './accessToken';\n\ndescribe('Access token action creators', () => {\n  it('dispatches the correct actions on successful fetch request', () => {\n    fetch.mockResponse(JSON.stringify({ access_token: '12345' }));\n\n    const expectedActions = [{ type: 'SET_ACCESS_TOKEN', token: { access_token: '12345' } }];\n    const store = mockStore({ config: { token: '' } });\n\n    return (\n      store\n        .dispatch(getAccessToken())\n        //getAccessToken contains the fetch call\n        .then(() => {\n          // return of async actions\n          expect(store.getActions()).toEqual(expectedActions);\n        })\n    );\n  });\n});\n```\n\n### Mocking a failed fetch\n\nIn this example I am mocking just one fetch call but this time using the `mockReject` function to simulate a failed\nrequest. Any additional fetch calls in the same function will also have the same mock response. For more complicated\nfunctions with multiple fetch calls, you can check out example 3.\n\n```js\nimport configureMockStore from 'redux-mock-store'; // mock store\nimport thunk from 'redux-thunk';\n\nconst middlewares = [thunk];\nconst mockStore = configureMockStore(middlewares);\n\nimport { getAccessToken } from './accessToken';\n\ndescribe('Access token action creators', () => {\n  it('dispatches the correct actions on a failed fetch request', () => {\n    fetch.mockReject(new Error('fake error message'));\n\n    const expectedActions = [{ type: 'SET_ACCESS_TOKEN_FAILED', error: { status: 503 } }];\n    const store = mockStore({ config: { token: '' } });\n\n    return (\n      store\n        .dispatch(getAccessToken())\n        //getAccessToken contains the fetch call\n        .then(() => {\n          // return of async actions\n          expect(store.getActions()).toEqual(expectedActions);\n        })\n    );\n  });\n});\n```\n\n### Mocking aborted fetches\n\nFetches can be mocked to act as if they were aborted during the request. This can be done in 4 ways:\n\n<ol>\n<li>Using `fetch.mockAborted()`</li>\n<li>Using `fetch.mockAbortedOnce()`</li>\n<li>Passing a request (or request init) with a 'signal' to fetch that has been aborted</li>\n<li>Passing a request (or request init) with a 'signal' to fetch and a async function to `fetch.mockResponse` or `fetch.mockResponseOnce` that causes the signal to abort before returning the response</li>\n</ol>\n\n```js\ndescribe('Mocking aborts', () => {\n  beforeEach(() => {\n    fetch.resetMocks();\n    fetch.doMock();\n    vi.useFakeTimers();\n  });\n  afterEach(() => {\n    vi.useRealTimers();\n  });\n\n  it('rejects with an Aborted! Error', () => {\n    fetch.mockAbort();\n    expect(fetch('/')).rejects.toThrow('Aborted!');\n  });\n  it('rejects with an Aborted! Error once then mocks with empty response', async () => {\n    fetch.mockAbortOnce();\n    await expect(fetch('/')).rejects.toThrow('Aborted!');\n    await expect(request()).resolves.toEqual('');\n  });\n\n  it('throws when passed an already aborted abort signal', () => {\n    const c = new AbortController();\n    c.abort();\n    expect(() => fetch('/', { signal: c.signal })).toThrow('Aborted!');\n  });\n\n  it('rejects when aborted before resolved', async () => {\n    const c = new AbortController();\n    fetch.mockResponse(async () => {\n      vi.advanceTimersByTime(60);\n      return '';\n    });\n    setTimeout(() => c.abort(), 50);\n    await expect(fetch('/', { signal: c.signal })).rejects.toThrow('Aborted!');\n  });\n});\n```\n\n### Mocking a redirected response\n\nSet the counter option >= 1 in the response init object to mock a redirected response\nhttps://developer.mozilla.org/en-US/docs/Web/API/Response/redirected. Note, this will only work in Node.js as it's a\nfeature of node fetch's response class https://github.com/node-fetch/node-fetch/blob/master/src/response.js#L39.\n\n```js\nfetchMock.mockResponse('<main></main>', {\n  counter: 1,\n  status: 200,\n  statusText: 'ok',\n});\n```\n\n### Mocking multiple fetches with different responses\n\nIn this next example, the store does not yet have a token, so we make a request to get an access token first. This means\nthat we need to mock two different responses, one for each of the fetches. Here we can use `fetch.mockResponseOnce` or\n`fetch.once` to mock the response only once and call it twice. Because we return the mocked function, we can chain this\njQuery style. It internally uses Vitest's `mockImplementationOnce`. You can read more about it on the\n[Vitest documentation](https://vitest.dev/api/#mockimplementationonce)\n\n```js\nimport configureMockStore from 'redux-mock-store';\nimport thunk from 'redux-thunk';\n\nconst middlewares = [thunk];\nconst mockStore = configureMockStore(middlewares);\n\nimport { getAnimeDetails } from './animeDetails';\n\ndescribe('Anime details action creators', () => {\n  it('dispatches requests for an access token before requesting for animeDetails', () => {\n    fetch.once(JSON.stringify({ access_token: '12345' })).once(JSON.stringify({ name: 'naruto' }));\n\n    const expectedActions = [\n      { type: 'SET_ACCESS_TOKEN', token: { access_token: '12345' } },\n      { type: 'SET_ANIME_DETAILS', animeDetails: { name: 'naruto' } },\n    ];\n    const store = mockStore({ config: { token: null } });\n\n    return (\n      store\n        .dispatch(getAnimeDetails('21049'))\n        //getAnimeDetails contains the 2 fetch calls\n        .then(() => {\n          // return of async actions\n          expect(store.getActions()).toEqual(expectedActions);\n        })\n    );\n  });\n});\n```\n\n### Mocking multiple fetches with `fetch.mockResponses`\n\n`fetch.mockResponses` takes as many arguments as you give it, all of which are arrays representing each Response Object.\nIt will then call the `mockImplementationOnce` for each response object you give it. This reduces the amount of\nboilerplate code you need to write. An alternative is to use `.once` and chain it multiple times if you don't like\nwrapping each response arguments in a tuple/array.\n\nIn this example our actionCreator calls `fetch` 4 times, once for each season of the year and then concatenates the\nresults into one final array. You'd have to write `fetch.mockResponseOnce` 4 times to achieve the same thing:\n\n```js\ndescribe('getYear action creator', () => {\n  it('dispatches the correct actions on successful getSeason fetch request', () => {\n    fetch.mockResponses(\n      [JSON.stringify([{ name: 'naruto', average_score: 79 }]), { status: 200 }],\n      [JSON.stringify([{ name: 'bleach', average_score: 68 }]), { status: 200 }],\n      [JSON.stringify([{ name: 'one piece', average_score: 80 }]), { status: 200 }],\n      [JSON.stringify([{ name: 'shingeki', average_score: 91 }]), { status: 200 }]\n    );\n\n    const expectedActions = [\n      {\n        type: 'FETCH_ANIMELIST_REQUEST',\n      },\n      {\n        type: 'SET_YEAR',\n        payload: {\n          animes: [\n            { name: 'naruto', average_score: 7.9 },\n            { name: 'bleach', average_score: 6.8 },\n            { name: 'one piece', average_score: 8 },\n            { name: 'shingeki', average_score: 9.1 },\n          ],\n          year: 2016,\n        },\n      },\n      {\n        type: 'FETCH_ANIMELIST_COMPLETE',\n      },\n    ];\n    const store = mockStore({\n      config: {\n        token: { access_token: 'wtw45CmyEuh4P621IDVxWkgVr5QwTg3wXEc4Z7Cv' },\n      },\n      years: [],\n    });\n\n    return (\n      store\n        .dispatch(getYear(2016))\n        //This calls fetch 4 times, once for each season\n        .then(() => {\n          // return of async actions\n          expect(store.getActions()).toEqual(expectedActions);\n        })\n    );\n  });\n});\n```\n\n### Reset mocks between tests with `fetch.resetMocks`\n\n`fetch.resetMocks` resets the `fetch` mock to give fresh mock data in between tests. It only resets the `fetch` calls as\nto not disturb any other mocked functionality.\n\n```js\ndescribe('getYear action creator', () => {\n  beforeEach(() => {\n      fetch.resetMocks();\n  });\n  it('dispatches the correct actions on successful getSeason fetch request', () => {\n\n    fetch.mockResponses(\n      [\n        JSON.stringify([ {name: 'naruto', average_score: 79} ]), { status: 200}\n      ],\n      [\n        JSON.stringify([ {name: 'bleach', average_score: 68} ]), { status: 200}\n      ]\n    )\n\n    const expectedActions = [\n      {\n        type: 'FETCH_ANIMELIST_REQUEST'\n      },\n      {\n        type: 'SET_YEAR',\n        payload: {\n          animes: [\n            {name: 'naruto', average_score: 7.9},\n            {name: 'bleach', average_score: 6.8}\n          ],\n          year: 2016,\n        }\n      },\n      {\n        type: 'FETCH_ANIMELIST_COMPLETE'\n      }\n    ]\n    const store = mockStore({\n      config: { token: { access_token: 'wtw45CmyEuh4P621IDVxWkgVr5QwTg3wXEc4Z7Cv' }},\n      years: []\n    })\n\n    return store.dispatch(getYear(2016))\n      //This calls fetch 2 times, once for each season\n      .then(() => { // return of async actions\n        expect(store.getActions()).toEqual(expectedActions)\n      })\n  });\n  it('dispatches the correct actions on successful getSeason fetch request', () => {\n\n    fetch.mockResponses(\n      [\n        JSON.stringify([ {name: 'bleach', average_score: 68} ]), { status: 200}\n      ],\n      [\n        JSON.stringify([ {name: 'one piece', average_score: 80} ]), { status: 200}\n      ],\n      [\n        JSON.stringify([ {name: 'shingeki', average_score: 91} ]), { status: 200}\n      ]\n    )\n\n    const expectedActions = [\n      {\n        type: 'FETCH_ANIMELIST_REQUEST'\n      },\n      {\n        type: 'SET_YEAR',\n        payload: {\n          animes: [\n            {name: 'bleach', average_score: 6.8},\n            {name: 'one piece', average_score: 8},\n            {name: 'shingeki', average_score: 9.1}\n          ],\n          year: 2016,\n        }\n      },\n      {\n        type: 'FETCH_ANIMELIST_COMPLETE'\n      }\n    ]\n    const store = mockStore({\n      config: { token: { access_token: 'wtw45CmyEuh4P621IDVxWkgVr5QwTg3wXEc4Z7Cv' }},\n      years: []\n    })\n\n    return store.dispatch(getYear(2016))\n      //This calls fetch 3 times, once for each season\n      .then(() => { // return of async actions\n        expect(store.getActions()).toEqual(expectedActions)\n      })\n      ,\n\n  })\n})\n```\n\n### Using `fetch.mock` to inspect the mock state of each fetch call\n\n`fetch.mock` by default uses [Vitest's mocking functions](https://vitest.dev/api/mock.html). Therefore you can make\nassertions on the mock state. In this example we have an arbitrary function that makes a different fetch request based\non the argument you pass to it. In our test, we run Vitest's `beforeEach()` and make sure to reset our mock before each\n`it()` block as we will make assertions on the arguments we are passing to `fetch()`. Then we use the `fetch.requests()`\nfunction to give us a history of all non-aborted requests (normalized) that were made. It can give you information on\neach call, and their arguments which you can use for your `expect()` calls. Vitest also comes with some nice aliases for\nthe most used ones.\n\n```js\n// api.js\n\nexport function APIRequest(who) {\n  if (who === 'facebook') {\n    return fetch('https://facebook.com');\n  } else if (who === 'twitter') {\n    return fetch('https://twitter.com');\n  } else {\n    return fetch('https://google.com');\n  }\n}\n```\n\n```js\n// api.test.js\nimport { APIRequest } from './api';\n\ndescribe('testing api', () => {\n  beforeEach(() => {\n    fetch.resetMocks();\n  });\n\n  it('calls google by default', () => {\n    fetch.mockResponse(JSON.stringify({ secret_data: '12345' }));\n    APIRequest();\n\n    // there was one request, which was not aborted\n    expect(fetch.requests().length).toEqual(1);\n    expect(fetch.requests()[0].url).toEqual('https://google.com/');\n  });\n\n  it('calls facebook', () => {\n    fetch.mockResponse(JSON.stringify({ secret_data: '12345' }));\n    APIRequest('facebook');\n\n    expect(fetch.requests().length).toEqual(2);\n    expect(fetch.requests()[0].url).toEqual('https://facebook.com/someOtherResource');\n    expect(fetch.requests()[1].url).toEqual('https://facebook.com/');\n  });\n\n  it('calls twitter', () => {\n    fetch.mockResponse(JSON.stringify({ secret_data: '12345' }));\n    APIRequest('twitter');\n\n    expect(fetch).toBeCalled(); // alias for expect(fetch.mock.calls.length).toEqual(1);\n    expect(fetch.requests().map((v) => v.url)).toContain('https://twitter.com/');\n  });\n});\n```\n\n### Using functions to mock slow servers\n\nBy default you will want to have your fetch mock return immediately. However if you have some custom logic that needs to\ntests for slower servers, you can do this by passing it a function and returning a promise when your function resolves\n\n```js\n// api.test.js\nimport { request } from './api';\n\ndescribe('testing timeouts', () => {\n  it('resolves with function and timeout', async () => {\n    fetch.mockResponseOnce(() => new Promise((resolve) => setTimeout(() => resolve({ body: 'ok' }), 100)));\n    try {\n      const response = await request();\n      expect(response).toEqual('ok');\n    } catch (e) {\n      throw e;\n    }\n  });\n});\n```\n\n### Conditional Mocking\n\nIn some test scenarios, you may want to temporarily disable (or enable) mocking for all requests or the next (or a\ncertain number of) request(s). You may want to only mock fetch requests to some URLs that match a given request path\nwhile in others you may want to mock all requests except those matching a given request path. You may even want to\nconditionally mock based on request headers.\n\nThe conditional mock functions cause `vitest-fetch-mock` to pass fetches through to the concrete fetch implementation\nconditionally. Calling `fetch.dontMock`, `fetch.doMock`, `fetch.doMockIf` or `fetch.dontMockIf` overrides the default\nbehavior of mocking/not mocking all requests. `fetch.dontMockOnce`, `fetch.doMockOnce`, `fetch.doMockOnceIf` and\n`fetch.dontMockOnceIf` only overrides the behavior for the next call to `fetch`, then returns to the default behavior\n(either mocking all requests or mocking the requests based on the last call to `fetch.dontMock`, `fetch.doMock`,\n`fetch.doMockIf` and `fetch.dontMockIf`).\n\nCalling `fetch.resetMocks()` will return to the default behavior of mocking all fetches with a text response of empty\nstring.\n\n- `fetch.dontMock()` - Change the default behavior to not mock any fetches until `fetch.resetMocks()` or\n  `fetch.doMock()` is called\n- `fetch.doMock(bodyOrFunction?, responseInit?)` - Reverses `fetch.dontMock()`. This is the default state after\n  `fetch.resetMocks()`\n- `fetch.dontMockOnce()` - For the next fetch, do not mock then return to the default behavior for subsequent fetches.\n  Can be chained.\n- `fetch.doMockOnce(bodyOrFunction?, responseInit?)` or `fetch.mockOnce` - For the next fetch, mock the response then\n  return to the default behavior for subsequent fetches. Can be chained.\n- `fetch.doMockIf(urlOrPredicate, bodyOrFunction?, responseInit?):fetch` or `fetch.mockIf` - causes all fetches to be\n  not be mocked unless they match the given string/RegExp/predicate (i.e. \"only mock 'fetch' if the request is for the\n  given URL otherwise, use the real fetch implementation\")\n- `fetch.dontMockIf(urlOrPredicate, bodyOrFunction?, responseInit?):fetch` - causes all fetches to be mocked unless they\n  match the given string/RegExp/predicate (i.e. \"don't mock 'fetch' if the request is for the given URL, otherwise mock\n  the request\")\n- `fetch.doMockOnceIf(urlOrPredicate, bodyOrFunction?, responseInit?):fetch` or `fetch.mockOnceIf` - causes the next\n  fetch to be mocked if it matches the given string/RegExp/predicate. Can be chained. (i.e. \"only mock 'fetch' if the\n  next request is for the given URL otherwise, use the default behavior\")\n- `fetch.dontMockOnceIf(urlOrPredicate):fetch` - causes the next fetch to be not be mocked if it matches the given\n  string/RegExp/predicate. Can be chained. (i.e. \"don't mock 'fetch' if the next request is for the given URL, otherwise\n  use the default behavior\")\n- `fetch.isMocking(input, init):boolean` - test utility function to see if the given url/request would be mocked. This\n  is not a read only operation and any \"MockOnce\" will evaluate (and return to the default behavior)\n\nFor convenience, all the conditional mocking functions also accept optional parameters after the 1st parameter that call\n`mockResponse` or `mockResponseOnce` respectively. This allows you to conditionally mock a response in a single call.\n\n#### Conditional Mocking examples\n\n```js\nvi.mock('fetch', async () => {\n  const fetchActual = globalThis.fetch;\n  const mocked = {};\n  for (const key of Object.keys(fetchActual)) {\n    if (typeof fetchActual[key] === 'function') {\n      mocked[key] = vi.fn(fetchActual[key]);\n    } else {\n      mocked[key] = fetchActual[key];\n    }\n  }\n  return mocked;\n})\n\ndescribe('conditional mocking', () => {\n  const realResponse = 'REAL FETCH RESPONSE'\n  const mockedDefaultResponse = 'MOCKED DEFAULT RESPONSE'\n  const testUrl = defaultRequestUri\n  let fetchSpy\n  beforeEach(() => {\n    fetch.resetMocks()\n    fetch.mockResponse(mockedDefaultResponse)\n    vi.mocked(fetch)\n      .mockImplementation(async () =>\n        Promise.resolve(new Response(realResponse))\n      )\n  })\n\n  afterEach(() => {\n    vi.mocked(fetch).mockRestore()\n  })\n\n  const expectMocked = async (uri, response = mockedDefaultResponse) => {\n    return expect(request(uri)).resolves.toEqual(response)\n  }\n  const expectUnmocked = async uri => {\n    return expect(request(uri)).resolves.toEqual(realResponse)\n  }\n\n  describe('once', () => {\n    it('default', async () => {\n      const otherResponse = 'other response'\n      fetch.once(otherResponse)\n      await expectMocked(defaultRequestUri, otherResponse)\n      await expectMocked()\n    })\n    it('dont mock once then mock twice', async () => {\n      const otherResponse = 'other response'\n      fetch\n        .dontMockOnce()\n        .once(otherResponse)\n        .once(otherResponse)\n\n      await expectUnmocked()\n      await expectMocked(defaultRequestUri, otherResponse)\n      await expectMocked()\n    })\n  })\n\n  describe('doMockIf', () => {\n    it(\"doesn't mock normally\", async () => {\n      fetch.doMockIf('http://foo')\n      await expectUnmocked()\n      await expectUnmocked()\n    })\n    it('mocks when matches string', async () => {\n      fetch.doMockIf(testUrl)\n      await expectMocked()\n      await expectMocked()\n    })\n    it('mocks when matches regex', async () => {\n      fetch.doMockIf(new RegExp(testUrl))\n      await expectMocked()\n      await expectMocked()\n    })\n    it('mocks when matches predicate', async () => {\n      fetch.doMockIf(input => input.url === testUrl)\n      await expectMocked()\n      await expectMocked()\n    })\n  })\n\n  describe('dontMockIf', () => {\n    it('mocks normally', async () => {\n      fetch.dontMockIf('http://foo')\n      await expectMocked()\n      await expectMocked()\n    })\n    it('doesnt mock when matches string', async () => {\n      fetch.dontMockIf(testUrl)\n      await expectUnmocked()\n      await expectUnmocked()\n    })\n    it('doesnt mock when matches regex', async () => {\n      fetch.dontMockIf(new RegExp(testUrl))\n      await expectUnmocked()\n      await expectUnmocked()\n    })\n    it('doesnt mock when matches predicate', async () => {\n      fetch.dontMockIf(input => input.url === testUrl)\n      await expectUnmocked()\n      await expectUnmocked()\n    })\n  })\n\n  describe('doMockOnceIf (default mocked)', () => {\n    it(\"doesn't mock normally\", async () => {\n      fetch.doMockOnceIf('http://foo')\n      await expectUnmocked()\n      await expectMocked()\n    })\n    it('mocks when matches string', async () => {\n      fetch.doMockOnceIf(testUrl)\n      await expectMocked()\n      await expectMocked()\n    })\n    it('mocks when matches regex', async () => {\n      fetch.doMockOnceIf(new RegExp(testUrl))\n      await expectMocked()\n      await expectMocked()\n    })\n    it('mocks when matches predicate', async () => {\n      fetch.doMockOnceIf(input => input.url === testUrl)\n      await expectMocked()\n      await expectMocked()\n    })\n  })\n\n  describe('dontMockOnceIf (default mocked)', () => {\n    it('mocks normally', async () => {\n      fetch.dontMockOnceIf('http://foo')\n      await expectMocked()\n      await expectMocked()\n    })\n    it('doesnt mock when matches string', async () => {\n      fetch.dontMockOnceIf(testUrl)\n      await expectUnmocked()\n      await expectMocked()\n    })\n    it('doesnt mock when matches regex', async () => {\n      fetch.dontMockOnceIf(new RegExp(testUrl))\n      await expectUnmocked()\n      await expectMocked()\n    })\n    it('doesnt mock when matches predicate', async () => {\n      fetch.dontMockOnceIf(input => input.url === testUrl)\n      await expectUnmocked()\n      await expectMocked()\n    })\n  })\n\n  describe('doMockOnceIf (default unmocked)', () => {\n    beforeEach(() => {\n      fetch.dontMock()\n    })\n    it(\"doesn't mock normally\", async () => {\n      fetch.doMockOnceIf('http://foo')\n      await expectUnmocked()\n      await expectUnmocked()\n    })\n    it('mocks when matches string', async () => {\n      fetch.doMockOnceIf(testUrl)\n      await expectMocked()\n      await expectUnmocked()\n    })\n    it('mocks when matches regex', async () => {\n      fetch.doMockOnceIf(new RegExp(testUrl))\n      await expectMocked()\n      await expectUnmocked()\n    })\n    it('mocks when matches predicate', async () => {\n      fetch.doMockOnceIf(input => input.url === testUrl)\n      await expectMocked()\n      await expectUnmocked()\n    })\n  })\n\n  describe('dontMockOnceIf (default unmocked)', () => {\n    beforeEach(() => {\n      fetch.dontMock()\n    })\n    it('mocks normally', async () => {\n      fetch.dontMockOnceIf('http://foo')\n      await expectMocked()\n      await expectUnmocked()\n    })\n    it('doesnt mock when matches string', async () => {\n      fetch.dontMockOnceIf(testUrl)\n      await expectUnmocked()\n      await expectUnmocked()\n    })\n    it('doesnt mock when matches regex', async () => {\n      fetch.dontMockOnceIf(new RegExp(testUrl))\n      await expectUnmocked()\n      await expectUnmocked()\n    })\n    it('doesnt mock when matches predicate', async () => {\n      fetch.dontMockOnceIf(input => input.url === testUrl)\n      await expectUnmocked()\n      await expectUnmocked()\n    })\n  })\n\n  describe('dont/do mock', () => {\n    test('dontMock', async () => {\n      fetch.dontMock()\n      await expectUnmocked()\n      await expectUnmocked()\n    })\n    test('dontMockOnce', async () => {\n      fetch.dontMockOnce()\n      await expectUnmocked()\n      await expectMocked()\n    })\n    test('doMock', async () => {\n      fetch.dontMock()\n      fetch.doMock()\n      await expectMocked()\n      await expectMocked()\n    })\n    test('doMockOnce', async () => {\n      fetch.dontMock()\n      fetch.doMockOnce()\n      await expectMocked()\n      await expectUnmocked()\n    })\n  })\n\n```\n\n```js\nvi.mock('fetch', async () => {\n  const fetchActual = globalThis.fetch;\n  const mocked = {};\n  for (const key of Object.keys(fetchActual)) {\n    if (typeof fetchActual[key] === 'function') {\n      mocked[key] = vi.fn(fetchActual[key]);\n    } else {\n      mocked[key] = fetchActual[key];\n    }\n  }\n  return mocked;\n});\n\nconst expectMocked = async (uri, response = mockedDefaultResponse) => {\n  return expect(request(uri)).resolves.toEqual(response);\n};\nconst expectUnmocked = async (uri) => {\n  return expect(request(uri)).resolves.toEqual(realResponse);\n};\n\ndescribe('conditional mocking complex', () => {\n  const realResponse = 'REAL FETCH RESPONSE';\n  const mockedDefaultResponse = 'MOCKED DEFAULT RESPONSE';\n  const testUrl = defaultRequestUri;\n  let fetchSpy;\n  beforeEach(() => {\n    fetch.resetMocks();\n    fetch.mockResponse(mockedDefaultResponse);\n    vi.mocked(fetch).mockImplementation(async () => Promise.resolve(new Response(realResponse)));\n  });\n\n  afterEach(() => {\n    vi.mocked(fetch).mockRestore();\n  });\n\n  describe('complex example', () => {\n    const alternativeUrl = 'http://bar';\n    const alternativeBody = 'ALTERNATIVE RESPONSE';\n    beforeEach(() => {\n      fetch\n        // .mockResponse(mockedDefaultResponse) // set above - here for clarity\n        .mockResponseOnce('1') // 1\n        .mockResponseOnce('2') // 2\n        .mockResponseOnce(async (uri) => (uri === alternativeUrl ? alternativeBody : '3')) // 3\n        .mockResponseOnce('4') // 4\n        .mockResponseOnce('5') // 5\n        .mockResponseOnce(async (uri) => (uri === alternativeUrl ? alternativeBody : mockedDefaultResponse)); // 6\n    });\n\n    describe('default (`doMock`)', () => {\n      beforeEach(() => {\n        fetch\n          // .doMock()    // the default - here for clarify\n          .dontMockOnceIf(alternativeUrl)\n          .doMockOnceIf(alternativeUrl)\n          .doMockOnce()\n          .dontMockOnce();\n      });\n\n      test('defaultRequestUri', async () => {\n        await expectMocked(defaultRequestUri, '1'); // 1\n        await expectUnmocked(defaultRequestUri); // 2\n        await expectMocked(defaultRequestUri, '3'); // 3\n        await expectUnmocked(defaultRequestUri); // 4\n        // after .once('..')\n        await expectMocked(defaultRequestUri, '5'); // 5\n        await expectMocked(defaultRequestUri, mockedDefaultResponse); // 6\n        // default 'isMocked' (not 'Once')\n        await expectMocked(defaultRequestUri, mockedDefaultResponse); // 7\n      });\n\n      test('alternativeUrl', async () => {\n        await expectUnmocked(alternativeUrl); // 1\n        await expectMocked(alternativeUrl, '2'); // 2\n        await expectMocked(alternativeUrl, alternativeBody); // 3\n        await expectUnmocked(alternativeUrl); // 4\n        // after .once('..')\n        await expectMocked(alternativeUrl, '5'); // 5\n        await expectMocked(alternativeUrl, alternativeBody); // 6\n        // default 'isMocked' (not 'Once')\n        await expectMocked(alternativeUrl, mockedDefaultResponse); // 7\n      });\n    });\n\n    describe('dontMock', () => {\n      beforeEach(() => {\n        fetch.dontMock().dontMockOnceIf(alternativeUrl).doMockOnceIf(alternativeUrl).doMockOnce().dontMockOnce();\n      });\n\n      test('defaultRequestUri', async () => {\n        await expectMocked(defaultRequestUri, '1'); // 1\n        await expectUnmocked(defaultRequestUri); // 2\n        await expectMocked(defaultRequestUri, '3'); // 3\n        await expectUnmocked(defaultRequestUri); // 4\n        // after .once('..')\n        await expectUnmocked(defaultRequestUri); // 5\n        await expectUnmocked(defaultRequestUri); // 6\n        // default 'isMocked' (not 'Once')\n        await expectUnmocked(defaultRequestUri); // 7\n      });\n\n      test('alternativeUrl', async () => {\n        await expectUnmocked(alternativeUrl); // 1\n        await expectMocked(alternativeUrl, '2'); // 2\n        await expectMocked(alternativeUrl, alternativeBody); // 3\n        await expectUnmocked(alternativeUrl); // 4\n        // after .once('..')\n        await expectUnmocked(alternativeUrl); // 5\n        await expectUnmocked(alternativeUrl); // 6\n        // default 'isMocked' (not 'Once')\n        await expectUnmocked(alternativeUrl); // 7\n      });\n    });\n\n    describe('doMockIf(alternativeUrl)', () => {\n      beforeEach(() => {\n        fetch\n          .doMockIf(alternativeUrl)\n          .dontMockOnceIf(alternativeUrl)\n          .doMockOnceIf(alternativeUrl)\n          .doMockOnce()\n          .dontMockOnce();\n      });\n\n      test('defaultRequestUri', async () => {\n        await expectMocked(defaultRequestUri, '1'); // 1\n        await expectUnmocked(defaultRequestUri); // 2\n        await expectMocked(defaultRequestUri, '3'); // 3\n        await expectUnmocked(defaultRequestUri); // 4\n        // after .once('..')\n        await expectUnmocked(defaultRequestUri); // 5\n        await expectUnmocked(defaultRequestUri); // 6\n        // default 'isMocked' (not 'Once')\n        await expectUnmocked(defaultRequestUri); // 7\n      });\n\n      test('alternativeUrl', async () => {\n        await expectUnmocked(alternativeUrl); // 1\n        await expectMocked(alternativeUrl, '2'); // 2\n        await expectMocked(alternativeUrl, alternativeBody); // 3\n        await expectUnmocked(alternativeUrl); // 4\n        // after .once('..')\n        await expectMocked(alternativeUrl, '5'); // 5\n        await expectMocked(alternativeUrl, alternativeBody); // 6\n        // default 'isMocked' (not 'Once')\n        await expectMocked(alternativeUrl, mockedDefaultResponse); // 7\n      });\n    });\n\n    describe('dontMockIf(alternativeUrl)', () => {\n      beforeEach(() => {\n        fetch\n          .dontMockIf(alternativeUrl)\n          .dontMockOnceIf(alternativeUrl)\n          .doMockOnceIf(alternativeUrl)\n          .doMockOnce()\n          .dontMockOnce();\n      });\n\n      test('defaultRequestUri', async () => {\n        await expectMocked(defaultRequestUri, '1'); // 1\n        await expectUnmocked(defaultRequestUri); // 2\n        await expectMocked(defaultRequestUri, '3'); // 3\n        await expectUnmocked(defaultRequestUri); // 4\n        // after .once('..')\n        await expectMocked(defaultRequestUri, '5'); // 5\n        await expectMocked(defaultRequestUri, mockedDefaultResponse); // 6\n        // default 'isMocked' (not 'Once')\n        await expectMocked(defaultRequestUri, mockedDefaultResponse); // 7\n      });\n\n      test('alternativeUrl', async () => {\n        await expectUnmocked(alternativeUrl); // 1\n        await expectMocked(alternativeUrl, '2'); // 2\n        await expectMocked(alternativeUrl, alternativeBody); // 3\n        await expectUnmocked(alternativeUrl); // 4\n        // after .once('..')\n        await expectUnmocked(alternativeUrl); // 5\n        await expectUnmocked(alternativeUrl); // 6\n        // default 'isMocked' (not 'Once')\n        await expectUnmocked(alternativeUrl); // 7\n      });\n    });\n  });\n});\n```\n","readmeFilename":"README.md"}