Skip to content

Commit 4082a74

Browse files
committed
tests: update tests to use updated ESLint
1 parent f6e7dd5 commit 4082a74

File tree

1 file changed

+16
-22
lines changed

1 file changed

+16
-22
lines changed

test.js

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,24 @@
11
const assert = require('assert');
2-
const Engine = require('eslint').CLIEngine;
2+
const { ESLint } = require("eslint");
33

4-
const cli = new Engine({
5-
configFile: 'index.js',
4+
const cli = new ESLint({
5+
overrideConfigFile: 'index.js',
66
});
77

8-
const lint = text => cli.executeOnText(text);
8+
const lint = text => cli.lintText(text);
99

10-
describe('Non-react JS', function() {
11-
it('Will pass', function() {
12-
const test = lint(`
13-
const foo = 'foo';
14-
window.location(foo);\n`);
15-
16-
const message = test.errorCount > 0 && test.results[0].messages[0].message;
17-
18-
assert.equal(test.errorCount, 0, message);
10+
describe('Non-react JS', function () {
11+
it('Will pass', async function () {
12+
const test = await lint(`const foo = 'foo'; window.location(foo);\n`);
13+
const message = test[0].errorCount > 0 && test[0].messages[0].message;
14+
assert.equal(test[0].errorCount, 0, message);
1915
});
2016
});
2117

22-
describe('React JS', function() {
23-
it('Will pass', function() {
24-
const test = cli.executeOnText(`
25-
import React, { Component } from 'react';
18+
describe('React JS', function () {
19+
it('Will pass', async function () {
20+
const test = await lint(
21+
`import React, { Component } from 'react';
2622
2723
export class Foo extends Component {
2824
constructor(props) {
@@ -34,10 +30,8 @@ export class Foo extends Component {
3430
return <p>Foo</p>;
3531
}
3632
}
37-
`);
38-
39-
const message = test.errorCount > 0 && test.results[0].messages[0].message;
40-
41-
assert.equal(test.errorCount, 0, message);
33+
` );
34+
const message = test[0].errorCount > 0 && test[0].messages[0].message;
35+
assert.equal(test[0].errorCount, 0, message);
4236
});
4337
});

0 commit comments

Comments
 (0)