AVA testing problems

Viewed 2253

I am trying to write a test using AVA but I can't seem to get it to work write. fn passes the callback function through all of my functions and calls it once it's done everything. My test is

import test from 'ava';
import fn from './index.js';

test('NonLiteral && Literal', function (t) {
  fn('test.txt', '', function (res) {
    console.log(res);
    t.is(res, '');
  });
});

The res is

This is a test
How is it going
So far!!!

but it is saying that my test is passing. I've been following this test. Here is the snippet I've been looking at

test('throwing a named function will report the to the console', function (t) {
    execCli('fixture/throw-named-function.js', function (err, stdout, stderr) {
        t.ok(err);
        t.match(stderr, /\[Function: fooFn]/);
        // TODO(jamestalmage)
        // t.ok(/1 uncaught exception[^s]/.test(stdout));
        t.end();
    });
});

Can someone explain to me what I am doing wrong?

1 Answers
Related