{"id":15552206,"url":"https://github.com/bahmutov/add-typescript-to-cypress","last_synced_at":"2025-09-26T12:30:48.407Z","repository":{"id":27149000,"uuid":"112688472","full_name":"bahmutov/add-typescript-to-cypress","owner":"bahmutov","description":"Quickly adds TypeScript spec support to Cypress","archived":false,"fork":false,"pushed_at":"2024-09-27T19:49:13.000Z","size":725,"stargazers_count":107,"open_issues_count":32,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-03T14:12:30.877Z","etag":null,"topics":["cypress","cypress-io","cypress-plugin","typescript"],"latest_commit_sha":null,"homepage":"https://github.com/bahmutov/test-add-typescript-to-cypress","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bahmutov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-12-01T03:04:26.000Z","updated_at":"2024-08-30T15:09:10.000Z","dependencies_parsed_at":"2023-12-06T07:58:26.188Z","dependency_job_id":"5e3e3c43-6790-48b1-8bc2-7ca850ca569b","html_url":"https://github.com/bahmutov/add-typescript-to-cypress","commit_stats":{"total_commits":80,"total_committers":3,"mean_commits":"26.666666666666668","dds":0.4,"last_synced_commit":"e29dce6234873ec48768003ecba8f6d08a5e725e"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bahmutov%2Fadd-typescript-to-cypress","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bahmutov%2Fadd-typescript-to-cypress/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bahmutov%2Fadd-typescript-to-cypress/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bahmutov%2Fadd-typescript-to-cypress/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bahmutov","download_url":"https://codeload.github.com/bahmutov/add-typescript-to-cypress/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234309678,"owners_count":18811946,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cypress","cypress-io","cypress-plugin","typescript"],"created_at":"2024-10-02T14:12:23.361Z","updated_at":"2025-09-26T12:30:47.835Z","avatar_url":"https://github.com/bahmutov.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @bahmutov/add-typescript-to-cypress\n\n\u003e Quickly adds TypeScript spec support to Cypress\n\n[![NPM][npm-icon] ][npm-url]\n\n[![Build status][ci-image] ][ci-url]\n[![semantic-release][semantic-image] ][semantic-url]\n[![js-standard-style][standard-image]][standard-url]\n[![renovate-app badge][renovate-badge]][renovate-app]\n\n## Why\n\n[Cypress](https://www.cypress.io/) is awesome, but does not come with TypeScript support right out of the box. Instead you need to install either [Cypress webpack preprocessor](https://github.com/cypress-io/cypress-webpack-preprocessor) or [Cypress browserify preprocessor](https://github.com/cypress-io/cypress-browserify-preprocessor) and configure them to [transpile TypeScript spec files](https://github.com/cypress-io/cypress-example-recipes/tree/master/examples/preprocessors__typescript-webpack).\n\nWhich is too much hustle. With this module you just need to execute regular `npm install` command and you can write TypeScript spec files right away.\n\n**note** overwrites existing `cypress/plugins/index.js` file once. In other installs looks for file `cypress/plugins/cy-ts-preprocessor.js` to avoid overwriting.\n\n## Install\n\nAfter install Cypress (version 1.x) and opening it once to scaffold the projects:\n\n```sh\nnpm install --save-dev @bahmutov/add-typescript-to-cypress\n```\n\nThis should create [cypress/plugins/index.js](src/plugin.js) that uses `webpack` preprocessor and `ts-loader` to transpile `.ts` files.\n\n**note** this module does NOT install TypeScript module, but lists it as a `peerDependency`. If your project does not have `typescript` yet, install it with `npm i -D typescript`.\n\n**note** if there is no root `tsconfig.json`, empty file will be created, otherwise `ts-loader` crashes.\n\n## Use\n\nJust start writing `*.ts` spec and supporting files and it should work. If the types are still not found, add to the top of the spec file the following line\n\n```\n/// \u003creference types=\"Cypress\" /\u003e\n```\n\nSee [this in action](https://www.youtube.com/watch?v=hxlrJAAeFeM\u0026feature=youtu.be)\n\n## Debug\n\nInstall this package with environment variable `DEBUG=add-typescript-to-cypress`\n\n## Eject\n\nIf you want to uninstall this module after installing it once, then you need to still have the dependencies referenced from [src/cy-ts-preprocessor.js](src/cy-ts-preprocessor.js):\n\n- [@cypress/webpack-preprocessor](https://github.com/cypress-io/cypress-webpack-preprocessor#readme) (and its peer dependencies)\n- [ts-loader](https://github.com/TypeStrong/ts-loader) (and its peer dependencies)\n\nYou can install them with\n\n```bash\nnpm i -D @cypress/webpack-preprocessor ts-loader\n```\n\nand then uninstall this package.\n\n### Small print\n\nAuthor: Gleb Bahmutov \u0026lt;gleb.bahmutov@gmail.com\u0026gt; \u0026copy; 2017\n\n* [@bahmutov](https://twitter.com/bahmutov)\n* [glebbahmutov.com](https://glebbahmutov.com)\n* [blog](https://glebbahmutov.com/blog)\n\nLicense: MIT - do anything with the code, but don't blame me if it does not work.\n\nSupport: if you find any problems with this module, email / tweet /\n[open issue](https://github.com/bahmutov/add-typescript-to-cypress/issues) on Github\n\n## MIT License\n\nCopyright (c) 2017 Gleb Bahmutov \u0026lt;gleb.bahmutov@gmail.com\u0026gt;\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\n[npm-icon]: https://nodei.co/npm/@bahmutov/add-typescript-to-cypress.svg?downloads=true\n[npm-url]: https://npmjs.org/package/@bahmutov/add-typescript-to-cypress\n[ci-image]: https://travis-ci.org/bahmutov/add-typescript-to-cypress.svg?branch=master\n[ci-url]: https://travis-ci.org/bahmutov/add-typescript-to-cypress\n[semantic-image]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg\n[semantic-url]: https://github.com/semantic-release/semantic-release\n[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg\n[standard-url]: http://standardjs.com/\n[renovate-badge]: https://img.shields.io/badge/renovate-app-blue.svg\n[renovate-app]: https://renovateapp.com/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbahmutov%2Fadd-typescript-to-cypress","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbahmutov%2Fadd-typescript-to-cypress","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbahmutov%2Fadd-typescript-to-cypress/lists"}