Skip to content

Commit 016ebfc

Browse files
committed
feat: pass in the file’s real name
1 parent d7ed7d4 commit 016ebfc

File tree

1 file changed

+5
-5
lines changed
  • packages/eslint-plugin-typescript/tools

1 file changed

+5
-5
lines changed

packages/eslint-plugin-typescript/tools/test.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ const project = path.dirname(__dirname);
1111
const tests = path.join(project, 'tests', 'rules');
1212

1313
const format = new CLIEngine().getFormatter('codeframe');
14-
const fakeName = 'source.ts';
1514

1615
const linter = new Linter();
1716

@@ -27,7 +26,8 @@ for (const rule of testedRules) {
2726

2827
const snapPath = path.join(tests, `${rule}.snap.ts`);
2928

30-
const source = fs.readFileSync(path.join(tests, `${rule}.src.ts`), 'utf8');
29+
const sourceName = `${rule}.src.ts`;
30+
const source = fs.readFileSync(path.join(tests, sourceName), 'utf8');
3131
const messages = linter.verify(
3232
source,
3333
{
@@ -36,7 +36,7 @@ for (const rule of testedRules) {
3636
useEslintrc: false,
3737
rules: { [rule]: 'error' }
3838
},
39-
fakeName
39+
sourceName
4040
);
4141

4242
try {
@@ -48,7 +48,7 @@ for (const rule of testedRules) {
4848

4949
const received = format([
5050
{
51-
filePath: fakeName,
51+
filePath: sourceName,
5252
messages,
5353
errorCount: messages.length,
5454
warningCount: 0,
@@ -59,7 +59,7 @@ for (const rule of testedRules) {
5959
])
6060
.replace(
6161
new RegExp(
62-
String.raw`^error: (.+?) \(${rule}\) at ${fakeName.replace(
62+
String.raw`^error: (.+?) \(${rule}\) at ${sourceName.replace(
6363
'.',
6464
'\\.'
6565
)}:(\d+:\d+):$`,

0 commit comments

Comments
 (0)