{"_id":"@dream2023/cypress-ct-solid-js","name":"@dream2023/cypress-ct-solid-js","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@dream2023/cypress-ct-solid-js","version":"1.0.0","private":false,"description":"Browser-based Component Testing for SolidJS with Cypress.io 🧡","exports":{"node":"./dist/definition.js","default":"./dist/index.es.js"},"types":"dist/index.d.ts","publishConfig":{"access":"public"},"scripts":{"cy:open":"cypress open --component","cy:run":"cypress run --component","build":"npm run build:mount && npm run build:definition","build:mount":"vite build -c vite-build.config.ts","build:definition":"tsc --project tsconfig.definition.json","prepublishOnly":"npm run build && npm run check-ts","check-ts":"tsc --noEmit","np":"npm publish --access public --registry https://registry.npmjs.org"},"keywords":["cypress","solidjs","solid","testing","component testing"],"license":"MIT","devDependencies":{"@cypress/mount-utils":"^4.0.0","@elonehoo/vite-plugin-type-ts":"^0.0.1","cypress":"12.11.0","solid-js":"^1.7.4","typescript":"^4","vite":"^4.3.4","vite-plugin-solid":"^2.7.0"},"peerDependencies":{"cypress":">=10.6.0","solid-js":">=1.0.0"},"repository":{"type":"git","url":"git+https://github.com/dream2023/cypress-solidjs.git"},"homepage":"https://github.com/dream2023/cypress-solidjs/#readme","gitHead":"780763b331a28e7ab697676858b3518fc84c1f9d","bugs":{"url":"https://github.com/dream2023/cypress-solidjs/issues"},"_id":"@dream2023/cypress-ct-solid-js@1.0.0","_nodeVersion":"16.18.0","_npmVersion":"7.24.2","dist":{"integrity":"sha512-gKx+0FekKUOGz9BUkZuznFUxZVK8oHe9yS4On6w+EMfpvf7XSi2lF+ETG6M41pegyrsBNldCDmZ0Lp7dBbNltg==","shasum":"f9e72f8a00f52d9c0416ec712ef2719b70a6cb85","tarball":"https://registry.npmjs.org/@dream2023/cypress-ct-solid-js/-/cypress-ct-solid-js-1.0.0.tgz","fileCount":10,"unpackedSize":13931,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAV97CXegYroktsa5p2GaIHnGSFaPsBJhGGb/ntnH/BHAiEAqDbzhIGmx2IKqBchwZgAf6kkodXKE/wcj9hBDxq6hy8="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkUmjHACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmoviw//TRCgfJvV3GHlD4Ei9jkEQ4kFgcsBPJhVqwQ/KIDA/7DxTn8P\r\ncuNTBlttc9j9Mc2Xf2e+hguh9BqHYQmuNVMjLpvC4Mz87QW4CoY7ITvbJKSn\r\n03pJjmEgjr07enPX0NHou7asQcCfSBJuAaLOLgGvmewrusHO97otPKnHkgXU\r\n6PxyN00tUyBHX1DrLj5xSJPXljgaLgRDLLtWN9GoaGWD+1vBOQm6OcFw7qqd\r\nzQVeie3MhYyTdqoVDEBgxNI6clgQZ8/1Uck7J+84+TTMwKvUb5lDnIVJbEuL\r\nCcarYLqd/Vh8WALlCqYLSDhmOIKKUrEJ2MiHfwGOQNxDh2P82K3B5Hl4IsH+\r\noNntokStHzK4lgPfbIaJtT5wIppPEte95Y4AaFZkcub1GPURRdGRLBUAHr01\r\ngrxSFx+3NSv7w541dEJdPkTIb6UmDAXliVCQ+TTIzNkvvlP/X1gIb1WfprIy\r\nDyM3XX1kMhVDmlxBCJrWnpSv+IlMEL6QzoQMB8zzs3Lq2BuV6na7bidwuuLm\r\nMVFz7CfkmND/MkrXR0nXrxWaeX/0HWNlNqi9Yif3E5W4LCYsExZ9FP97x/4M\r\nThEa8md9Ciwxr7H8pZwJI/300BCIykIIBxwtGmcp+Q80ayWQig39l+VCaEfe\r\nWxuVfaBcT1uJOVaao1jQzdWllt1I8jM7MZc=\r\n=NTH5\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dream2023","email":"a1098aaa@qq.com"},"directories":{},"maintainers":[{"name":"dream2023","email":"a1098aaa@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/cypress-ct-solid-js_1.0.0_1683122375779_0.4607946966191969"},"_hasShrinkwrap":false}},"time":{"created":"2023-05-03T13:59:35.705Z","1.0.0":"2023-05-03T13:59:35.955Z","modified":"2023-05-03T13:59:36.117Z"},"maintainers":[{"name":"dream2023","email":"a1098aaa@qq.com"}],"description":"Browser-based Component Testing for SolidJS with Cypress.io 🧡","homepage":"https://github.com/dream2023/cypress-solidjs/#readme","keywords":["cypress","solidjs","solid","testing","component testing"],"repository":{"type":"git","url":"git+https://github.com/dream2023/cypress-solidjs.git"},"bugs":{"url":"https://github.com/dream2023/cypress-solidjs/issues"},"license":"MIT","readme":"# @dream2023/cypress-solidjs\n\nMount SolidJS components in the open source [Cypress.io](https://www.cypress.io/) test runner **v10.7.0+**\n\n## Install\n\n- Requires SolidJS >= 1\n- Requires Cypress v12.7.0 or later\n- Requires [Node](https://nodejs.org/en/) version 12 or above\n\n```sh\nnpm install --save-dev cypress @dream2023/cypress-ct-solid-js\n```\n\n## Usage\n\n```ts\n// cypress.config.ts\nimport { defineConfig } from 'cypress'\nexport default defineConfig({\n  component: {\n    devServer: {\n      framework: '@dream2023/cypress-ct-solid-js',\n      bundler: 'vite',\n    },\n  },\n})\n```\n\n## Run\n\nOpen cypress test runner\n\n```bash\nnpx cypress open --component\n```\n\nIf you need to run test in CI\n\n```bash\nnpx cypress run --component\n```\n\nFor more information, please check the official docs for [running Cypress](https://on.cypress.io/guides/getting-started/opening-the-app#Quick-Configuration) and for [component testing](https://on.cypress.io/guides/component-testing/writing-your-first-component-test).\n\n## Example\n\n```tsx\nimport { mount, runHook, runAsyncHook } from '@dream2023/cypress-solidjs'\n\nconst HelloWorld = () => <p>Hello World!</p>;\n\nconst useCounter = (): { count: Accessor<number>, inc: () => void } => {\n  const [count, setCount] = createSignal<number>(0)\n  const inc = () => {\n    setCount(count => count + 1)\n  }\n  return { count, inc }\n}\n\nconst useDelay = (time: number) => {\n  const [done, setDone] = createSignal(false);\n  setTimeout(() => {\n    setDone(true)\n  }, time)\n\n  return done\n}\ndescribe('HelloWorld component', () => {\n  it('render component', () => {\n    mount(() => <HelloWorld />)\n    cy.contains('Hello World!')\n  })\n\n  it('hook', () => {\n    runHook(() => {\n      const { count, inc } = useCounter()\n      expect(count()).to.be.eq(0)\n      inc()\n      expect(count()).to.be.eq(1)\n    })\n  })\n\n  it('async hook', () => {\n    return runAsyncHook(async () => {\n      const time = 1000\n      const done = useDelay(time)\n      expect(done()).to.eq(false)\n      await new Promise((resolve) => {\n        setTimeout(() => {\n          resolve(undefined)\n        }, time)\n      })\n      expect(done()).to.eq(true)\n    })\n  })\n})\n```\n\n## Development\n\nRun `yarn build` to compile and sync packages to the `cypress` cli package.\n\nRun `yarn cy:open` to open Cypress component testing against real-world examples.\n\nRun `yarn test` to execute headless Cypress tests.\n\n## License\n\n[![license](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/cypress-io/cypress/blob/develop/LICENSE)\n\nThis project is licensed under the terms of the [MIT license](/LICENSE).\n","readmeFilename":"README.md"}