{"id":13711679,"url":"https://github.com/bahmutov/cypress-angularjs-unit-test","last_synced_at":"2025-09-26T12:31:10.809Z","repository":{"id":31607556,"uuid":"128394502","full_name":"bahmutov/cypress-angularjs-unit-test","owner":"bahmutov","description":"Unit test Angularjs code using Cypress.io test runner","archived":false,"fork":false,"pushed_at":"2024-12-17T23:40:29.000Z","size":450,"stargazers_count":22,"open_issues_count":17,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-03T16:39:33.918Z","etag":null,"topics":["angularjs","cypress","cypress-io","test","testing","utility"],"latest_commit_sha":null,"homepage":null,"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":"2018-04-06T12:54:12.000Z","updated_at":"2023-06-04T06:12:45.000Z","dependencies_parsed_at":"2023-12-12T01:25:11.645Z","dependency_job_id":"e828041a-f046-4b14-b0e9-5cb90f5914b6","html_url":"https://github.com/bahmutov/cypress-angularjs-unit-test","commit_stats":{"total_commits":72,"total_committers":2,"mean_commits":36.0,"dds":"0.26388888888888884","last_synced_commit":"f3dba913d296f916153022456bea06e79dc3f54b"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bahmutov%2Fcypress-angularjs-unit-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bahmutov%2Fcypress-angularjs-unit-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bahmutov%2Fcypress-angularjs-unit-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bahmutov%2Fcypress-angularjs-unit-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bahmutov","download_url":"https://codeload.github.com/bahmutov/cypress-angularjs-unit-test/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234309712,"owners_count":18811949,"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":["angularjs","cypress","cypress-io","test","testing","utility"],"created_at":"2024-08-02T23:01:10.603Z","updated_at":"2025-09-26T12:31:10.466Z","avatar_url":"https://github.com/bahmutov.png","language":"JavaScript","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"readme":"# cypress-angularjs-unit-test BETA\n\n\u003e Unit test Angularjs code using Cypress.io test runner\n\n[![NPM][npm-icon]][npm-url]\n\n[![Build status][ci-image]][ci-url]\n[![semantic-release][semantic-image]][semantic-url]\n[![standard][standard-image]][standard-url]\n[![renovate-app badge][renovate-badge]][renovate-app]\n\n## Motivation\n\nYou can use [Cypress.io](https://cypress.io) to end-to-end test any application, but what if you want to test your Angular.js values, services, controllers and components individually? This adaptor allows you to do this very quickly. See each test run as a mini app inside a real browser, go back in time using DOM snapshot, etc - all the good things [available in E2E tests are working in unit tests](https://www.cypress.io/blog/2018/04/02/sliding-down-the-testing-pyramid/).\n\n![Cypress screenshot](images/screenshot.png)\n\n## Install\n\nRequires [Node](https://nodejs.org/en/) version 6 or above.\n\n```sh\nnpm install --save cypress-angularjs-unit-test cypress\n```\n\nRequires `angular` peer dependency\n\n## Use\n\n```js\nimport {mount} from 'cypress-angularjs-unit-test'\n// or const mount = require('cypress-angularjs-unit-test').mount\nimport angular from 'angular'\n// prepare app\nit('works', () =\u003e {\n  const template = '... HTML template ... '\n  const modules = ['module1', 'module2', '...']\n  mount(template, modules)\n})\n```\n\n### Basic example\n\nSee [cypress/integration/basic-spec.js](cypress/integration/basic-spec.js)\n\n```js\nimport {mount} from 'cypress-angularjs-unit-test'\nimport angular from 'angular'\n\nangular.module('demo', [])\n  .controller('WelcomeController', function($scope) {\n    $scope.greeting = 'Welcome!';\n    $scope.version = angular.version.full\n  });\n\nbeforeEach(() =\u003e {\n  // let's mount our \"demo\" module and its controller\n  // in a \"mini app\" before each test\n  const template = `\n    \u003cdiv ng-controller=\"WelcomeController\"\u003e\n      {{greeting}}\n      ng {{version}}\n    \u003c/div\u003e\n  `\n  mount(template, ['demo'])\n})\n\nit('shows hello', () =\u003e {\n  // \"WelcomeController\" should have replaced template\n  // expression {{greeting}} with actual text\n  cy.contains('div', 'Welcome!').should('be.visible')\n})\n```\n\n## Examples\n\n* Testing a value in [value-spec.js](cypress/integration/value-spec.js)\n* [filter](cypress/src/reverse.js) and [filter-spec.js](cypress/integration/filter-spec.js)\n* [component](cypress/src/hero-detail.js) and [component-spec.js](cypress/integration/component-spec.js)\n* Loading test HTML template from a fixture in [fixture-spec.js](cypress/integration/fixture-spec.js)\n\n## Notes\n\n* `npm run cy` opens Cypress end-to-end test runner in GUI mode\n* `npm test` runs Cypress in headless mode\n* `mount` uses [`angular.bootstrap`](https://docs.angularjs.org/api/ng/function/angular.bootstrap) to mount code inside the test iframe.\n\nCypress can do everything [you can do from DevTools console](https://glebbahmutov.com/blog/angular-from-browser-console/) when dealing with Angular.js application.\n\n## Similar adaptors\n\n* [cypress-vue-unit-test](https://github.com/bahmutov/cypress-vue-unit-test)\n* [cypress-react-unit-test](https://github.com/bahmutov/cypress-react-unit-test)\n* [cypress-cycle-unit-test](https://github.com/bahmutov/cypress-cycle-unit-test)\n* [cypress-svelte-unit-test](https://github.com/bahmutov/cypress-svelte-unit-test)\n* [cypress-angular-unit-test](https://github.com/bahmutov/cypress-angular-unit-test)\n* [cypress-hyperapp-unit-test](https://github.com/bahmutov/cypress-hyperapp-unit-test)\n* [cypress-angularjs-unit-test](https://github.com/bahmutov/cypress-angularjs-unit-test)\n\n### Small print\n\nAuthor: Gleb Bahmutov \u0026lt;gleb.bahmutov@gmail.com\u0026gt; \u0026copy; 2018\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/cypress-angularjs-unit-test/issues) on Github\n\n## MIT License\n\nCopyright (c) 2018 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/cypress-angularjs-unit-test.svg?downloads=true\n[npm-url]: https://npmjs.org/package/cypress-angularjs-unit-test\n[ci-image]: https://travis-ci.org/bahmutov/cypress-angularjs-unit-test.svg?branch=master\n[ci-url]: https://travis-ci.org/bahmutov/cypress-angularjs-unit-test\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%2Fcypress-angularjs-unit-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbahmutov%2Fcypress-angularjs-unit-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbahmutov%2Fcypress-angularjs-unit-test/lists"}