Skip to content

Commit 5e08444

Browse files
committed
Explicit and separate CJS and ESM entrypoints
Fixes #2671. AVA now only has a default export: the test() function.
1 parent cc4e622 commit 5e08444

File tree

147 files changed

+174
-206
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

147 files changed

+174
-206
lines changed

ava.config.cjs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// 👉 Due to the package exports, XO's use of our ESLint plugin loads this
2+
// file using the AVA code in the repository, but our self-hosted tests use the
3+
// installed "test-ava" version.
4+
module.exports = {
5+
files: ['test/**', '!test/**/{fixtures,helpers}/**'],
6+
ignoredByWatcher: ['{coverage,docs,media,test-d,test-tap}/**']
7+
};

ava.config.js

Lines changed: 0 additions & 4 deletions
This file was deleted.

cli.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

entrypoints/cli.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env node
2+
import * as cli from '../lib/cli.js'; // eslint-disable-line import/extensions
3+
cli.run();

eslint-plugin-helper.js renamed to entrypoints/eslint-plugin-helper.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
const v8 = require('v8');
33
const {Worker} = require('worker_threads');
44

5-
const {classify, hasExtension, isHelperish, matches, normalizeFileForMatching, normalizePatterns} = require('./lib/globs');
5+
const {classify, hasExtension, isHelperish, matches, normalizeFileForMatching, normalizePatterns} = require('../lib/globs');
66

77
const MAX_DATA_LENGTH_EXCLUSIVE = 100 * 1024; // Allocate 100 KiB to exchange globs.
88

entrypoints/main.cjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
'use strict';
2+
module.exports = require('../lib/worker/main');

entrypoints/main.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import test from '../lib/worker/main.js'; // eslint-disable-line import/extensions
2+
export default test;

entrypoints/plugin.cjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
'use strict';
2+
module.exports = require('../lib/worker/plugin');

entrypoints/plugin.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
'use strict';
2+
import * as plugin from '../lib/worker/plugin.js'; // eslint-disable-line import/extensions
3+
const {registerSharedWorker} = plugin;
4+
export {registerSharedWorker};

index.d.ts

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -683,33 +683,3 @@ declare const test: TestInterface;
683683

684684
/** Call to declare a test, or chain to declare hooks or test modifiers */
685685
export default test;
686-
687-
/** Call to declare a hook that is run once, after all tests have passed, or chain to declare modifiers. */
688-
export const after: AfterInterface;
689-
690-
/** Call to declare a hook that is run after each passing test, or chain to declare modifiers. */
691-
export const afterEach: AfterInterface;
692-
693-
/** Call to declare a hook that is run once, before all tests, or chain to declare modifiers. */
694-
export const before: BeforeInterface;
695-
696-
/** Call to declare a hook that is run before each test, or chain to declare modifiers. */
697-
export const beforeEach: BeforeInterface;
698-
699-
/** Call to declare a test that is expected to fail, or chain to declare modifiers. */
700-
export const failing: FailingInterface;
701-
702-
/** Call to declare a test that is run exclusively, along with other tests declared with `.only()`. */
703-
export const only: OnlyInterface;
704-
705-
/** Call to declare a serial test, or chain to declare serial hooks or test modifiers. */
706-
export const serial: SerialInterface;
707-
708-
/** Skip this test. */
709-
export const skip: SkipInterface;
710-
711-
/** Declare a test that should be implemented later. */
712-
export const todo: TodoDeclaration;
713-
714-
/** Meta data associated with the current process. */
715-
export const meta: MetaInterface;

0 commit comments

Comments
 (0)