{"id":16143906,"url":"https://github.com/callumacrae/vue-test","last_synced_at":"2025-03-16T09:33:23.201Z","repository":{"id":65412457,"uuid":"66033924","full_name":"callumacrae/vue-test","owner":"callumacrae","description":":checkered_flag: DEPRECATED: Component testing for Vue.js","archived":false,"fork":false,"pushed_at":"2017-03-03T09:34:05.000Z","size":74,"stargazers_count":90,"open_issues_count":6,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-14T23:46:47.741Z","etag":null,"topics":["chai-plugin","testing","unit-testing","vue"],"latest_commit_sha":null,"homepage":"","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/callumacrae.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}},"created_at":"2016-08-18T22:10:21.000Z","updated_at":"2023-09-04T16:34:49.000Z","dependencies_parsed_at":"2023-01-22T08:05:36.724Z","dependency_job_id":null,"html_url":"https://github.com/callumacrae/vue-test","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/callumacrae%2Fvue-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/callumacrae%2Fvue-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/callumacrae%2Fvue-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/callumacrae%2Fvue-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/callumacrae","download_url":"https://codeload.github.com/callumacrae/vue-test/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243809844,"owners_count":20351406,"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":["chai-plugin","testing","unit-testing","vue"],"created_at":"2024-10-10T00:10:35.234Z","updated_at":"2025-03-16T09:33:22.771Z","avatar_url":"https://github.com/callumacrae.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vue-test [![Build Status](https://travis-ci.org/callumacrae/vue-test.svg?branch=master)](https://travis-ci.org/callumacrae/vue-test)\n\n\u003e Component testing utilities for Vue.js (work with both Vue 1 and 2)\n\n## Installation\n\n```\n$ npm install --save-dev vue-test\n```\n\n## Usage\n\nThe library is divided into two parts: the `mount()` function and the chai\nassertion library plugin. The `mount()` function is used for mounting components\nin your tests without having to directly interact with the DOM, and the chai\nplugin can be used to write readable tests with understandable output for\nmounted Vue components.\n\n\u003e NOTE: vue-test requires the **full** version of Vue (which includes the compiler).  Make sure your build configuration for testing aliases `vue` properly.  For example (webpack 2):\n\n```javascript\n{\n  resolve: {\n    alias: {\n      'vue$': 'vue/dist/vue.esm.js'\n    }\n  }\n}\n```\n\n### The `mount()` function\n\nThe `mount()` function takes two arguments, a Vue component, and some optional\nproperties, and returns a wrapped mounted component with some useful utility\nfunctions.\n\n```js\nimport { mount } from 'vue-test';\nimport Title from './Title.vue';\n\nconst mountedTitle = mount(Title, {\n  title: 'Hello world!'\n});\n\nmountedTitle.find('h1').text(); // Hello world!\n```\n\nCheck out [mount-api.md](docs/mount-api.md) for a full list of the available\nfunctions.\n\n\n### Chai plugin\n\nvue-test includes a chai plugin which you can use to test a component mounted\nwith the `mount()` function.\n\nHere's how you add it:\n\n```js\nimport { chaiPlugin } from 'vue-test';\nchai.use(chaiPlugin);\n```\n\nHere's a very quick overview of what you can do:\n\n- `expect(mountedComponent).to.be.ok`\n- `expect(mountedComponent).to.be.tag('p')`\n- `expect(mountedComponent).to.contain.tag('p')`\n- `expect(mountedComponent).to.match.selector('#id .class')`\n- `expect(mountedComponent).to.contain.selector('#id .class')`\n- `expect(mountedComponent).to.be.empty`\n- `expect(mountedComponent).to.have.className('alert')`\n- `expect(mountedComponent).to.have.value('input value')`\n- `expect(mountedComponent).to.have.text('some text')`\n- `expect(mountedComponent).to.contain.text('some text')`\n- `expect(mountedComponent).to.have.attribute('style')`\n- `expect(mountedComponent).to.have.attribute('style').that.equals('something')`\n\nIt's all pretty descriptive and understandable, but for full explanations, see\n[chai-plugin-api.md](docs/chai-plugin-api.md).\n\n### Contributing\n\nIf you feel something is missing or find a bug, feel free to send a PR or open\nan issue. If you haven't contributed to a project on GitHub before, feel free to\nask me for help and I can help you out :smile:\n\n### License\n\nThis project is released under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcallumacrae%2Fvue-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcallumacrae%2Fvue-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcallumacrae%2Fvue-test/lists"}