Skip to content

Commit

Permalink
Fix test and bump AVA (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
zckrs committed Mar 5, 2024
1 parent c8d272b commit 5855d73
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^7.0.2",
"@typescript-eslint/parser": "^7.0.2",
"ava": "^2.4.0",
"ava": "^6.1.2",
"eslint": "^8.56.0",
"typescript": "^5.3.3"
},
Expand Down
12 changes: 7 additions & 5 deletions test/test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import test from 'ava';
import {ESLint} from 'eslint';
import config from '../index.js';
const test = require('ava');
const {ESLint} = require('eslint');

const config = require('../index.js');

const hasRule = (errors, ruleId) => errors.some(error => error.ruleId === ruleId);

Expand All @@ -10,12 +11,13 @@ async function runEslint(string, config) {
overrideConfig: config,
});

const [firstResult] = await eslint.lintText(string, {filePath: '_x.ts'});
const [firstResult] = await eslint.lintText(string, {filePath: 'test/_x.ts'});

return firstResult.messages;
}

test.failing('main', async t => {
test('main', async t => {
const errors = await runEslint('const foo: number = 5;', config);
t.true(hasRule(errors, '@typescript-eslint/no-inferrable-types'), JSON.stringify(errors));
t.is(errors.length, 1);
});
3 changes: 3 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"compilerOptions": {
"strict": true,
},
"include": [
"test"
]
Expand Down

0 comments on commit 5855d73

Please sign in to comment.