{"_id":"socket.io-mock-ts","_rev":"2-d4dc7c6d1df886c0ebd67ae9b5becadd","name":"socket.io-mock-ts","dist-tags":{"latest":"1.0.3"},"versions":{"1.0.2":{"name":"socket.io-mock-ts","version":"1.0.2","keywords":["socket.io","socket","test","mock","mocked"],"author":{"name":"James"},"license":"MIT","_id":"socket.io-mock-ts@1.0.2","maintainers":[{"name":"elicx","email":"james@eli.cx"}],"homepage":"https://github.com/moodiest/socket.io-mock-ts#readme","bugs":{"url":"https://github.com/moodiest/socket.io-mock-ts/issues"},"dist":{"shasum":"dd994b11134302932c7420760b19153920894403","tarball":"https://registry.npmjs.org/socket.io-mock-ts/-/socket.io-mock-ts-1.0.2.tgz","fileCount":13,"integrity":"sha512-0XqMcm6+wDIPRBss3KDoRXV+Fcf4nissrHw9z9So4ZyWwwtKKSaj1gsvrJyGvYbhH+cGWeVgQx6KpaybgSp4hw==","signatures":[{"sig":"MEQCIGkA9+/SHkUp8te5cs+wGYnDml5luwJER3H+0INt8oQkAiAkFHcVsCLccSn/uiDdaYelNMeOqRA5UJuKpAiPw34jUA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":46002,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiSY7OACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqFpQ/9HasWLOPgqaefffDKtyvRNnT548beOX7CuLcRLdMgycLkqKIh\r\nRO9EPv9Cj5fhXQDq8r0blL8zWZESoWWQGUpYI3Qw6BHjHTHI6mFmLW55KALU\r\nst5wAXBRbmOfDWNf7C3E6fKN/eDMiPmXQHeANjJ9qOQlb6Z0aifu1QD0iDIF\r\ntbx+DGgOYw7BXs9T1DBkDSGd2QN8GS2oXjwMMSZD8flxQ0MW6v0F6BTT8f6L\r\noASSP7ZPWl55OZcftYonTi/g1i7Cf7SYvfO65LOX8ejL4nP2DJxkmj1bdxGQ\r\n3ZtF3SgT0OZsEmYoByaOvGf5x9pWJmE6JMo59l9UVp8dO7C8BspZQYBMNMLJ\r\n01DzEYU/rKh7uQQZqIA6rsuTq8W/ordeW46HEzBfQhlRbOP4DPaWO8SJbGFq\r\nupJapr8WAzBJHu/FEqp+6nTjFLoFj4/RpQjWfu4aFsqYCLBXiiGQebRgVRdy\r\npk9Qud/jd01R92nauLIl7S4mu3ZdyGfcTxXnS2zHfa66TRNI99xY2UIb3v4/\r\nvOC8VoH6jA0ZlxZoO4LQpt7UmxgAi38knvpLC5gpi4JPi2tuQRm4hXkc4QBX\r\ncZxPMaDcUdtjBEk3FDgOKfxfSygLfDuUlJlMfMdvGvRuTjTkHhRVmLC25soF\r\ns8RhKU3qgiLCuPu136Nfd36SRT5IeNEn5JM=\r\n=gSt8\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./dist/index.umd.js","types":"./dist/index.d.ts","module":"./dist/index.es.js","exports":{".":{"import":"./dist/index.es.js","require":"./dist/index.umd.js"}},"scripts":{"tsc":"tsc","lint":"eslint \"./src/**/*.{js,jsx,ts,tsx}\"","test":"vitest run","build":"rimraf dist && yarn lint && yarn test && vite build","preview":"vite preview","coverage":"vitest run --coverage","build:skip":"rimraf dist && vite build","test:watch":"vitest"},"_npmUser":{"name":"elicx","email":"james@eli.cx"},"repository":{"url":"git+https://github.com/moodiest/socket.io-mock-ts.git","type":"git"},"description":"Mocked version of Socket.IO for testing","directories":{},"licenseText":"The MIT License (MIT)\n=====================\n\nCopyright © `2017` `Randy Lebeau`\n\nPermission is hereby granted, free of charge, to any person\nobtaining a copy of this software and associated documentation\nfiles (the “Software”), to deal in the Software without\nrestriction, including without limitation the rights to use,\ncopy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\nHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n","dependencies":{"component-emitter":"^1.3.0","@types/component-emitter":"^1.2.11"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^2.9.1","eslint":"^8.12.0","rimraf":"^3.0.2","vitest":"^0.8.3","prettier":"^2.6.2","typescript":"^4.6.3","vite-plugin-dts":"^1.0.5","vite-plugin-checker":"^0.4.4","eslint-config-airbnb":"^19.0.4","eslint-plugin-import":"^2.25.4","eslint-config-prettier":"^8.5.0","eslint-plugin-prettier":"^4.0.0","@typescript-eslint/parser":"^5.17.0","eslint-config-airbnb-typescript":"^16.2.0","@typescript-eslint/eslint-plugin":"^5.17.0","eslint-import-resolver-typescript":"^2.7.0"},"_npmOperationalInternal":{"tmp":"tmp/socket.io-mock-ts_1.0.2_1648987853841_0.4408857845703955","host":"s3://npm-registry-packages"}},"1.0.3":{"name":"socket.io-mock-ts","version":"1.0.3","description":"Mocked version of Socket.IO for testing","main":"./dist/index.umd.js","module":"./dist/index.es.js","types":"./dist/index.d.ts","exports":{".":{"import":"./dist/index.es.js","require":"./dist/index.umd.js","types":"./dist/index.d.ts"}},"scripts":{"build":"rimraf dist && yarn lint && yarn test && vite build","build:skip":"rimraf dist && vite build","preview":"vite preview","lint":"eslint \"./src/**/*.{js,jsx,ts,tsx}\"","tsc":"tsc","test":"vitest run","coverage":"vitest run --coverage","test:watch":"vitest"},"repository":{"type":"git","url":"git+https://github.com/james-elicx/socket.io-mock-ts.git"},"keywords":["socket.io","socket","test","mock","mocked"],"author":{"name":"James"},"license":"MIT","bugs":{"url":"https://github.com/james-elicx/socket.io-mock-ts/issues"},"homepage":"https://github.com/james-elicx/socket.io-mock-ts#readme","dependencies":{"@types/component-emitter":"^1.2.11","component-emitter":"^1.3.0"},"devDependencies":{"@typescript-eslint/eslint-plugin":"^5.17.0","@typescript-eslint/parser":"^5.17.0","eslint":"^8.12.0","eslint-config-airbnb":"^19.0.4","eslint-config-airbnb-typescript":"^16.2.0","eslint-config-prettier":"^8.5.0","eslint-import-resolver-typescript":"^2.7.0","eslint-plugin-import":"^2.25.4","eslint-plugin-prettier":"^4.0.0","prettier":"^2.6.2","rimraf":"^3.0.2","typescript":"^4.6.3","vite":"^2.9.1","vite-plugin-checker":"^0.4.4","vite-plugin-dts":"^1.0.5","vitest":"^0.8.3"},"_id":"socket.io-mock-ts@1.0.3","gitHead":"fdd1f9bb3d9fe4b945813ac2b8932805138c9170","_nodeVersion":"20.20.1","_npmVersion":"10.8.2","dist":{"integrity":"sha512-rK4+b+iCIRKo3nFJckCm24IkD0tBKmmzuQ/DObAxROf3/zoHQq8RdOaPIiNB7qgzBLFAAtIJolGB1YaXj6GcRQ==","shasum":"1e8e502f4ae159ef714e88c311ba7a4d415292cd","tarball":"https://registry.npmjs.org/socket.io-mock-ts/-/socket.io-mock-ts-1.0.3.tgz","fileCount":11,"unpackedSize":47423,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/socket.io-mock-ts@1.0.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQC9isuhzX4BUmWLI0fCE9CnmuVpFxK9uQl+GKTeDuoKygIhANtWCrZ95FqkAiaoiJ5CdtI8ZtjX1IuvmyLyTdjOFI8F"}]},"_npmUser":{"name":"elicx","email":"james@eli.cx"},"directories":{},"maintainers":[{"name":"elicx","email":"james@eli.cx"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/socket.io-mock-ts_1.0.3_1774204758445_0.4075147234584775"},"_hasShrinkwrap":false}},"time":{"created":"2022-04-03T12:10:53.840Z","modified":"2026-03-22T18:39:18.864Z","1.0.2":"2022-04-03T12:10:54.271Z","1.0.3":"2026-03-22T18:39:18.608Z"},"bugs":{"url":"https://github.com/james-elicx/socket.io-mock-ts/issues"},"author":{"name":"James"},"license":"MIT","homepage":"https://github.com/james-elicx/socket.io-mock-ts#readme","keywords":["socket.io","socket","test","mock","mocked"],"repository":{"type":"git","url":"git+https://github.com/james-elicx/socket.io-mock-ts.git"},"description":"Mocked version of Socket.IO for testing","maintainers":[{"name":"elicx","email":"james@eli.cx"}],"readme":"# Socket.IO-Mock-TS (TypeScript)\n\n[![npm version](https://badge.fury.io/js/socket.io-mock-ts.svg)](http://badge.fury.io/js/socket.io-mock-ts)\n\nA mock to test the Socket.IO library implementation.\n\n- Written with Typescript.\n- Bundled with [vite](https://github.com/vitejs/vite).\n- Tested with [vitest](https://github.com/vitest-dev/vitest).\n\n# Installation\n\n```bash\nyarn add socket.io-mock-ts\n```\n\n# Usage\n\nCreate a new socket mock with:\n\n```ts\nimport { SocketServerMock } from 'socket.io-mock-ts';\n\nconst socket = new SocketServerMock();\n\nconst client = socket.clientMock;\n```\n\nAnd use the socket as if it was a normal Socket.IO socket.\n\nFor example:\n\n```ts\nimport { SocketServerMock } from 'socket.io-mock-ts';\nimport { expect, test } from 'vitest';\n\ntest('Sockets should be able to talk to each other without a server', () => {\n  const socket = new SocketServerMock();\n\n  socket.on('message', (message: string) => {\n    expect(message).toBe('Hello World!');\n  });\n\n  socket.clientMock.emit('message', 'Hello World!');\n});\n```\n\nOr with using promises in unit tests, for example:\n\n```ts\nimport { SocketServerMock } from 'socket.io-mock-ts';\nimport { expect, test } from 'vitest';\n\ntest('Sockets should be able to talk to each other without a server', () => {\n  const socket = new SocketServerMock();\n\n  const data = await new Promise((resolve) => {\n    socket.on('message', (message: string) => {\n      resolve(message);\n    });\n\n    socket.clientMock.emit('message', 'Hello World!');\n  });\n\n  expect(data).toBe('Hello World!');\n});\n```\n","readmeFilename":"README.md"}