UNPKG

678 BJavaScriptView Raw
1'use strict';
2const runner = require('./subprocess').getRunner();
3
4const makeCjsExport = () => {
5 function test(...args) {
6 return runner.chain(...args);
7 }
8
9 return Object.assign(test, runner.chain);
10};
11
12// Support CommonJS modules by exporting a test function that can be fully
13// chained. Also support ES module loaders by exporting __esModule and a
14// default. Support `import * as ava from 'ava'` use cases by exporting a
15// `test` member. Do all this whilst preventing `test.test.test() or
16// `test.default.test()` chains, though in CommonJS `test.test()` is
17// unavoidable.
18module.exports = Object.assign(makeCjsExport(), {
19 __esModule: true,
20 default: runner.chain
21});