Skip to content

Commit

Permalink
Migrate test/e2e/__tests__/stylelint-resolution.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
ybiquitous committed Aug 26, 2024
1 parent e1b230e commit c0bc000
Showing 1 changed file with 45 additions and 18 deletions.
63 changes: 45 additions & 18 deletions test/e2e/__tests__/stylelint-resolution.ts
Original file line number Diff line number Diff line change
@@ -1,38 +1,65 @@
import path from 'path';
import { normalizeDiagnostic } from '../utils';
import { openDocument, waitForDiagnostics, assertDiagnostics, closeAllEditors } from '../utils';

Check failure on line 1 in test/e2e/__tests__/stylelint-resolution.ts

View workflow job for this annotation

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

Module '"../utils"' has no exported member 'openDocument'.

Check failure on line 1 in test/e2e/__tests__/stylelint-resolution.ts

View workflow job for this annotation

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

Module '"../utils"' has no exported member 'waitForDiagnostics'.

Check failure on line 1 in test/e2e/__tests__/stylelint-resolution.ts

View workflow job for this annotation

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

Module '"../utils"' has no exported member 'assertDiagnostics'.

Check failure on line 1 in test/e2e/__tests__/stylelint-resolution.ts

View workflow job for this annotation

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

Module '"../utils"' has no exported member 'closeAllEditors'.

describe('Stylelint resolution', () => {
afterEach(async () => {
await closeAllEditors();
});

it('should resolve Stylelint using local node_modules', async () => {

Check warning on line 8 in test/e2e/__tests__/stylelint-resolution.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, 'defaults/local-stylelint/test.css'),
);
const document = await openDocument('defaults/local-stylelint/test.css');
const diagnostics = await waitForDiagnostics(document);

expect(diagnostics.map(normalizeDiagnostic)).toMatchSnapshot();
assertDiagnostics(diagnostics, [
{
code: 'fake',
message: 'Fake result from resolve-local',
range: [0, 0, 0, 1],
severity: 'error',
},
]);
});

it('should resolve Stylelint using "stylelint.stylelintPath"', async () => {
const { document } = await openDocument(path.resolve(workspaceDir, 'stylelint-path/test.css'));
const diagnostics = await waitForDiagnostics(document);
describe('when using "stylelint.stylelintPath"', () => {
it('should resolve Stylelint', async () => {

Check warning on line 23 in test/e2e/__tests__/stylelint-resolution.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('stylelint-path/test.css');
const diagnostics = await waitForDiagnostics(document);

expect(diagnostics.map(normalizeDiagnostic)).toMatchSnapshot();
assertDiagnostics(diagnostics, [
{
code: 'fake',
message: 'Fake result',
range: [0, 0, 0, 1],
severity: 'error',
},
]);
});
});

it('should resolve Stylelint using PnP', async () => {

Check warning on line 38 in test/e2e/__tests__/stylelint-resolution.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, 'defaults/yarn-pnp/test.css'),
);
const document = await openDocument('defaults/yarn-pnp/test.css');
const diagnostics = await waitForDiagnostics(document);

expect(diagnostics.map(normalizeDiagnostic)).toMatchSnapshot();
assertDiagnostics(diagnostics, [
{
code: 'fake',
message: 'Fake result from yarn-pnp',
range: [0, 0, 0, 1],
severity: 'error',
},
]);
});

it('should resolve Stylelint using Yarn 2.x PnP', async () => {

Check warning on line 52 in test/e2e/__tests__/stylelint-resolution.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, 'defaults/yarn-2-pnp/test.css'),
);
const document = await openDocument('defaults/yarn-2-pnp/test.css');
const diagnostics = await waitForDiagnostics(document);

expect(diagnostics.map(normalizeDiagnostic)).toMatchSnapshot();
assertDiagnostics(diagnostics, [
{
code: 'fake',
message: 'Fake result from yarn-2-pnp',
range: [0, 0, 0, 1],
severity: 'error',
},
]);
});
});

0 comments on commit c0bc000

Please sign in to comment.