Skip to content

Commit

Permalink
Migrate test/e2e/__tests__/report-needless-disables.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
ybiquitous committed Aug 26, 2024
1 parent 73a27e0 commit e48dd59
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 10 deletions.
1 change: 1 addition & 0 deletions .vscode-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ if (!minimumVscodeVersion) throw new Error(`"engines.vscode" is unexpected: ${pk
module.exports = defineConfig({
// TODO: files: ['test/e2e/__tests__/**/*.ts'],
files: [
'test/e2e/__tests__/report-needless-disables.ts',
'test/e2e/__tests__/restart.ts',
'test/e2e/__tests__/stylelint-resolution.ts',
'test/e2e/__tests__/validate.ts',
Expand Down
50 changes: 40 additions & 10 deletions test/e2e/__tests__/report-needless-disables.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,47 @@
import path from 'path';
import { normalizeDiagnostic } from '../utils';
import { openDocument, waitForDiagnostics, assertDiagnostics, closeAllEditors } from '../helpers';

describe('"stylelint.reportNeedlessDisables" setting', () => {
afterEach(async () => {
await closeAllEditors();
});

it('should report needless disables when enabled', async () => {

Check warning on line 8 in test/e2e/__tests__/report-needless-disables.ts

View workflow job for this annotation

GitHub Actions / lint / Lint on Node.js lts/* and ubuntu-latest

Test has no assertions
const { document } = await openDocument(
path.resolve(workspaceDir, 'report-disables/needless.css'),
const { document } = await openDocument('report-disables/needless.css');
const diagnostics = (await waitForDiagnostics(document)).filter(
({ code }) => code === '--report-needless-disables',
);
const diagnostics = await waitForDiagnostics(document);

expect(
diagnostics
.map(normalizeDiagnostic)
.filter((diagnostic) => diagnostic?.code === '--report-needless-disables'),
).toMatchSnapshot();
assertDiagnostics(diagnostics, [
{
code: '--report-needless-disables',
message: 'Needless disable for "indentation"',
range: [2, 2, 2, 55],
severity: 'error',
},
{
code: '--report-needless-disables',
message: 'Needless disable for "indentation"',
range: [6, 0, 6, 34],
severity: 'error',
},
{
code: '--report-needless-disables',
message: 'Needless disable for "indentation"',
range: [14, 16, 14, 55],
severity: 'error',
},
{
code: '--report-needless-disables',
message: 'Needless disable for "indentation"',
range: [17, 0, 17, 34],
severity: 'error',
},
{
code: '--report-needless-disables',
message: 'Needless disable for "unknown"',
range: [2, 2, 2, 55],
severity: 'error',
},
]);
});
});

0 comments on commit e48dd59

Please sign in to comment.