Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
earshinov committed Aug 27, 2023
1 parent dd10102 commit 2fb9b97
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
1 change: 1 addition & 0 deletions src/test/runTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ async function main(): Promise<void> {
await runTests({
extensionDevelopmentPath,
extensionTestsPath,
launchArgs: ['--disable-extensions']
});
}
catch (err) {
Expand Down
5 changes: 2 additions & 3 deletions src/test/suite/test-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import vscode from 'vscode';

import { DI } from '../../extension';
import { REGISTRY } from './test-di';
import { openEditor, closeEditor } from './test-utils';
import { openEditor, closeEditor, closeAllEditors } from './test-utils';


suiteSetup(() => {
Expand All @@ -24,8 +24,7 @@ setup(async () => {
});

// Open a single blank editor
while (vscode.window.activeTextEditor)
await closeEditor();
await closeAllEditors();
const editor = await openEditor();

// Use given line endings and indentation to make document content comparisons predictable
Expand Down
7 changes: 7 additions & 0 deletions src/test/suite/test-utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,13 @@ export async function closeEditor() {
await vscode.commands.executeCommand('workbench.action.closeActiveEditor');
}

/**
* Close all editors
*/
export async function closeAllEditors() {
await vscode.commands.executeCommand('workbench.action.closeAllEditors');
}

/**
* Open a new blank editor
*/
Expand Down
12 changes: 5 additions & 7 deletions src/test/suite/test-word-under-cursor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,9 @@ import { setEditorText, findPosition, invokeFilterLines, reopenEditor } from './

suite('Word under cursor', () => {

test('Without preserveSearch', async () => {
helper(false);
});
test('Without preserveSearch', () => helper(false));

test('With preserveSearch', async () => {
helper(true);
});
test('With preserveSearch', () => helper(true));

async function helper(preserveSearch: boolean) {
REGISTRY.updateSettings({ preserveSearch });
Expand All @@ -31,7 +27,9 @@ suite('Word under cursor', () => {
prompt: sinon.match.any,
value: 'feugiat',
}),
undefined);
// We must actually perform the search for search string to be remembered
//undefined);
'feugiat');

editor = await reopenEditor();
await setEditorText(editor, LIPSUM);
Expand Down

0 comments on commit 2fb9b97

Please sign in to comment.