Skip to content

Commit 7c4eee9

Browse files
committed
test: eslint 8 module project integ tests
1 parent 0c1ebc8 commit 7c4eee9

4 files changed

Lines changed: 56 additions & 2 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"env": {
3+
"browser": true
4+
},
5+
"rules": {
6+
// Override our default settings just for this directory
7+
"eqeqeq": "warn",
8+
"strict": "off"
9+
}
10+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log("hello", x==2)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "misc",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"type": "module",
7+
"scripts": {},
8+
"author": "",
9+
"license": "ISC",
10+
"dependencies": {
11+
"eslint": "8.0.0"
12+
}
13+
}

test/spec/Extn-ESLint-integ-test.js

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ define(function (require, exports, module) {
5555
}, 30000);
5656

5757
const JSHintErrorES6Error_js = "Missing semicolon. jshint (W033)",
58-
ESLintErrorES7Error_js = "Parsing error: Unexpected token ; ESLint (null)";
58+
ESLintErrorES7Error_js = "Parsing error: Unexpected token ; ESLint (null)",
59+
ESLintErrorES8Error_js = "Expected '===' and instead saw '=='. ESLint (eqeqeq)";
5960

6061
async function _createTempProject(esLintSpecSubFolder) {
6162
return await SpecRunnerUtils.getTempTestDirectory(testRootSpec + esLintSpecSubFolder);
@@ -187,9 +188,38 @@ define(function (require, exports, module) {
187188
await awaitsFor(()=>{
188189
return $("#problems-panel").text().includes(JSHintErrorES6Error_js);
189190
}, "JShint error to be shown");
191+
expect($("#problems-panel").text().includes("JSHint")).toBeTrue();
190192
}, 5000);
193+
});
194+
195+
describe("ES8 module project", function () {
196+
let es7ProjectPath;
191197

192-
// todo eslint module test
198+
beforeAll(async function () {
199+
es7ProjectPath = await _createTempProject("es8_module");
200+
await _npmInstallInFolder(es7ProjectPath);
201+
await SpecRunnerUtils.loadProjectInTestWindow(es7ProjectPath);
202+
}, 30000);
203+
204+
async function _loadAndValidateES8Project() {
205+
await _openProjectFile("error.js");
206+
await _waitForProblemsPanelVisible(true);
207+
await awaitsFor(()=>{
208+
return $("#problems-panel").text().includes(ESLintErrorES8Error_js);
209+
}, "ESLint v8 error to be shown");
210+
}
211+
212+
it("should ESLint v8 work as expected", async function () {
213+
await _loadAndValidateES8Project();
214+
}, 5000);
215+
216+
it("should not show JSHint in desktop app if ESLint is active", async function () {
217+
await _loadAndValidateES8Project();
218+
await awaits(100); // give some time so that jshint has time to complete if there is any.
219+
expect($("#problems-panel").text().includes("JSHint")).toBeFalse();
220+
}, 5000);
193221
});
222+
223+
// todo eslint module test for es9
194224
});
195225
});

0 commit comments

Comments
 (0)