Skip to content

Commit 5a9a627

Browse files
committed
Make test-types work with tsc and XO
This used to work… but didn't for the new timout tests.
1 parent 6ca0f1c commit 5a9a627

23 files changed

+35
-28
lines changed
File renamed without changes.
File renamed without changes.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"exports": {
1212
".": {
1313
"import": {
14-
"types": "./entrypoints/main.d.ts",
14+
"types": "./entrypoints/main.d.mts",
1515
"default": "./entrypoints/main.mjs"
1616
},
1717
"require": {
@@ -22,7 +22,7 @@
2222
"./eslint-plugin-helper": "./entrypoints/eslint-plugin-helper.cjs",
2323
"./plugin": {
2424
"import": {
25-
"types": "./entrypoints/plugin.d.ts",
25+
"types": "./entrypoints/plugin.d.mts",
2626
"default": "./entrypoints/plugin.mjs"
2727
},
2828
"require": {

test-types/import-in-cts/assertions-as-type-guards.cts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import test from 'ava';
1+
import test from '../../entrypoints/main.cjs';
22
import {expectType} from 'tsd';
33

44
type Expected = {foo: 'bar'};

test-types/import-in-cts/context.cts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable @typescript-eslint/no-empty-function */
2-
import anyTest, {ExecutionContext, TestFn} from 'ava';
2+
import anyTest, {ExecutionContext, TestFn} from '../../entrypoints/main.cjs';
33
import {expectError, expectType} from 'tsd';
44

55
interface Context {

test-types/import-in-cts/deep-equal.cts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import test from 'ava';
1+
import test from '../../entrypoints/main.cjs';
22
import {expectType} from 'tsd';
33

44
test('actual extends expected', t => {

test-types/import-in-cts/implementation-result.cts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable @typescript-eslint/no-empty-function */
2-
import test from 'ava';
2+
import test from '../../entrypoints/main.cjs';
33

44
test.after('return anything else', _t => ({
55
foo: 'bar',

test-types/import-in-cts/like.cts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import test from 'ava';
1+
import test from '../../entrypoints/main.cjs';
22

33
test('like', t => {
44
t.like({

test-types/import-in-cts/macros.cts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable no-lone-blocks */
2-
import test, {ExecutionContext} from 'ava';
2+
import test, {ExecutionContext} from '../../entrypoints/main.cjs';
33
import {expectType} from 'tsd';
44

55
// Typed arguments through generics.

test-types/import-in-cts/snapshot.cts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import test from 'ava';
1+
import test from '../../entrypoints/main.cjs';
22
import {expectError} from 'tsd';
33

44
test('snapshot', t => {

test-types/import-in-cts/teardown.cts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import test from 'ava';
1+
import test from '../../entrypoints/main.cjs';
22

33
test('test', t => {
44
t.teardown(() => {}); // eslint-disable-line @typescript-eslint/no-empty-function

test-types/import-in-cts/throws.cts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable @typescript-eslint/no-empty-function */
2-
import test from 'ava';
2+
import test from '../../entrypoints/main.cjs';
33
import {expectType} from 'tsd';
44

55
class CustomError extends Error {

test-types/import-in-cts/try-commit.cts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import test, {ExecutionContext} from 'ava';
1+
import test, {ExecutionContext} from '../../entrypoints/main.cjs';
22
import {expectType} from 'tsd';
33

44
test('attempt', async t => {

test-types/module/assertions-as-type-guards.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import test from 'ava';
21
import {expectType} from 'tsd';
32

3+
import test from '../../entrypoints/main.mjs';
4+
45
type Expected = {foo: 'bar'};
56
const expected: Expected = {foo: 'bar'};
67

test-types/module/context.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
/* eslint-disable @typescript-eslint/no-empty-function */
2-
import type {ExecutionContext, TestFn} from 'ava';
3-
import anyTest from 'ava';
42
import {expectError, expectType} from 'tsd';
53

4+
import type {ExecutionContext, TestFn} from '../../entrypoints/main.mjs';
5+
import anyTest from '../../entrypoints/main.mjs';
6+
67
type Context = {
78
foo: string;
89
};

test-types/module/deep-equal.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import test from 'ava';
21
import {expectType} from 'tsd';
32

3+
import test from '../../entrypoints/main.mjs';
4+
45
test('actual extends expected', t => {
56
type Expected = {foo: [1, 2, 3]};
67
const expected: Expected = {foo: [1, 2, 3]};

test-types/module/implementation-result.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable @typescript-eslint/no-empty-function */
2-
import test from 'ava';
2+
import test from '../../entrypoints/main.mjs';
33

44
test.after('return anything else', _t => ({
55
foo: 'bar',

test-types/module/like.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import test from 'ava';
1+
import test from '../../entrypoints/main.mjs';
22

33
test('like', t => {
44
t.like({

test-types/module/macros.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import type {ExecutionContext} from 'ava';
2-
import test from 'ava';
31
import {expectType} from 'tsd';
42

3+
import type {ExecutionContext} from '../../entrypoints/main.mjs';
4+
import test from '../../entrypoints/main.mjs';
5+
56
// Typed arguments through generics.
67
{
78
const hasLength = test.macro<[string, number]>((t, input, expected) => {
@@ -118,7 +119,7 @@ test('has length 3 (inferred)', (t, input, expected) => {
118119
t.is(input, expected);
119120
}, 'foo', 3);
120121

121-
test.skip('skip', (t, input, expected) => { // eslint-disable-line ava/no-skip-test
122+
test.skip('skip', (t, input, expected) => {
122123
expectType<string>(input);
123124
expectType<number>(expected);
124125
// @ts-expect-error TS2345

test-types/module/snapshot.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import test from 'ava';
21
import {expectError} from 'tsd';
32

3+
import test from '../../entrypoints/main.mjs';
4+
45
test('snapshot', t => {
56
t.snapshot({foo: 'bar'});
67
t.snapshot(null, 'a snapshot with a message');

test-types/module/teardown.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import test from 'ava';
1+
import test from '../../entrypoints/main.mjs';
22

33
test('test', t => {
44
t.teardown(() => {}); // eslint-disable-line @typescript-eslint/no-empty-function

test-types/module/throws.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
/* eslint-disable @typescript-eslint/no-empty-function */
2-
import test from 'ava';
32
import {expectType} from 'tsd';
43

4+
import test from '../../entrypoints/main.mjs';
5+
56
class CustomError extends Error {
67
foo: string;
78

test-types/module/try-commit.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import type {ExecutionContext} from 'ava';
2-
import test from 'ava';
31
import {expectType} from 'tsd';
42

3+
import type {ExecutionContext} from '../../entrypoints/main.mjs';
4+
import test from '../../entrypoints/main.mjs';
5+
56
test('attempt', async t => {
67
const attempt = await t.try(
78
(u, a, b) => {
@@ -55,11 +56,11 @@ test('all possible variants to pass to t.try', async t => {
5556
void t.try('test', (tt, a, b) => tt.is(a.length, b), 'hello', 5);
5657

5758
// Macro with title
58-
const macro1 = test.macro<[string, number]>({ // eslint-disable-line ava/no-nested-tests
59+
const macro1 = test.macro<[string, number]>({
5960
exec: (tt, a, b) => tt.is(a.length, b),
6061
title: (title, a, b) => `${title ? `${String(title)} ` : ''}str: "${String(a)}" with len: "${String(b)}"`,
6162
});
62-
const macro2 = test.macro<[string, number]>((tt, a, b) => { // eslint-disable-line ava/no-nested-tests
63+
const macro2 = test.macro<[string, number]>((tt, a, b) => {
6364
tt.is(a.slice(b), '');
6465
});
6566

0 commit comments

Comments
 (0)