-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
617 additions
and
679 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
137 changes: 137 additions & 0 deletions
137
packages/vite-plugin-checker/__tests__/unit/__snapshots__/vlsConfig.spec.ts.snap
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 |
---|---|---|
@@ -0,0 +1,137 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`VLS config customized config 1`] = ` | ||
Object { | ||
"css": Object {}, | ||
"emmet": Object {}, | ||
"html": Object { | ||
"suggest": Object {}, | ||
}, | ||
"javascript": Object { | ||
"format": Object {}, | ||
}, | ||
"stylusSupremacy": Object {}, | ||
"typescript": Object { | ||
"format": Object {}, | ||
"tsdk": null, | ||
}, | ||
"vetur": Object { | ||
"completion": Object { | ||
"autoImport": false, | ||
"scaffoldSnippetSources": Object { | ||
"user": "🗒️", | ||
"vetur": "✌", | ||
"workspace": "💼", | ||
}, | ||
"tagCasing": "initial", | ||
}, | ||
"dev": Object { | ||
"logLevel": "INFO", | ||
"vlsPath": "", | ||
"vlsPort": -1, | ||
}, | ||
"experimental": Object { | ||
"templateInterpolationService": true, | ||
}, | ||
"format": Object { | ||
"defaultFormatter": Object {}, | ||
"defaultFormatterOptions": Object {}, | ||
"enable": true, | ||
"options": Object { | ||
"tabSize": 2, | ||
"useTabs": false, | ||
}, | ||
"scriptInitialIndent": false, | ||
"styleInitialIndent": false, | ||
}, | ||
"grammar": Object { | ||
"customBlocks": Object {}, | ||
}, | ||
"ignoreProjectWarning": false, | ||
"languageFeatures": Object { | ||
"codeActions": true, | ||
"semanticTokens": true, | ||
"updateImportOnFileMove": true, | ||
}, | ||
"trace": Object { | ||
"server": "off", | ||
}, | ||
"useWorkspaceDependencies": false, | ||
"validation": Object { | ||
"interpolation": false, | ||
"script": true, | ||
"style": false, | ||
"template": false, | ||
"templateProps": false, | ||
}, | ||
}, | ||
} | ||
`; | ||
|
||
exports[`VLS config default config 1`] = ` | ||
Object { | ||
"css": Object {}, | ||
"emmet": Object {}, | ||
"html": Object { | ||
"suggest": Object {}, | ||
}, | ||
"javascript": Object { | ||
"format": Object {}, | ||
}, | ||
"stylusSupremacy": Object {}, | ||
"typescript": Object { | ||
"format": Object {}, | ||
"tsdk": null, | ||
}, | ||
"vetur": Object { | ||
"completion": Object { | ||
"autoImport": false, | ||
"scaffoldSnippetSources": Object { | ||
"user": "🗒️", | ||
"vetur": "✌", | ||
"workspace": "💼", | ||
}, | ||
"tagCasing": "initial", | ||
}, | ||
"dev": Object { | ||
"logLevel": "INFO", | ||
"vlsPath": "", | ||
"vlsPort": -1, | ||
}, | ||
"experimental": Object { | ||
"templateInterpolationService": true, | ||
}, | ||
"format": Object { | ||
"defaultFormatter": Object {}, | ||
"defaultFormatterOptions": Object {}, | ||
"enable": true, | ||
"options": Object { | ||
"tabSize": 2, | ||
"useTabs": false, | ||
}, | ||
"scriptInitialIndent": false, | ||
"styleInitialIndent": false, | ||
}, | ||
"grammar": Object { | ||
"customBlocks": Object {}, | ||
}, | ||
"ignoreProjectWarning": false, | ||
"languageFeatures": Object { | ||
"codeActions": true, | ||
"semanticTokens": true, | ||
"updateImportOnFileMove": true, | ||
}, | ||
"trace": Object { | ||
"server": "off", | ||
}, | ||
"useWorkspaceDependencies": false, | ||
"validation": Object { | ||
"interpolation": true, | ||
"script": true, | ||
"style": true, | ||
"template": true, | ||
"templateProps": true, | ||
}, | ||
}, | ||
} | ||
`; |
47 changes: 47 additions & 0 deletions
47
packages/vite-plugin-checker/__tests__/unit/vlsConfig.spec.ts
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import path from 'path' | ||
import { ShutdownRequest } from 'vscode-languageserver/node' | ||
import { URI } from 'vscode-uri' | ||
|
||
import { prepareClientConnection } from '../../src/checkers/vls/diagnostics' | ||
|
||
async function testVslConfig(overrideConfig?: any) { | ||
const workspaceUri = URI.file(path.join(__dirname, 'fixtures')) | ||
const { clientConnection, serverConnection, vls, up, down, logger } = | ||
await prepareClientConnection(workspaceUri, { | ||
watch: false, | ||
verbose: false, | ||
config: overrideConfig || null, | ||
}) | ||
|
||
// @ts-expect-error | ||
expect(vls.workspaceConfig).toMatchSnapshot() | ||
|
||
// TODO: this test case will let Jest hang with out --forceExit option | ||
// current enable forceExit but we should find which resource is not released | ||
await clientConnection.sendRequest(ShutdownRequest.type) | ||
clientConnection.dispose() | ||
clientConnection.end() | ||
serverConnection.dispose() | ||
up.destroy() | ||
down.destroy() | ||
vls.dispose() | ||
} | ||
|
||
describe('VLS config', () => { | ||
it('default config', async () => { | ||
await testVslConfig() | ||
}) | ||
|
||
it('customized config', async () => { | ||
await testVslConfig({ | ||
vetur: { | ||
validation: { | ||
template: false, | ||
templateProps: false, | ||
interpolation: false, | ||
style: false, | ||
}, | ||
}, | ||
}) | ||
}) | ||
}) |
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
Oops, something went wrong.