Skip to content

Commit

Permalink
Migrate test/e2e/__tests__/custom-syntax.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
ybiquitous committed Aug 26, 2024
1 parent 7b8873d commit 74436c0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 20 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__/custom-syntax.ts',
'test/e2e/__tests__/format.ts',
'test/e2e/__tests__/ignore-disables.ts',
'test/e2e/__tests__/ignore.ts',
Expand Down
32 changes: 14 additions & 18 deletions test/e2e/__tests__/custom-syntax.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
import path from 'path';
import pWaitFor from 'p-wait-for';
import { commands } from 'vscode';
import * as assert from 'node:assert/strict';

import { openDocument, executeAutofix, closeAllEditors } from '../helpers';

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

it('should auto-fix using the specified custom syntax', async () => {

Check warning on line 10 in test/e2e/__tests__/custom-syntax.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, 'custom-syntax/test.css'));
const { document } = await openDocument('custom-syntax/test.css');

await pWaitFor(
async () => {
const names = await commands.getCommands();
await executeAutofix();

return (
// cspell:disable-next-line
names.includes('stylelint.executeAutofix') && names.includes('stylelint.applyAutoFix')
);
},
{ timeout: 2000 },
assert.equal(
document.getText(),
`/* prettier-ignore */
.foo .bar
color: red`,
);

// cspell:disable-next-line
await commands.executeCommand('stylelint.executeAutofix');

expect(document.getText()).toMatchSnapshot();
});
});
3 changes: 1 addition & 2 deletions test/e2e/workspace/workspace.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@
{ "path": "stylelint-path" },
{ "path": "validate" },
],
"settings": {
},
"settings": {},
}

0 comments on commit 74436c0

Please sign in to comment.