Skip to content
This repository has been archived by the owner on Jan 19, 2019. It is now read-only.

Commit

Permalink
add test for #416
Browse files Browse the repository at this point in the history
  • Loading branch information
mysticatea committed Nov 8, 2018
1 parent f5de9b0 commit 7ce5d61
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions tests/lib/scope-analysis.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
*/
"use strict";

const assert = require("assert");
const fs = require("fs");
const path = require("path");
const { parseForESLint } = require("../..");
const { Linter } = require("eslint");
const parser = require("../..");

/** Reference resolver. */
class ReferenceResolver {
Expand Down Expand Up @@ -144,7 +146,7 @@ describe("TypeScript scope analysis", () => {
for (const filePath of files) {
test(filePath, () => {
const code = fs.readFileSync(filePath, "utf8");
const { scopeManager } = parseForESLint(code, {
const { scopeManager } = parser.parseForESLint(code, {
loc: true,
range: true,
tokens: true,
Expand All @@ -169,4 +171,24 @@ describe("TypeScript scope analysis", () => {
expect(scopeTree).toMatchSnapshot();
});
}

test("https://github.com/eslint/typescript-eslint-parser/issues/416", () => {
const linter = new Linter();
linter.defineParser("typescript-eslint-parser", parser);

const code = `
export type SomeThing = {
id: string;
}
`;
const config = {
parser: "typescript-eslint-parser",
rules: {
"no-undef": "error"
}
};
const messages = linter.verify(code, config, { filename: "issue416.ts" });

assert.deepStrictEqual(messages, []);
});
});

0 comments on commit 7ce5d61

Please sign in to comment.