codelenny / ava-test-style Goto Github PK
View Code? Open in Web Editor NEW:book: AVA Test Style Guide
:book: AVA Test Style Guide
Tests may include some constant values in the file:
const test = require("ava");
const name = "bob";
test.beforeEach("create user", t => {
t.context.user = new User(name);
});
test("has name", t => {
const { user } = t.context;
t.is(user.getName(), name);
});
Running tests via NODE_PATH=. ava
allows tests to require source files by name, instead of using a local path.
As AVA test files are generally stored in different directories (at multiple levels), this can help standardize test files across the repository, and allow easier copy-pasting between test files.
Include a "Test Documentation" section outlining what styles of documentation are useful, and what isn't.
DO: Mention top-level test architecture (e.g. AVA) in the README.
DO: Mention test style (e.g. this guide) in the README.
DO: Call out local test resources that can help (e.g. prebuilt ConfigurableArbitrary
in the test directory) in the README.
DO: Assume that readers will scan through the dependencies in a file, and don't need any explanation about the library.
DON'T: List all test libraries/resources that are used in the repository (e.g. JSVerify, Lodash, etc.)
DO: Use test titles instead of comments.
DO: Explain lengthy or complex test architecture (in a block comment).
You may provide line-by-line comments in the test file describing the functionality of a test according to the repositories style guide for code. If you are providing these comments, write them well. Quickly written descriptions of functionality can hurt more than they help.
DO: Explain test architecture.
DON'T: Explain test implementation.
DO: Use AVA test description features (e.g. skip
, failing
) for specific purposes (describe)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.