{"_id":"cypress-fail-on-network-error","_rev":"3-410699c3429e0629032d264e0a1a7e5e","name":"cypress-fail-on-network-error","dist-tags":{"latest":"1.0.5"},"versions":{"1.0.3":{"name":"cypress-fail-on-network-error","version":"1.0.3","keywords":["cypress","testing","network","request","response","error"],"author":{"name":"nils-hoyer"},"license":"MIT","_id":"cypress-fail-on-network-error@1.0.3","maintainers":[{"name":"nils.hoyer","email":"nhregi@gmail.com"}],"homepage":"https://github.com/nils-hoyer/cypress-fail-on-network-error#readme","bugs":{"url":"https://github.com/nils-hoyer/cypress-fail-on-network-error/issues"},"dist":{"shasum":"13bae95c4db38ac3849732950862193badf66613","tarball":"https://registry.npmjs.org/cypress-fail-on-network-error/-/cypress-fail-on-network-error-1.0.3.tgz","fileCount":5,"integrity":"sha512-e2JjkIbRxh1enLKzfsOBdkJBV8hkdUH8zB18y7xmXysmq5PnBrg+7vQNNvyo1pClKHN6OgOuMSdX62g1jfCkzA==","signatures":[{"sig":"MEUCIE5kJTX9BR62NC37MQ7jkf5xy+rQSTCJynZyjZs4q332AiEAj8kE8gfe1C2o1kDlLjlG4DrCY0qgKrtbNGYNnOObsuM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":13824},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","gitHead":"8d244dea4bef2b0be330bddaad8c3fcde4301195","scripts":{"dev":"npm run dev:fe & npm run dev:be","lint":"tsc --noEmit && tsc -p ./test/tsconfig.json && tsc -p ./cypress/tsconfig.json","test":"npm run test:ut && npm run test:it","build":"npm run build:be & npm run build:fe","dev:be":"nodemon --watch './backend/app.js' --ext 'js' --exec 'npm run build:be'","dev:fe":"nodemon --watch './src' --ext 'ts' --exec 'npm run build:fe'","verify":"npm run build && npm run lint && npm run prettier:check && npm run test","test:it":"ts-mocha -n loader=ts-node/esm test/integrationTest.ts --timeout 60000","test:ut":"ts-mocha -n loader=ts-node/esm test/unitTest.ts","build:be":"node ./backend/app.cjs","build:fe":"npx rimraf dist/ && tsc","prettier":"prettier --write \"**/*\"","prettier:check":"prettier --check \"**/*\""},"_npmUser":{"name":"nils.hoyer","email":"nhregi@gmail.com"},"repository":{"url":"git+https://github.com/nils-hoyer/cypress-fail-on-network-error.git","type":"git"},"_npmVersion":"10.2.3","description":"fail cypress test on network error","directories":{},"_nodeVersion":"20.10.0","dependencies":{"chai":"^5.0.0","type-detect":"^4.0.8"},"_hasShrinkwrap":false,"devDependencies":{"cors":"2.8.5","mocha":"10.2.0","rimraf":"5.0.5","cypress":"13.6.2","express":"4.18.1","nodemon":"3.0.2","ts-node":"^10.9.1","prettier":"3.1.1","ts-mocha":"10.0.0","typescript":"5.2.2","@types/chai":"4.3.11","@types/mocha":"10.0.6","@types/expect":"24.3.0","@types/type-detect":"4.0.3","prettier-plugin-organize-imports":"3.2.4"},"_npmOperationalInternal":{"tmp":"tmp/cypress-fail-on-network-error_1.0.3_1704546782865_0.5266921423352198","host":"s3://npm-registry-packages"}},"1.0.4":{"name":"cypress-fail-on-network-error","version":"1.0.4","keywords":["cypress","testing","network","request","response","error"],"author":{"name":"nils-hoyer"},"license":"MIT","_id":"cypress-fail-on-network-error@1.0.4","maintainers":[{"name":"nils.hoyer","email":"nhregi@gmail.com"}],"homepage":"https://github.com/nils-hoyer/cypress-fail-on-network-error#readme","bugs":{"url":"https://github.com/nils-hoyer/cypress-fail-on-network-error/issues"},"dist":{"shasum":"15f0d2bc6831fe3b1d924fa2bebed59553b3313a","tarball":"https://registry.npmjs.org/cypress-fail-on-network-error/-/cypress-fail-on-network-error-1.0.4.tgz","fileCount":5,"integrity":"sha512-npWCvGCesQy4fHfRTsKHLuqxTjR6ibjZjw7VazCJ8QP2ljtGHyDqeOlMWLp1zZnJ1m20NyIAYk6H4siDxDAvxg==","signatures":[{"sig":"MEUCIQDeKIedP8j9uOzp3P9U+0yjJe/TbAxkTb0Y+y9iZW11mQIgc3Vwbbl0s9eg8dD8+L93yh/2ukSigYnELfE5q4GWSV8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":13900},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","gitHead":"72b390816189c78951e8bce8054ca5b60f39d74d","scripts":{"dev":"npm run dev:fe & npm run dev:be","lint":"tsc --noEmit && tsc -p ./test/tsconfig.json && tsc -p ./cypress/tsconfig.json","test":"npm run test:ut && npm run test:it","build":"npm run build:be & npm run build:fe","dev:be":"nodemon --watch './backend/app.js' --ext 'js' --exec 'npm run build:be'","dev:fe":"nodemon --watch './src' --ext 'ts' --exec 'npm run build:fe'","verify":"npm run build && npm run lint && npm run prettier:check && npm run test","test:it":"ts-mocha -n loader=ts-node/esm test/integrationTest.ts --timeout 60000","test:ut":"ts-mocha -n loader=ts-node/esm test/unitTest.ts","build:be":"node ./backend/app.cjs","build:fe":"npx rimraf dist/ && tsc","prettier":"prettier --write \"**/*\"","prettier:check":"prettier --check \"**/*\""},"_npmUser":{"name":"nils.hoyer","email":"nhregi@gmail.com"},"repository":{"url":"git+https://github.com/nils-hoyer/cypress-fail-on-network-error.git","type":"git"},"_npmVersion":"10.2.3","description":"fail cypress test on network error","directories":{},"_nodeVersion":"20.10.0","dependencies":{"chai":"^5.0.0","type-detect":"^4.0.8"},"_hasShrinkwrap":false,"devDependencies":{"cors":"2.8.5","mocha":"10.4.0","rimraf":"5.0.5","cypress":"13.7.3","express":"4.19.2","nodemon":"3.1.0","ts-node":"^10.9.1","prettier":"3.2.5","ts-mocha":"10.0.0","typescript":"5.4.5","@types/chai":"4.3.14","@types/mocha":"10.0.6","@types/expect":"24.3.0","@types/type-detect":"4.0.3","prettier-plugin-organize-imports":"3.2.4"},"_npmOperationalInternal":{"tmp":"tmp/cypress-fail-on-network-error_1.0.4_1713467874844_0.06821101540551333","host":"s3://npm-registry-packages"}},"1.0.5":{"name":"cypress-fail-on-network-error","version":"1.0.5","description":"fail cypress test on network error","type":"module","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"npm run build:be & npm run build:fe","build:fe":"npx rimraf dist/ && tsc","build:be":"node ./backend/app.cjs","dev":"npm run dev:fe & npm run dev:be","dev:fe":"nodemon --watch './src' --ext 'ts' --exec 'npm run build:fe'","dev:be":"nodemon --watch './backend/app.js' --ext 'js' --exec 'npm run build:be'","prettier":"prettier --write \"**/*\"","prettier:check":"prettier --check \"**/*\"","lint":"tsc --noEmit && tsc -p ./test/tsconfig.json && tsc -p ./cypress/tsconfig.json","test":"npm run test:ut && npm run test:it","test:ut":"ts-mocha -n loader=ts-node/esm test/unitTest.ts","test:it":"ts-mocha -n loader=ts-node/esm test/integrationTest.ts --timeout 60000","verify":"npm run build && npm run lint && npm run prettier:check && npm run test"},"repository":{"type":"git","url":"git+https://github.com/nils-hoyer/cypress-fail-on-network-error.git"},"keywords":["cypress","testing","network","request","response","error"],"author":{"name":"nils-hoyer"},"license":"MIT","bugs":{"url":"https://github.com/nils-hoyer/cypress-fail-on-network-error/issues"},"homepage":"https://github.com/nils-hoyer/cypress-fail-on-network-error#readme","dependencies":{"chai":"^6.0.0","type-detect":"^4.0.8"},"devDependencies":{"@types/chai":"5.2.3","@types/mocha":"10.0.10","@types/type-detect":"4.0.3","cors":"2.8.5","cypress":"15.8.1","express":"5.2.1","mocha":"11.7.5","nodemon":"3.1.11","prettier":"3.7.4","prettier-plugin-organize-imports":"4.3.0","rimraf":"6.1.2","ts-mocha":"11.1.0","ts-node":"^10.9.1","typescript":"5.9.3"},"_id":"cypress-fail-on-network-error@1.0.5","gitHead":"a7f1f49b0f3dd07e6a7600f0ba3952e37efade95","_nodeVersion":"22.18.0","_npmVersion":"10.9.3","dist":{"integrity":"sha512-Kp13TlMS4HFJ3zd1MXhQ7le6KRhZ2XmuDEkDi4cmPoy6Q8oOrXrh9Y5wteBA17NkpyiD2eGbC0g+ld8W3gnJMA==","shasum":"e15b141bbfcf6568ddf09886d055a63c3c6ec858","tarball":"https://registry.npmjs.org/cypress-fail-on-network-error/-/cypress-fail-on-network-error-1.0.5.tgz","fileCount":5,"unpackedSize":13733,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIBTRqx2Aroz6e5cQ7n2qQVH5ifm+dtSSwhtZK4dUkycUAiEA30mLeLXRrksGRBtZVVCw8wHHmEU9x6dAuyCNxJ/qlXY="}]},"_npmUser":{"name":"nils.hoyer","email":"nhregi@gmail.com"},"directories":{},"maintainers":[{"name":"nils.hoyer","email":"nhregi@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/cypress-fail-on-network-error_1.0.5_1767524423914_0.4736864998919643"},"_hasShrinkwrap":false}},"time":{"created":"2024-01-06T13:13:02.708Z","modified":"2026-01-04T11:00:24.255Z","1.0.3":"2024-01-06T13:13:03.105Z","1.0.4":"2024-04-18T19:17:54.996Z","1.0.5":"2026-01-04T11:00:24.057Z"},"bugs":{"url":"https://github.com/nils-hoyer/cypress-fail-on-network-error/issues"},"author":{"name":"nils-hoyer"},"license":"MIT","homepage":"https://github.com/nils-hoyer/cypress-fail-on-network-error#readme","keywords":["cypress","testing","network","request","response","error"],"repository":{"type":"git","url":"git+https://github.com/nils-hoyer/cypress-fail-on-network-error.git"},"description":"fail cypress test on network error","maintainers":[{"name":"nils.hoyer","email":"nhregi@gmail.com"}],"readme":"# cypress-fail-on-network-error\n\n> :fire: **Don´t be shy and give it a try.** This plugin is brand new! :fire:\n\nThe plugin observes all network requests from your configuration. Cypress test will fail when the error conditions are met. For observing `console.error()` please check out [cypress-fail-on-console-error](https://www.npmjs.com/package/cypress-fail-on-console-error).\n\n### Installation\n\n```\nnpm install cypress-fail-on-network-error --save-dev\n```\n\n### Usage\n\n`cypress/support/e2e.js`\n\n```js\nimport failOnNetworkError, { Config, Request } from 'cypress-fail-on-network-error';\n\nconst config: Config = {\n    requests: [\n        'simpleUrlToExclude',\n        { url: 'simpleUrlToExclude', method: 'GET', status: 400 },\n        { url: /urlToExclude/, method: 'POST', status: 428 },\n        { status: 430 },\n        { status: { from: 200, to: 399 } },\n    ],\n};\n\nfailOnNetworkError(config)\n```\n\n### Config\n\n| Parameter             | Default               | <div style=\"width:300px\">Description</div>    |\n|---                    |---                    |---                                            |\n| `requests`     | `[]` | Exclude requests from throwing `AssertionError`. Types `string`, `RegExp`, `Request` are accepted. `string` and `request.url` will be converted to type `RegExp`. [String.match()](https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/String/match) will be used for matching. |                                   \n\n<br/>\n\n### Set config from cypress test \nUse `failOnNetworkError` functions `getConfig()` and `setConfig()` with your own requirements. Detailed example implementation [cypress comands](https://github.com/nils-hoyer/cypress-fail-on-network-error/blob/main/cypress/support/e2e.ts#L14-L64) & [cypress test](https://github.com/nils-hoyer/cypress-fail-on-network-error/blob/main/cypress/e2e/shouldfailOnNetworkError.cy.ts#L1-L25). Note that the config will be resetted to initial config between tests.\n```js\nconst { getConfig, setConfig } = failOnNetworkError(config);\n\nCypress.Commands.addAll({\n    getConfigRequests: () => {\n        return cy.wrap(getConfig().requests);\n    },\n    setConfigRequests: (requests: (string | Request)[]) => {\n        setConfig({ ...getConfig(), requests });\n    },\n});\n```\n\n```js\ndescribe('example test', () => {\n    it('should set exclude requests', () => {\n        cy.setConfigRequests(['urlToExclude']);\n        cy.visit('url');\n    });\n});\n```\n\n### Wait for all pending requests to be resolved\nUse `failOnNetworkError` function `waitForRequests()` to wait until all pending requests are resolved. The default timeout is 10000 ms which can be changed by overriding the default value `waitForRequests(5000)`. When reaching the timeout, Cypress test execution will continue without throwing an timeout exception.\nDetailed documenation for [cypress comands](https://github.com/nils-hoyer/cypress-fail-on-network-error/blob/main/cypress/support/e2e.ts#L13-L35) & [cypress test](https://github.com/nils-hoyer/cypress-fail-on-network-error/blob/main/cypress/e2e/shouldWaitForRequests.cy.ts).\n\n```js\nconst { waitForRequests } = failOnNetworkError(config);\n\nCypress.Commands.addAll({\n    waitForRequests: () => waitForRequests(),\n});\n```\n\n```js\ndescribe('example test', () => {\n    it('should wait for requests to be solved', () => {\n        cy.visit('url');\n        cy.waitForRequests();\n    });\n});\n```\n\n\n### Contributing\n1. Create an project issue with proper description and expected behaviour\n2. Provide a PR with implementation and tests. Command `npm run verify` have to pass locally\n","readmeFilename":"README.md"}