-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a mostly hidden test.default that provides test
Our type definition uses ESM syntax; when using CJS with VSCode, the auto-completion assumes the root is accessed through `require('ava').default`. Placate VSCode by adding a mostly hidden default property on the root. This is available through both CJS and ESM imports. We use a proxy so that we don't end up with root.default.default.default chains. Fixes #2539.
- Loading branch information
1 parent
87929b4
commit 8b25d05
Showing
4 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"ava": { | ||
"files": [ | ||
"*.cjs" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const test = require('ava'); | ||
|
||
test.default('callable', t => { // eslint-disable-line ava/no-unknown-modifiers | ||
t.pass(); | ||
}); | ||
|
||
test('no recursion', t => { | ||
t.throws(() => test.default.default, { | ||
name: 'TypeError', | ||
}); | ||
}); | ||
|
||
test('not enumerable', t => { | ||
t.false(Object.keys(test).includes('default')); | ||
}); | ||
|
||
test('main export equals the ESM export', async t => { | ||
t.is(test, (await import('ava')).default); // eslint-disable-line node/no-unsupported-features/es-syntax | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import test from '@ava/test'; | ||
|
||
import {fixture} from '../helpers/exec.js'; | ||
|
||
test('ok', async t => { | ||
await t.notThrowsAsync(fixture()); | ||
}); |