Hi! I’m really excited that you are interested in contributing to Vue Test Utils. Before submitting your contribution though, please make sure to take a moment and read through the following guidelines.
- Code of Conduct
- Issue Reporting Guidelines
- Pull Request Guidelines
- Development Setup
- Project Structure
- Always use https://new-issue.vuejs.org/ to create new issues.
-
The
master
branch is basically just a snapshot of the latest stable release. All development should be done in dedicated branches. Do not submit PRs against themaster
branch. -
Checkout a topic branch from the relevant branch, e.g.
dev
, and merge back against that branch. -
Work in the
src
folder and DO NOT checkindist
in the commits. -
It's OK to have multiple small commits as you work on the PR - we will let GitHub automatically squash it before merging.
-
Make sure
npm test
passes. (see development setup) -
If adding new feature:
- Add accompanying test case.
- Provide convincing reason to add this feature. Ideally you should open a suggestion issue first and have it greenlighted before working on it.
-
If fixing a bug:
- If you are resolving a special issue, add
(fix #xxxx[,#xxx])
(#xxxx is the issue id) in your PR title for a better release log, e.g.update entities encoding/decoding (fix #3899)
. - Provide detailed description of the bug in the PR. Live demo preferred.
- Add appropriate test coverage if applicable.
- If you are resolving a special issue, add
You will need Node.js version 6+
Vue Test Utils is a monorepo. It contains a root package.json for running scripts across the project. The code is inside separate packages in the packages
directory. The project uses lerna to manage the workspaces.
After cloning the repo, run:
$ yarn
Or with npm:
npm i && npm run bootstrap
# run unit tests with mocha-webpack
$ npm run test:unit
# run the full test suite, include linting / type checking
$ npm test
There are some other scripts available in the scripts
section of the package.json
file.
The default test script will do the following: lint with ESLint -> type check with Flow -> unit tests. Please make sure to have this pass successfully before submitting a PR. Although the same tests will be run against your PR on the CI server, it is better to have it working locally beforehand.
-
docs
: contains files used to generate https://vue-test-utils.vuejs.org/ with VuePress. -
flow
: contains type declarations for Flow. These declarations are loaded globally and you will see them used in type annotations in normal source code. -
packages
: contains thetest-utils
andserver-test-utils
public packages. Also contains private packagesshared
andcreate-instance
wich are used bytest-utils
andserver-test-utils
. The codebase is written in ES2015 with Flow type annotations.-
test-utils
: the @vue/test-utils package.dist
: contains built files for distribution. Note this directory is only updated when a release happens; they do not reflect the latest changes in development branches.
-
server-test-utils
: the @vue/server-test-utils packagedist
: contains built files for distribution. Note this directory is only updated when a release happens; they do not reflect the latest changes in development branches.
-
create-instance
: private package that creates an instance and applies mounting options. -
shared
: private package that contains utilities used by the other packages.
-
-
scripts
: contains build-related scripts and configuration files. In most cases you don't need to touch them. -
test
: contains all tests. The unit tests are written with Mocha and run with Karma and mocha-webpack, which compiles the code with webpack before running it in mocha. -
types
: contains TypeScript type definitionstest
: type definitions tests