-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate
test/e2e/__tests__/report-needless-disables.ts
- Loading branch information
1 parent
73a27e0
commit e48dd59
Showing
2 changed files
with
41 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 () => { | ||
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', | ||
}, | ||
]); | ||
}); | ||
}); |