All Projects → andywer → Ava Ts

andywer / Ava Ts

Licence: mit
🚀 Fork of the AVA test runner with native typescript support

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects

Projects that are alternatives of or similar to Ava Ts

Ava
Node.js test runner that lets you develop with confidence 🚀
Stars: ✭ 19,458 (+16968.42%)
Mutual labels:  test-runner, tap, ava
Zunit
A powerful testing framework for ZSH projects
Stars: ✭ 140 (+22.81%)
Mutual labels:  test-runner, tap
Istanbuljs
monorepo containing the various nuts and bolts that facilitate istanbul.js test instrumentation
Stars: ✭ 656 (+475.44%)
Mutual labels:  tap, ava
quasar-testing
Testing Harness App Extensions for the Quasar Framework 1.0+
Stars: ✭ 142 (+24.56%)
Mutual labels:  test-runner, ava
Baretest
An extremely fast and simple JavaScript test runner.
Stars: ✭ 364 (+219.3%)
Mutual labels:  test-runner, tap
Enzyme
JavaScript Testing utilities for React
Stars: ✭ 19,781 (+17251.75%)
Mutual labels:  test-runner, ava
tropic
🍍 Test Runner Library
Stars: ✭ 29 (-74.56%)
Mutual labels:  tap, test-runner
Awesome Tap
Useful resources for the Test Anything Protocol
Stars: ✭ 543 (+376.32%)
Mutual labels:  test-runner, tap
Public
Repository for wallaby.js questions and issues
Stars: ✭ 662 (+480.7%)
Mutual labels:  test-runner, ava
Jtap
Tap Event for jQuery
Stars: ✭ 65 (-42.98%)
Mutual labels:  tap
Atom Ava
Snippets for AVA and run tests directly in the editor
Stars: ✭ 96 (-15.79%)
Mutual labels:  ava
Mongomem
In-memory MongoDB Server. Ideal for testing.
Stars: ✭ 51 (-55.26%)
Mutual labels:  ava
Meissa
Cross-platform Distributed Test Runner. Executes tests in parallel, time balanced on multiple machines.
Stars: ✭ 66 (-42.11%)
Mutual labels:  test-runner
Ninos
Simple stubbing/spying for AVA
Stars: ✭ 99 (-13.16%)
Mutual labels:  ava
Suman
🌇 🌆 🌉 Advanced, user-friendly, language-agnostic, super-high-performance test runner. http://sumanjs.org
Stars: ✭ 57 (-50%)
Mutual labels:  ava
Cucable Plugin
Maven plugin that simplifies running Cucumber Scenarios in parallel.
Stars: ✭ 110 (-3.51%)
Mutual labels:  test-runner
Sublime Ava
Snippets for AVA
Stars: ✭ 41 (-64.04%)
Mutual labels:  ava
Tap Hubspot
Stars: ✭ 34 (-70.18%)
Mutual labels:  tap
Aesthetics
Image Aesthetics Toolkit - includes Fisher Vector implementation, AVA (Image Aesthetic Visual Analysis) dataset and fast multi-threaded downloader
Stars: ✭ 113 (-0.88%)
Mutual labels:  ava
Libtuntap
The portable Tun/Tap devices configuration utility
Stars: ✭ 107 (-6.14%)
Mutual labels:  tap

AVA-TS

Build Status NPM Version

Native TypeScript support for sindresorhus' awesome AVA test runner out of the box, without a prior build step.

🚀 Zero-configuration setup
⏩ Parallel test execution
🖼 Snapshot testing
📈 All your favorite reporters

This is a fork of the official AVA repository with a couple of minimally invasive changes. Uses ts-node/register instead of Babel. Not the cleanest solution, but it works well.

Installation

npm install --save-dev ava-ts ava ts-node

# Using yarn:
yarn add --dev ava-ts ava ts-node

Usage

Write your tests in TypeScript as you would usually do and import from ava, not from ava-ts, just as you would always do.

// test.ts

import test from 'ava'

test('one plus two equals three', t => {
  t.is(1 + 2, 3)
})

Instead of running ava, just run the ava-ts CLI tool instead. That's it!

It will use all the same options and defaults you know from AVA, but searches for *.ts files instead of *.js.

$ ava-ts --help

  Fork of the AVA test runner with native typescript support 🚀

  Usage
    ava-ts [<file|directory|glob> ...]

  Options
    --init                  Add AVA to your project
    --fail-fast             Stop after first test failure
    --serial, -s            Run tests serially
    --tap, -t               Generate TAP output
    --verbose, -v           Enable verbose output
    --color                 Force color output
    --no-color              Disable color output
    --match, -m             Only run tests with matching title (Can be repeated)
    --watch, -w             Re-run tests when tests and source files change
    --timeout, -T           Set global timeout
    --concurrency, -c       Max number of test files running at the same time (Default: CPU cores)
    --update-snapshots, -u  Update snapshots

  Examples
    ava-ts
    ava-ts test.ts test2.ts
    ava-ts test-*.ts
    ava-ts test
    ava-ts --init
    ava-ts --init foo.ts

  Default patterns when no arguments:
  test.ts test.tsx test-*.ts test-*.tsx test/**/*.ts test/**/*.tsx **/__tests__/**/*.ts **/__tests__/**/*.tsx **/*.test.ts **/*.test.tsx

Documentation

See AVA's official docs for detailed information.

test.before() registers a hook to be run before the first test in your test file. Similarly test.after() registers a hook to be run after the last test. Use test.after.always() to register a hook that will always run once your tests and other hooks complete. .always() hooks run regardless of whether there were earlier failures or if all tests were skipped, so they are ideal for cleanup tasks. There are two exceptions to this however. If you use --fail-fast AVA will stop testing as soon as a failure occurs, and it won't run any hooks including the .always() hooks. Uncaught exceptions will crash your tests, possibly preventing .always() hooks from running. If a test is skipped with the .skip modifier, the respective .beforeEach() and .afterEach() hooks are not run. Likewise, if all tests in a test file are skipped .before() and .after() hooks for the file are not run. Hooks modified with .always() will always run, even if all tests are skipped.

Limitations

There are a few limitations compared to the original ava CLI.

  • No babel support
  • No power assert

Frequently Asked Questions

How to use AVA-TS when the module compiler option is set to ES6 modules?

Especially when working with bundlers like webpack you will encounter this issue. Fortunately, there is a simple fix to make TypeScript emit node-style modules when running AVA-TS:

TS_NODE_COMPILER_OPTIONS='{"module":"commonjs"}' ava-ts

On Windows:

set TS_NODE_COMPILER_OPTIONS={\"module\":\"commonjs\"} && ava-ts

If you feel this use case needs to be improved, complain in #5 😉

License

MIT. The fork as well as the original. AVA is a project of always awesome Sindre Sorhus.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].