How to use the ava.failing function in ava

To help you get started, we’ve selected a few ava examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github freaktechnik / justintv-stream-notifications / test / background / channel / controller.js View on Github external
}
    }
    else {
        await t.throwsAsync(cc.autoAddUsers(p));
    }
};
testProviderCredentials.title = (title, p) => `${title} for ${p}`;

for(const p in providers) {
    if(!IGNORE_QSUPDATE_PROVIDERS.includes(p)) {
        if(p != TESTUSER.type) {
            test('Provider credentials', testProviderCredentials, p);
        }
        else {
            // needs to be serial when not failing
            test.failing('Provider credentials', testProviderCredentials, p);
        }
    }
}

// needs to be serial when not failing
test.serial.failing("Credentials", async (t) => {
    const cc = new ChannelController();

    const prom = cc.autoAddUsers();

    const res = await prom;
    t.true(res.some((r) => r.length > 0), "All credentials finds some");

    const users = await cc.getUsersByType();
    return Promise.all(users.map((u) => cc.removeUser(u.id, true)));
});
github xojs / xo / test / cli-main.js View on Github external
});

test('overrides work with relative path starting with `./`', async t => {
	const cwd = path.join(__dirname, 'fixtures/overrides');
	const file = '.' + path.sep + path.join('test', 'bar.js');
	await t.notThrowsAsync(main([file], {cwd}));
});

test('overrides work with absolute path', async t => {
	const cwd = path.join(__dirname, 'fixtures/overrides');
	const file = path.join(cwd, 'test', 'bar.js');
	await t.notThrowsAsync(main([file], {cwd}));
});

// #65
test.failing('ignores fixture', async t => {
	const cwd = path.join(__dirname, 'fixtures/ignores');
	await t.throwsAsync(main([], {cwd}));
});

test('ignore files in .gitignore', async t => {
	const cwd = path.join(__dirname, 'fixtures/gitignore');
	const error = await t.throwsAsync(main(['--reporter=json'], {cwd}));
	const reports = JSON.parse(error.stdout);
	const files = reports
		.map(report => path.relative(cwd, report.filePath))
		.map(report => slash(report));
	t.deepEqual(files, ['index.js', 'test/bar.js']);
});

test('ignore explicit files when in .gitgnore', async t => {
	const cwd = path.join(__dirname, 'fixtures/gitignore');
github freaktechnik / justintv-stream-notifications / test / background / parental-controls.js View on Github external
/**
 * @author Martin Giger
 * @license MPL-2.0
 */
import test from 'ava';
import ParentalControls from "../../src/background/parental-controls";

test.failing("Enabled", async (t) => {
    await ParentalControls.p;

    t.false(ParentalControls.enabled, "Parental controls state is correct");

    // Clean up async promise queue
    await ParentalControls.p;

    t.true(ParentalControls.enabled, "PC is enabled");
});
github superchargejs / framework / testing / drivers / ava.js View on Github external
failing (name) {
    /* istanbul ignore next */
    Ava.failing(name, async t => this.test[name](t))
  }
}
github doesdev / rollup-plugin-analyzer / test / index.js View on Github external
test(`${version}: root works as expected`, async (assert) => {
    let bundle = await rollup(opts)
    init({root: 'fakepath'})
    assert.not(
      join(__dirname, (await analyze(bundle))[0].id),
      resolve(fixtures, 'import-a.js')
    )
    init({root: __dirname})
    assert.is(
      join(__dirname, (await analyze(bundle))[0].id),
      resolve(fixtures, 'import-a.js')
    )
    init({root: undefined})
  })

  test.failing(`${version}: tree shaking is accounted for`, async (assert) => {
    let bundle = await rollup(opts)
    let results = await analyze(bundle)
    let imported = results.find((r) => r.id.match('importme'))
    assert.is(imported.size, 4)
  })
})
github vadimdemedes / ink / test / h.js View on Github external
});

test('don\'t merge children that are boolean', t => {
	const node = h('span', null, [
		null,
		'one',
		true,
		'two',
		false,
		'three'
	]);

	t.deepEqual(node.props.children, ['onetwothree']);
});

test.failing('don\'t merge children of components', t => {
	const Component = ({children}) => children;
	const node = h(Component, null, 'x', 'y');

	t.deepEqual(node.props.children, ['x', 'y']);
});
github postcss / postcss-cli / test / error.js View on Github external
t.is(code, 1, 'expected non-zero error code')
    t.regex(error.toString(), /Input Error: Must use --dir or --replace/)
  })
})

test('--map && writing to stdout', t => {
  return cli(['test/fixtures/a.css', '--map']).then(({ error, code }) => {
    t.is(code, 1, 'expected non-zero error code')
    t.regex(
      error.toString(),
      /Output Error: Cannot output external sourcemaps when writing to STDOUT/
    )
  })
})

test.failing('invalid --config', t => {
  return cli([
    'test/fixtures/*.css',
    '-c',
    'test/postcss.config.js',
    '-d',
    tmp()
  ]).then(({ error, code }) => {
    t.is(code, 1, 'expected non-zero error code')
    t.regex(error.toString(), /ENOENT: no such file or directory/)
  })
})

test('plugin not found', t => {
  return cli(['test/fixtures/a.css', '-u', 'postcss-plugin', '-o', tmp()]).then(
    ({ error, code }) => {
      t.is(code, 1, 'expected non-zero error code')
github vadimdemedes / ink / test / width-height.js View on Github external
);

	t.is(smallerOutput, 'A    B');

	const largerOutput = renderToString(
		
			AAAAA
			B
		
	);

	t.is(largerOutput, 'AAAAAB');
});

test.failing('set min width in percent', t => {
	const output = renderToString(
		
			A
			B
		
	);

	t.is(output, 'A    B');
});

test('set height', t => {
	const output = renderToString(
		
			A
			B
github Hypercubed / chuhai / test / fixtures / ava / slice.js View on Github external
s.bench('Array.prototype.slice', () => {
      args = Array.prototype.slice.call(arr, 1);
    });

    s.bench('for loop', () => {
      const l = arr.length;
      args = new Array(l - 1);
      for (let i = 0; i < l; i++) {
        args[i - 1] = arr[i];
      }
    });
  });
});

test.failing('array slice - demonstrate an error', t => {
  return suite('array slice - demonstrate an error', s => {
    s.set('maxTime', 0.01);
    s.set('minSamples', 10);

    const arr = [1, 2, 3, 4, 5, 6];
    let args = null;

    s.after(() => {
      t.deepEqual(arr, [1, 2, 3, 4, 5, 6]);
    });

    s.bench('Array.prototype.slice', () => {
      args = Array.prototype.slice.call(arr, 1);
    });

    s.bench('for loop', () => {
github Hypercubed / chuhai / test / fixtures / ava / loop.js View on Github external
t.bench('for i in foo', () => {
    s = 0;
    for (const i in arr) {
      s += arr[i];
    }
  });

  t.bench('for count', () => {
    s = 0;
    for (let i = 1; i < arr.length; i++) {
      s += arr[i];
    }
  });
});

test.failing('array loop - demonstrate error', suite.macro, t => {
  t.set('maxTime', 0.01);
  t.set('minSamples', 10);

  const arr = [1, 2, 3, 4, 5, 6];
  let s = null;

  t.burn('max', () => {
    s = 0;
    s += 1;
    s += 2;
    s += 3;
    s += 4;
    s += 5;
    s += 6;
  });