Questions tagged [ava]

AVA is a fast and simple JavaScript test runner with builtin support for ES2015.

Links

Description

Even though JavaScript is single-threaded, IO in Node.js can happen in parallel due to its async nature. AVA takes advantage of this and runs your tests concurrently, which is especially beneficial for IO heavy tests. In addition, test files are run in parallel as separate processes, giving you even better performance and an isolated environment for each test file.

Highlights

  • Minimal and fast
  • Simple test syntax
  • Runs tests concurrently
  • Enforces writing atomic tests
  • No implicit globals
  • Isolated environment for each test file
  • Write your tests in ES2015
  • Promise support
  • Generator function support
  • Async function support
  • Observable support
  • Enhanced asserts
  • Optional TAP output
  • Clean stack traces

Example test syntax

import test from 'ava';

test(t => {
    t.is(foo(), 'foo');
});
209 questions
0
votes
2 answers

nyc coveralls integration not working

I try to make nyc working with coveralls following the instruction: https://github.com/istanbuljs/nyc#integrating-with-coveralls But I can't get it to work. Here is an example repo: https://github.com/unional/showdown-highlightjs-extension Travis…
unional
  • 14,651
  • 5
  • 32
  • 56
0
votes
1 answer

How can I use Mocha without removing Ava?

One of my co-workers added this Ava package to our setup, and it's done something I've never seen a Node package do before: interfere with other packages! Now when I try to run Mocha I get: $ node_modules/mocha/bin/mocha test/ Test files must be…
machineghost
  • 33,529
  • 30
  • 159
  • 234
0
votes
1 answer

Testing a MySQL INSERT result with Node.js/Sinon

My application code to test: create(params) { let result = {}; try { result = await this.db.query('/* some query */'); } catch (e) { throw new Error('Error creating User', e); } return this._getById(result.insertId); } I have the…
benhowdle89
  • 36,900
  • 69
  • 202
  • 331
0
votes
1 answer

ava test runner write EPIPE and ECONNRESET errors

I'm getting errors when using the ava test runner. For code: test('gets account by ID with includes', async t => { const c = new Client('http://localhost:8000/v2/', token); const included = await c.account.get('2001', ['foo']).then(res =>…
Harry Moreno
  • 10,231
  • 7
  • 64
  • 116
0
votes
1 answer

.env do not work with AVA

I'm receiving the following error, when I try to run my tests using ava with my project that uses dotenv-safe { [Error: ENOENT: no such file or directory, open '.env'] errno: -2, code: 'ENOENT', syscall: 'open', path: '.env' } fs.js:549 return…
Sibelius Seraphini
  • 5,303
  • 9
  • 34
  • 55
0
votes
1 answer

Acces to global namespace with ava testing

I'm using "ava" framework for react testing, here is a piece of package.json: "babel": { "presets": [ "es2015", "stage-2", "react" ] }, "ava": { "babel": "inherit", "require": [ "babel-register" ] …
Foker
  • 944
  • 2
  • 9
  • 22
-1
votes
1 answer

How to include before/after hooks in test report with AVA?

I have the following test.js file: const test = require("ava"); test.before("foo", t => { someSetupThatMightThrow(); }); test("bar", t => { t.pass(); }); test.after("baz", t => { someTeardownThatMightThrow(); }); After running ava…
Pedro A
  • 3,989
  • 3
  • 32
  • 56
-1
votes
1 answer

Ava testing is not working with vue single file components

Issue is the following. I try to setup "ava" testing for vuejs. I can't test directly, cause it is impossible to test single file components. Have found the following instruction: https://www.npmjs.com/package/vue-node Created helper…
ILya
  • 121
  • 1
  • 3
  • 14
-1
votes
1 answer

What is the difference between ava and ava-tf

I found that there are two packages ava and ava-tf. But I didn't find and description how they differ.
Sergiy Seletskyy
  • 16,236
  • 7
  • 69
  • 80
-1
votes
1 answer

Ava doesn't know to import .jsx dependencies from source files used in tests

I have the following ava config in my package.json: { "ava": { "require": [ "./tests/helpers/setup-browser-env.js", "./tests/helpers/module-stubber.js", "babel-register" ], "babel": { "presets": [ …
Andrei CACIO
  • 2,101
  • 15
  • 28
-1
votes
1 answer

assert true if method has been called using avajs

I am trying to create a unit test using react,ava, etc..I am having issue creating a simple unit test to check if a method was called. My test should pass if the method has been called. However when i check the code coverage I get a message saying…
zeid10
  • 511
  • 8
  • 28
-1
votes
1 answer

Possible to run AVA tests inside a node server?

I want users to submit code and run tests against that code using AVA. The AVA CLI seems great. But this would be running in a hosted environment like Heroku and need to respond back to the POST request containing the code submission with the…
at.
  • 50,922
  • 104
  • 292
  • 461
-1
votes
1 answer

AVA Unit Test: Use gulp-ava to test global functions

I'm new on using AVA for JS unit tests and I immediately hit a rock: My situation is that I want to run a gulp task to run the AVA tests and watch the test files, and in the test file I wrote I need to include the js file that contains the code to…
J. Doe
  • 1
  • 1
-3
votes
1 answer

How to do unit testing with AVA?

I'm doing a website booking of coffee-shop for my studies, and I need to do unit test for the front and the back. For the front I'm doing test with AVA but I NEVER doing test in my life and I don't know what I need to do. My final examination is…
1 2 3
13
14