diff --git a/.vscode-test.js b/.vscode-test.js index a3b2acb3..ff7242d4 100644 --- a/.vscode-test.js +++ b/.vscode-test.js @@ -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', diff --git a/test/e2e/__tests__/custom-syntax.ts b/test/e2e/__tests__/custom-syntax.ts index 4c07ed04..6403b3c1 100644 --- a/test/e2e/__tests__/custom-syntax.ts +++ b/test/e2e/__tests__/custom-syntax.ts @@ -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 () => { - 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(); }); }); diff --git a/test/e2e/workspace/workspace.code-workspace b/test/e2e/workspace/workspace.code-workspace index fcec4eb7..bc4557ec 100644 --- a/test/e2e/workspace/workspace.code-workspace +++ b/test/e2e/workspace/workspace.code-workspace @@ -10,6 +10,5 @@ { "path": "stylelint-path" }, { "path": "validate" }, ], - "settings": { - }, + "settings": {}, }