Coder Social home page Coder Social logo

ava-test-style's People

Contributors

codelenny avatar

Watchers

 avatar  avatar

ava-test-style's Issues

Add test 'constants'

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);
});
  • Add to the "Test File Structure" list
  • Add description to a section under "Test File Structure"
  • See if it should be included in some of the test file examples in the README.

Mention 'NODE_PATH'

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.

  • Create a section in the README
    • (probably near the start of the file)
    • describe these benefits
    • explain how to set up the test files
  • Include in the highlights?

Document how to document tests

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.