Skip to content

Commit

Permalink
✅ fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dudeofawesome committed May 3, 2024
1 parent 9751306 commit 443fc9b
Show file tree
Hide file tree
Showing 21 changed files with 299 additions and 295 deletions.
1 change: 1 addition & 0 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ extends:
- '@code-style/eslint-config-typescript'
- '@code-style/eslint-config-esmodule'
ignorePatterns:
- '.prettierrc.mjs'
- '**/test/*/**'
- 'packages/code-style'
- 'packages/create-configs'
Expand Down
4 changes: 4 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 4 additions & 8 deletions packages/eslint-config-browser/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,18 @@ void describe('eslint-config-browser', () => {
void describe('passes', () => {});

void describe('fails', () => {
void it(
`should fail no-console`,
void it(`should fail no-console`, () =>
testRuleFail({
linter,
ruleId: 'no-console',
files: [{ code: `console.log('foo');\n` }],
}),
);
}));

void it(
`should fail radix`,
void it(`should fail radix`, () =>
testRuleFail({
linter,
ruleId: 'radix',
files: [{ code: `parseInt('10');\n` }],
}),
);
}));
});
});
12 changes: 4 additions & 8 deletions packages/eslint-config-cli/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,11 @@ void describe('eslint-config-cli base', () => {
defaultTestSet(linter);

void describe('passes', () => {
void it(
`should pass radix`,
testNoFail({ linter, files: [{ code: `parseInt('10');\n` }] }),
);
void it(`should pass radix`, () =>
testNoFail({ linter, files: [{ code: `parseInt('10');\n` }] }));

void it(
`should pass no-console`,
testNoFail({ linter, files: [{ code: `console.log('foo');\n` }] }),
);
void it(`should pass no-console`, () =>
testNoFail({ linter, files: [{ code: `console.log('foo');\n` }] }));
});

void describe('fails', () => {});
Expand Down
12 changes: 4 additions & 8 deletions packages/eslint-config-esmodule/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,20 @@ void describe('eslint-config-esmodule base', () => {
defaultTestSet(linter);

void describe('passes', () => {
void it(
`should pass esmodule import`,
void it(`should pass esmodule import`, () =>
testNoFail({
linter,
files: [{ code: `import { foo } from 'console';\n\nfoo();\n` }],
}),
);
}));
});

void describe('fails', () => {
void it(
`should fail commonjs`,
void it(`should fail commonjs`, () =>
testRuleFail({
linter,
ruleId: 'import/no-commonjs',
files: [{ code: `const foo = require('foo');\n\nfoo();\n` }],
}),
);
}));

void it(`should only log single duplicate-import error`, async () =>
linter
Expand Down
12 changes: 4 additions & 8 deletions packages/eslint-config-jest/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ void describe('eslint-config-jest', () => {
defaultTestSet(linter);

void describe('passes', () => {
void it(
`should have jest globals in test file`,
void it(`should have jest globals in test file`, () =>
testNoFail({
linter,
files: [
Expand All @@ -24,18 +23,15 @@ void describe('eslint-config-jest', () => {
test: true,
},
],
}),
);
}));
});

void describe('fails', () => {
void it(
`should not have jest globals in non-test file`,
void it(`should not have jest globals in non-test file`, () =>
testRuleFail({
linter,
ruleId: 'no-undef',
files: [{ code: `describe('test', () => {});\n` }],
}),
);
}));
});
});
18 changes: 6 additions & 12 deletions packages/eslint-config-nest/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,19 @@ void describe('eslint-config-nest strict', () => {
defaultTestSet(linter);

void describe('passes', () => {
void it(
`should pass radix`,
testNoFail({ linter, files: [{ code: `parseInt('10');\n`, ts: true }] }),
);
void it(`should pass radix`, () =>
testNoFail({ linter, files: [{ code: `parseInt('10');\n`, ts: true }] }));
});

void describe('fails', () => {
void it(
`should fail no-console`,
void it(`should fail no-console`, () =>
testRuleFail({
linter,
ruleId: 'no-console',
files: [{ code: `console.log('foo');\n`, ts: true }],
}),
);
}));

void it(
`should fail no-restricted-imports`,
void it(`should fail no-restricted-imports`, () =>
testRuleFail({
linter,
ruleId: 'no-restricted-imports',
Expand All @@ -52,7 +47,6 @@ void describe('eslint-config-nest strict', () => {
ts: true,
},
],
}),
);
}));
});
});
24 changes: 8 additions & 16 deletions packages/eslint-config-nextjs/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ void describe('eslint-config-nextjs', () => {
defaultTestSet(linter);

void describe('passes', () => {
void it(
`should parse jsx`,
void it(`should parse jsx`, () =>
testNoFail({
linter,
files: [
Expand All @@ -30,31 +29,25 @@ void describe('eslint-config-nextjs', () => {
react: true,
},
],
}),
);
}));
});

void describe('fails', () => {
void it(
`should fail radix`,
void it(`should fail radix`, () =>
testRuleFail({
linter,
ruleId: 'radix',
files: [{ code: `parseInt('10');\n`, react: true }],
}),
);
}));

void it(
`should fail no-console`,
void it(`should fail no-console`, () =>
testRuleFail({
linter,
ruleId: 'no-console',
files: [{ code: `console.log('foo');\n`, react: true }],
}),
);
}));

void it(
`should fail react/jsx-key`,
void it(`should fail react/jsx-key`, () =>
testRuleFail({
linter,
ruleId: 'react/jsx-key',
Expand All @@ -68,7 +61,6 @@ export const Bar = (props) => props.list.map((l) => <Foo text={l}></Foo>);
react: true,
},
],
}),
);
}));
});
});
12 changes: 4 additions & 8 deletions packages/eslint-config-node/test/lenient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,19 @@ void describe('eslint-config-node lenient', () => {
defaultTestSet(linter);

void describe('passes', () => {
void it(
`should pass n/no-sync`,
void it(`should pass n/no-sync`, () =>
testNoFail({
linter,
files: [{ code: `const { readFileSync } = require('fs');` }],
}),
);
}));
});

void describe('fails', () => {
void it(
`should fail no-console`,
void it(`should fail no-console`, () =>
testRuleFail({
linter,
ruleId: 'no-console',
files: [{ code: `console.log('foo');\n` }],
}),
);
}));
});
});
18 changes: 6 additions & 12 deletions packages/eslint-config-node/test/strict.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,19 @@ void describe('eslint-config-node strict', () => {
defaultTestSet(linter);

void describe('passes', () => {
void it(
`should pass radix`,
testNoFail({ linter, files: [{ code: `parseInt('10');\n` }] }),
);
void it(`should pass radix`, () =>
testNoFail({ linter, files: [{ code: `parseInt('10');\n` }] }));
});

void describe('fails', () => {
void it(
`should fail no-console`,
void it(`should fail no-console`, () =>
testRuleFail({
linter,
ruleId: 'no-console',
files: [{ code: `console.log('foo');\n` }],
}),
);
}));

void it(
`should fail n/no-sync`,
void it(`should fail n/no-sync`, () =>
testRuleFail({
linter,
ruleId: 'n/no-sync',
Expand All @@ -40,7 +35,6 @@ void describe('eslint-config-node strict', () => {
code: `const { readFileSync } = require('fs');\n\nreadFileSync('test');\n`,
},
],
}),
);
}));
});
});
24 changes: 8 additions & 16 deletions packages/eslint-config-react/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ void describe('eslint-config-react', () => {
defaultTestSet(linter);

void describe('passes', () => {
void it(
`should parse jsx`,
void it(`should parse jsx`, () =>
testNoFail({
linter,
files: [
Expand All @@ -29,31 +28,25 @@ void describe('eslint-config-react', () => {
react: true,
},
],
}),
);
}));
});

void describe('fails', () => {
void it(
`should fail radix`,
void it(`should fail radix`, () =>
testRuleFail({
linter,
ruleId: 'radix',
files: [{ code: `parseInt('10');\n`, react: true }],
}),
);
}));

void it(
`should fail no-console`,
void it(`should fail no-console`, () =>
testRuleFail({
linter,
ruleId: 'no-console',
files: [{ code: `console.log('foo');\n`, react: true }],
}),
);
}));

void it(
`should fail react/jsx-key`,
void it(`should fail react/jsx-key`, () =>
testRuleFail({
linter,
ruleId: 'react/jsx-key',
Expand All @@ -67,7 +60,6 @@ export const Bar = (props) => props.list.map((l) => <Foo text={l}></Foo>);
react: true,
},
],
}),
);
}));
});
});
Loading

0 comments on commit 443fc9b

Please sign in to comment.