12345678910111213141516171819202122 |
- 'use strict';
- const runner = require('./subprocess').getRunner();
- const makeCjsExport = () => {
- function test() {
- return runner.chain.apply(null, arguments);
- }
- return Object.assign(test, runner.chain);
- };
- // Support CommonJS modules by exporting a test function that can be fully
- // chained. Also support ES module loaders by exporting __esModule and a
- // default. Support `import * as ava from 'ava'` use cases by exporting a
- // `test` member. Do all this whilst preventing `test.test.test() or
- // `test.default.test()` chains, though in CommonJS `test.test()` is
- // unavoidable.
- module.exports = Object.assign(makeCjsExport(), {
- __esModule: true,
- default: runner.chain,
- test: runner.chain
- });
|