mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
Split ts into unit and smoke tests
The smoke tests are less reliable as they simulate user actions Fixes #102075 Fixes #102097 Fixes #102106
This commit is contained in:
parent
b813d5dd30
commit
800e173c40
|
@ -95,9 +95,9 @@ export function templateToSnippet(template: string): vscode.SnippetString {
|
|||
// TODO: use append placeholder
|
||||
let snippetIndex = 1;
|
||||
template = template.replace(/\$/g, '\\$');
|
||||
template = template.replace(/^\s*(?=(\/|[ ]\*))/gm, '');
|
||||
template = template.replace(/^[ \t]*(?=(\/|[ ]\*))/gm, '');
|
||||
template = template.replace(/^(\/\*\*\s*\*[ ]*)$/m, (x) => x + `\$0`);
|
||||
template = template.replace(/\* @param([ ]\{\S+\})?\s+(\S+)\s*$/gm, (_param, type, post) => {
|
||||
template = template.replace(/\* @param([ ]\{\S+\})?\s+(\S+)[ \t]$/gm, (_param, type, post) => {
|
||||
let out = '* @param ';
|
||||
if (type === ' {any}' || type === ' {*}') {
|
||||
out += `{\$\{${snippetIndex++}:*\}} `;
|
||||
|
|
28
extensions/typescript-language-features/src/test-all.ts
Normal file
28
extensions/typescript-language-features/src/test-all.ts
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
//
|
||||
// PLEASE DO NOT MODIFY / DELETE UNLESS YOU KNOW WHAT YOU ARE DOING
|
||||
//
|
||||
// This file is providing the test runner to use when running extension tests.
|
||||
// By default the test runner in use is Mocha based.
|
||||
//
|
||||
// You can provide your own test runner if you want to override it by exporting
|
||||
// a function run(testRoot: string, clb: (error:Error) => void) that the extension
|
||||
// host can call to run the tests. The test runner is expected to use console.log
|
||||
// to report the results back to the caller. When the tests are finished, return
|
||||
// a possible error to the callback or null if none.
|
||||
|
||||
const testRunner = require('../../../test/integration/electron/testrunner');
|
||||
|
||||
// You can directly control Mocha options by uncommenting the following lines
|
||||
// See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info
|
||||
testRunner.configure({
|
||||
ui: 'tdd', // the TDD UI is being used in extension.test.ts (suite, test, etc.)
|
||||
useColors: (!process.env.BUILD_ARTIFACTSTAGINGDIRECTORY && process.platform !== 'win32'), // colored output from test results (only windows cannot handle)
|
||||
timeout: 60000,
|
||||
});
|
||||
|
||||
export = testRunner;
|
|
@ -5,9 +5,9 @@
|
|||
|
||||
import 'mocha';
|
||||
import * as vscode from 'vscode';
|
||||
import { disposeAll } from '../utils/dispose';
|
||||
import { acceptFirstSuggestion, typeCommitCharacter } from './suggestTestHelpers';
|
||||
import { assertEditorContents, Config, createTestEditor, enumerateConfig, joinLines, updateConfig, VsCodeConfiguration } from './testUtils';
|
||||
import { disposeAll } from '../../utils/dispose';
|
||||
import { acceptFirstSuggestion, typeCommitCharacter } from '../../test/suggestTestHelpers';
|
||||
import { assertEditorContents, Config, createTestEditor, enumerateConfig, joinLines, updateConfig, VsCodeConfiguration } from '../../test/testUtils';
|
||||
|
||||
const testDocumentUri = vscode.Uri.parse('untitled:test.ts');
|
||||
|
|
@ -6,8 +6,8 @@
|
|||
import 'mocha';
|
||||
import * as assert from 'assert';
|
||||
import * as vscode from 'vscode';
|
||||
import { disposeAll } from '../utils/dispose';
|
||||
import { createTestEditor, wait, joinLines } from './testUtils';
|
||||
import { disposeAll } from '../../utils/dispose';
|
||||
import { createTestEditor, wait, joinLines } from '../../test/testUtils';
|
||||
|
||||
const testDocumentUri = vscode.Uri.parse('untitled:test.ts');
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
//
|
||||
// PLEASE DO NOT MODIFY / DELETE UNLESS YOU KNOW WHAT YOU ARE DOING
|
||||
//
|
||||
// This file is providing the test runner to use when running extension tests.
|
||||
// By default the test runner in use is Mocha based.
|
||||
//
|
||||
// You can provide your own test runner if you want to override it by exporting
|
||||
// a function run(testRoot: string, clb: (error:Error) => void) that the extension
|
||||
// host can call to run the tests. The test runner is expected to use console.log
|
||||
// to report the results back to the caller. When the tests are finished, return
|
||||
// a possible error to the callback or null if none.
|
||||
|
||||
const testRunner = require('../../../../../test/integration/electron/testrunner');
|
||||
|
||||
// You can directly control Mocha options by uncommenting the following lines
|
||||
// See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info
|
||||
testRunner.configure({
|
||||
ui: 'tdd', // the TDD UI is being used in extension.test.ts (suite, test, etc.)
|
||||
useColors: (!process.env.BUILD_ARTIFACTSTAGINGDIRECTORY && process.platform !== 'win32'), // colored output from test results (only windows cannot handle)
|
||||
timeout: 60000,
|
||||
});
|
||||
|
||||
export = testRunner;
|
|
@ -6,8 +6,8 @@
|
|||
import * as assert from 'assert';
|
||||
import 'mocha';
|
||||
import * as vscode from 'vscode';
|
||||
import { disposeAll } from '../utils/dispose';
|
||||
import { createTestEditor, joinLines, retryUntilDocumentChanges, wait } from './testUtils';
|
||||
import { disposeAll } from '../../utils/dispose';
|
||||
import { createTestEditor, joinLines, retryUntilDocumentChanges, wait } from '../../test/testUtils';
|
||||
|
||||
suite.skip('TypeScript Quick Fix', () => {
|
||||
|
|
@ -6,8 +6,8 @@
|
|||
import * as assert from 'assert';
|
||||
import 'mocha';
|
||||
import * as vscode from 'vscode';
|
||||
import { disposeAll } from '../utils/dispose';
|
||||
import { createTestEditor, wait } from './testUtils';
|
||||
import { disposeAll } from '../../utils/dispose';
|
||||
import { createTestEditor, wait } from '../../test/testUtils';
|
||||
|
||||
|
||||
type VsCodeConfiguration = { [key: string]: any };
|
|
@ -6,9 +6,9 @@
|
|||
import * as assert from 'assert';
|
||||
import 'mocha';
|
||||
import * as vscode from 'vscode';
|
||||
import type * as Proto from '../protocol';
|
||||
import { CachedResponse } from '../tsServer/cachedResponse';
|
||||
import { ServerResponse } from '../typescriptService';
|
||||
import type * as Proto from '../../protocol';
|
||||
import { CachedResponse } from '../../tsServer/cachedResponse';
|
||||
import { ServerResponse } from '../../typescriptService';
|
||||
|
||||
suite('CachedResponse', () => {
|
||||
test('should cache simple response for same document', async () => {
|
|
@ -9,7 +9,7 @@
|
|||
import * as assert from 'assert';
|
||||
import 'mocha';
|
||||
import * as vscode from 'vscode';
|
||||
import { snippetForFunctionCall } from '../utils/snippetForFunctionCall';
|
||||
import { snippetForFunctionCall } from '../../utils/snippetForFunctionCall';
|
||||
|
||||
suite('typescript function call snippets', () => {
|
||||
test('Should use label as function name', async () => {
|
|
@ -0,0 +1,28 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
//
|
||||
// PLEASE DO NOT MODIFY / DELETE UNLESS YOU KNOW WHAT YOU ARE DOING
|
||||
//
|
||||
// This file is providing the test runner to use when running extension tests.
|
||||
// By default the test runner in use is Mocha based.
|
||||
//
|
||||
// You can provide your own test runner if you want to override it by exporting
|
||||
// a function run(testRoot: string, clb: (error:Error) => void) that the extension
|
||||
// host can call to run the tests. The test runner is expected to use console.log
|
||||
// to report the results back to the caller. When the tests are finished, return
|
||||
// a possible error to the callback or null if none.
|
||||
|
||||
const testRunner = require('../../../../../test/integration/electron/testrunner');
|
||||
|
||||
// You can directly control Mocha options by uncommenting the following lines
|
||||
// See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info
|
||||
testRunner.configure({
|
||||
ui: 'tdd', // the TDD UI is being used in extension.test.ts (suite, test, etc.)
|
||||
useColors: (!process.env.BUILD_ARTIFACTSTAGINGDIRECTORY && process.platform !== 'win32'), // colored output from test results (only windows cannot handle)
|
||||
timeout: 60000,
|
||||
});
|
||||
|
||||
export = testRunner;
|
|
@ -5,9 +5,9 @@
|
|||
|
||||
import 'mocha';
|
||||
import * as vscode from 'vscode';
|
||||
import { disposeAll } from '../utils/dispose';
|
||||
import { acceptFirstSuggestion } from './suggestTestHelpers';
|
||||
import { assertEditorContents, Config, createTestEditor, CURSOR, enumerateConfig, insertModesValues, joinLines, updateConfig, VsCodeConfiguration } from './testUtils';
|
||||
import { disposeAll } from '../../utils/dispose';
|
||||
import { acceptFirstSuggestion } from '../suggestTestHelpers';
|
||||
import { assertEditorContents, Config, createTestEditor, CURSOR, enumerateConfig, insertModesValues, joinLines, updateConfig, VsCodeConfiguration } from '../testUtils';
|
||||
|
||||
const testDocumentUri = vscode.Uri.parse('untitled:test.ts');
|
||||
|
|
@ -6,8 +6,8 @@
|
|||
import * as assert from 'assert';
|
||||
import 'mocha';
|
||||
import * as vscode from 'vscode';
|
||||
import { templateToSnippet } from '../languageFeatures/jsDocCompletions';
|
||||
import { joinLines } from './testUtils';
|
||||
import { templateToSnippet } from '../../languageFeatures/jsDocCompletions';
|
||||
import { joinLines } from '../testUtils';
|
||||
|
||||
suite('typescript.jsDocSnippet', () => {
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
import * as assert from 'assert';
|
||||
import 'mocha';
|
||||
import * as vscode from 'vscode';
|
||||
import { CURSOR, withRandomFileEditor, wait, joinLines } from './testUtils';
|
||||
import { CURSOR, withRandomFileEditor, wait, joinLines } from '../testUtils';
|
||||
|
||||
const onDocumentChange = (doc: vscode.TextDocument): Promise<vscode.TextDocument> => {
|
||||
return new Promise<vscode.TextDocument>(resolve => {
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
import * as assert from 'assert';
|
||||
import 'mocha';
|
||||
import { tagsMarkdownPreview, markdownDocumentation } from '../utils/previewer';
|
||||
import { tagsMarkdownPreview, markdownDocumentation } from '../../utils/previewer';
|
||||
|
||||
suite('typescript.previewer', () => {
|
||||
test('Should ignore hyphens after a param tag', async () => {
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
import * as assert from 'assert';
|
||||
import 'mocha';
|
||||
import { RequestQueue, RequestQueueingType } from '../tsServer/requestQueue';
|
||||
import { RequestQueue, RequestQueueingType } from '../../tsServer/requestQueue';
|
||||
|
||||
suite('RequestQueue', () => {
|
||||
test('should be empty on creation', async () => {
|
|
@ -6,14 +6,14 @@
|
|||
import * as assert from 'assert';
|
||||
import 'mocha';
|
||||
import * as stream from 'stream';
|
||||
import type * as Proto from '../protocol';
|
||||
import { NodeRequestCanceller } from '../tsServer/cancellation.electron';
|
||||
import { ProcessBasedTsServer, TsServerProcess } from '../tsServer/server';
|
||||
import { ServerType } from '../typescriptService';
|
||||
import { nulToken } from '../utils/cancellation';
|
||||
import { Logger } from '../utils/logger';
|
||||
import { TelemetryReporter } from '../utils/telemetry';
|
||||
import Tracer from '../utils/tracer';
|
||||
import type * as Proto from '../../protocol';
|
||||
import { NodeRequestCanceller } from '../../tsServer/cancellation.electron';
|
||||
import { ProcessBasedTsServer, TsServerProcess } from '../../tsServer/server';
|
||||
import { ServerType } from '../../typescriptService';
|
||||
import { nulToken } from '../../utils/cancellation';
|
||||
import { Logger } from '../../utils/logger';
|
||||
import { TelemetryReporter } from '../../utils/telemetry';
|
||||
import Tracer from '../../utils/tracer';
|
||||
|
||||
|
||||
const NoopTelemetryReporter = new class implements TelemetryReporter {
|
|
@ -50,8 +50,8 @@ if %errorlevel% neq 0 exit /b %errorlevel%
|
|||
call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\vscode-api-tests\testworkspace.code-workspace --enable-proposed-api=vscode.vscode-api-tests --extensionDevelopmentPath=%~dp0\..\extensions\vscode-api-tests --extensionTestsPath=%~dp0\..\extensions\vscode-api-tests\out\workspace-tests --disable-telemetry --crash-reporter-directory=%VSCODECRASHDIR% --no-cached-data --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR%
|
||||
if %errorlevel% neq 0 exit /b %errorlevel%
|
||||
|
||||
REM call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\typescript-language-features\test-workspace --extensionDevelopmentPath=%~dp0\..\extensions\typescript-language-features --extensionTestsPath=%~dp0\..\extensions\typescript-language-features\out\test --disable-telemetry --crash-reporter-directory=%VSCODECRASHDIR% --no-cached-data --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR%
|
||||
REM if %errorlevel% neq 0 exit /b %errorlevel%
|
||||
call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\typescript-language-features\test-workspace --extensionDevelopmentPath=%~dp0\..\extensions\typescript-language-features --extensionTestsPath=%~dp0\..\extensions\typescript-language-features\out\test\unit --disable-telemetry --crash-reporter-directory=%VSCODECRASHDIR% --no-cached-data --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR%
|
||||
if %errorlevel% neq 0 exit /b %errorlevel%
|
||||
|
||||
call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\markdown-language-features\test-workspace --extensionDevelopmentPath=%~dp0\..\extensions\markdown-language-features --extensionTestsPath=%~dp0\..\extensions\markdown-language-features\out\test --disable-telemetry --crash-reporter-directory=%VSCODECRASHDIR% --no-cached-data --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR%
|
||||
if %errorlevel% neq 0 exit /b %errorlevel%
|
||||
|
|
|
@ -75,8 +75,8 @@ after_suite
|
|||
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_EXTRA_ARGS $ROOT/extensions/markdown-language-features/test-workspace --extensionDevelopmentPath=$ROOT/extensions/markdown-language-features --extensionTestsPath=$ROOT/extensions/markdown-language-features/out/test --disable-telemetry --crash-reporter-directory=$VSCODECRASHDIR --no-cached-data --disable-updates --disable-extensions --user-data-dir=$VSCODEUSERDATADIR
|
||||
after_suite
|
||||
|
||||
#"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_EXTRA_ARGS $ROOT/extensions/typescript-language-features/test-workspace --extensionDevelopmentPath=$ROOT/extensions/typescript-language-features --extensionTestsPath=$ROOT/extensions/typescript-language-features/out/test --disable-telemetry --crash-reporter-directory=$VSCODECRASHDIR --no-cached-data --disable-updates --disable-extensions --user-data-dir=$VSCODEUSERDATADIR
|
||||
# after_suite
|
||||
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_EXTRA_ARGS $ROOT/extensions/typescript-language-features/test-workspace --extensionDevelopmentPath=$ROOT/extensions/typescript-language-features --extensionTestsPath=$ROOT/extensions/typescript-language-features/out/test/unit --disable-telemetry --crash-reporter-directory=$VSCODECRASHDIR --no-cached-data --disable-updates --disable-extensions --user-data-dir=$VSCODEUSERDATADIR
|
||||
after_suite
|
||||
|
||||
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_EXTRA_ARGS $ROOT/extensions/emmet/out/test/test-fixtures --extensionDevelopmentPath=$ROOT/extensions/emmet --extensionTestsPath=$ROOT/extensions/emmet/out/test --disable-telemetry --crash-reporter-directory=$VSCODECRASHDIR --no-cached-data --disable-updates --disable-extensions --user-data-dir=$VSCODEUSERDATADIR
|
||||
after_suite
|
||||
|
|
Loading…
Reference in a new issue