explanations
examples
stories
clarifications
what-ifs
code
experiment
one-on-one help
please clone it now
(no need to copy down code examples)
(for the privacy of participants)
great tooling can not only catch typos and potential errors, but also teach new features as developers need them
Faster reviews, more learning, more motivating
when developers feel cared for by their tooling, they take more pride in their work and write better code
people get excited when they see a great architecture laid out
when trainees review doc PRs, training is made reusable
module.exports = {
'*.{js,jsx}': [
'eslint --fix',
'prettier --write',
'git add',
'jest --bail --findRelatedTests',
],
'*.json': ['prettier --write', 'git add'],
'*.vue': [
'eslint --fix',
'stylelint --fix',
'prettier --write',
'git add',
'jest --no-cache --bail --findRelatedTests',
],
'*.scss': ['stylelint --fix', 'prettier --write', 'git add'],
'*.md': ['markdownlint', 'prettier --write', 'git add'],
'*.{png,jpeg,jpg,gif,svg}': ['imagemin-lint-staged', 'git add'],
}
speed up development and simplify refactors
e.g. automatically generate a unit test with each module
if (process.env.NODE_ENV !== 'production') {
Vue.mixin({
// Use lifecycle hooks to scan components for
// patterns that should be avoided.
})
}
Add one linter to your app, run with a lint command in package.json.
Use lint-staged to either lint or run unit tests against staged files (or both).
Add a meta validation to a component that your team has previously misused.
we stop writing and running tests when they're NOT
Everyone knows when
tests are failing
Tests don't fail intermittently
Tests run quickly
When a test fails,
it's easy to learn why
they should be able to run with it.only
manually manipulate your app instead
think from the user's perspective, or select elements by intent
yarn dev:e2e in the boilerplate
Develop a small new feature using test-driven development with yarn dev:e2e. That means:
First write the test
Then develop the feature
Follow these instructions to integrate Cypress into your app.
Refactor a test targeting classes to use content or data-testid instead.
Set up Circle CI for your app, including e2e tests.
(currently in beta)
to full test a component's interface
including shallow rendering, to avoid testing subcomponents
uses JSDOM to simulate the browser
aliases, dynamic imports, etc require additional config
e.g. asserting that a data, computed, etc property exists
it's easier to add a new test when the file already exists
big components often scare people, so they go untested
otherwise, a problem in a common component can breaks many tests
run unit tests against staged files on a pre-commit hook
make sure you know when tests are failing
create helpers and custom matchers to simplify complex assertions
(e.g. hello.vue and hello.unit.js)
Refactor an existing component test to use Vue Test Utils (try the shallow render).
Delete a test that confirms Vue works.
Refactor your unit tests to be side-by-side with your source files.