Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

Commit

Permalink
Add path property to TestLintOptions (#597)
Browse files Browse the repository at this point in the history
  • Loading branch information
yassere authored Jun 10, 2020
1 parent 35a69dc commit e0e5bc7
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/@romejs/compiler/lint/rules/testHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import {TestHelper} from "rome";
import lint from "../index";
import {parseJS} from "@romejs/js-parser";
import {createUnknownFilePath} from "@romejs/path";
import {UnknownFilePath, createUnknownFilePath} from "@romejs/path";
import {createDefaultProjectConfig} from "@romejs/project";
import {ConstProgramSyntax, ConstSourceType} from "@romejs/ast";
import {DiagnosticCategory, DiagnosticsProcessor} from "@romejs/diagnostics";
Expand All @@ -18,6 +18,7 @@ type TestLintOptions = {
category: undefined | DiagnosticCategory;
sourceType?: ConstSourceType;
syntax?: Array<ConstProgramSyntax>;
path?: UnknownFilePath | string;
};

type TestLintInput = {
Expand All @@ -41,7 +42,12 @@ export async function testLint(
async function testLintExpect(
t: TestHelper,
input: string,
{syntax = ["jsx", "ts"], category, sourceType = "module"}: TestLintOptions,
{
syntax = ["jsx", "ts"],
category,
sourceType = "module",
path = createUnknownFilePath("unknown"),
}: TestLintOptions,
expectValid: boolean,
) {
t.addToAdvice({
Expand Down Expand Up @@ -73,7 +79,7 @@ async function testLintExpect(
const ast = parseJS({
input,
sourceType,
path: createUnknownFilePath("unknown"),
path,
syntax,
});

Expand Down

0 comments on commit e0e5bc7

Please sign in to comment.