mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
**BREAKING CHANGE**: VSCode-Client does not watch for `eslint` configuration files. Default value for `oxc.configPath` is now `.oxlintrc.json` instead of `.eslintrc`
42 lines
1.3 KiB
TypeScript
42 lines
1.3 KiB
TypeScript
import { strictEqual } from 'assert';
|
|
import { workspace } from 'vscode';
|
|
import { Config } from './Config.js';
|
|
|
|
suite('Config', () => {
|
|
setup(async () => {
|
|
const wsConfig = workspace.getConfiguration('oxc');
|
|
const keys = ['lint.run', 'enable', 'trace.server', 'configPath', 'path.server'];
|
|
|
|
await Promise.all(keys.map(key => wsConfig.update(key, undefined)));
|
|
});
|
|
|
|
test('default values on initialization', () => {
|
|
const config = new Config();
|
|
|
|
strictEqual(config.runTrigger, 'onType');
|
|
strictEqual(config.enable, true);
|
|
strictEqual(config.trace, 'off');
|
|
strictEqual(config.configPath, '.oxlintrc.json');
|
|
strictEqual(config.binPath, '');
|
|
});
|
|
|
|
test('updating values updates the workspace configuration', async () => {
|
|
const config = new Config();
|
|
|
|
await Promise.all([
|
|
config.updateRunTrigger('onSave'),
|
|
config.updateEnable(false),
|
|
config.updateTrace('messages'),
|
|
config.updateConfigPath('./somewhere'),
|
|
config.updateBinPath('./binary'),
|
|
]);
|
|
|
|
const wsConfig = workspace.getConfiguration('oxc');
|
|
|
|
strictEqual(wsConfig.get('lint.run'), 'onSave');
|
|
strictEqual(wsConfig.get('enable'), false);
|
|
strictEqual(wsConfig.get('trace.server'), 'messages');
|
|
strictEqual(wsConfig.get('configPath'), './somewhere');
|
|
strictEqual(wsConfig.get('path.server'), './binary');
|
|
});
|
|
});
|