Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
privatenumber committed Jul 25, 2024
1 parent 8aad462 commit 61ecb3a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 25 deletions.
2 changes: 1 addition & 1 deletion tests/specs/insert-disable-comment/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,6 @@ export default testSuite(({ describe }, eslintPath: string) => {
});
});

runTestSuite(import('./git-blame.js'), eslintPath);
runTestSuite(import('./template-utils.js'), eslintPath);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import { execa } from 'execa';
import { eslint } from '../../utils/eslint.js';

export default testSuite(({ describe }, eslintPath: string) => {
describe('template utils', async ({ describe, onFinish }) => {
describe('template utils', async ({ describe, test, onFinish }) => {
const fixture = await createFixture({
'file.js': 'console.log()',
node_modules: ({ symlink }) => symlink(path.resolve('./node_modules')),
'.github/CODEOWNERS': 'file.js @owner',
'.github/CODEOWNERS': 'file.js @johndoe',
});
onFinish(() => fixture.rm());

Expand Down Expand Up @@ -114,30 +114,28 @@ export default testSuite(({ describe }, eslintPath: string) => {
});
});

describe('code owners', ({ test }) => {
test('Committed file', async () => {
const result = await eslint(eslintPath, {
config: {
rules: {
'fix-later/fix-later': ['warn', {
commentTemplate: '{{ codeowner }}',
}],
'no-console': 'error',
},
test('CODEOWNERS', async () => {
const result = await eslint(eslintPath, {
config: {
rules: {
'fix-later/fix-later': ['warn', {
commentTemplate: 'TODO: {{ codeowner }}',
}],
'no-console': 'error',
},
code: 'file.js',
cwd: fixture.path,
fix: true,
});

expect(result.warningCount).toBe(1);
expect(result.errorCount).toBe(0);
expect(result.output).toBe(
outdent`
console.log() // eslint-disable-line no-console -- John Doe <john@doe.org>
`,
);
},
code: 'file.js',
cwd: fixture.path,
fix: true,
});

expect(result.warningCount).toBe(1);
expect(result.errorCount).toBe(0);
expect(result.output).toBe(
outdent`
console.log() // eslint-disable-line no-console -- TODO: @johndoe
`,
);
});
});
});

0 comments on commit 61ecb3a

Please sign in to comment.