-
-
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__/stylelint-resolution.ts
- Loading branch information
1 parent
e1b230e
commit c0bc000
Showing
1 changed file
with
45 additions
and
18 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
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 GitHub Actions / lint / Lint on Node.js lts/* and ubuntu-latest
Check failure on line 1 in test/e2e/__tests__/stylelint-resolution.ts GitHub Actions / lint / Lint on Node.js lts/* and ubuntu-latest
Check failure on line 1 in test/e2e/__tests__/stylelint-resolution.ts GitHub Actions / lint / Lint on Node.js lts/* and ubuntu-latest
|
||
|
||
describe('Stylelint resolution', () => { | ||
afterEach(async () => { | ||
await closeAllEditors(); | ||
}); | ||
|
||
it('should resolve Stylelint using local node_modules', async () => { | ||
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 () => { | ||
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 () => { | ||
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 () => { | ||
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', | ||
}, | ||
]); | ||
}); | ||
}); |