Enable ts tests on ./test-integration.sh (#101826)

* Enable ts tests on ./test-integration.sh

* Fix join lines for windows

* Fixing more tests for windows

Make sure we use the correct new line character

* Update test-ingration scripts
This commit is contained in:
Matt Bierner 2020-07-07 17:38:03 -07:00 committed by GitHub
parent b9a0407103
commit 46c2494cb0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 41 additions and 16 deletions

View file

@ -16,10 +16,12 @@ const insertModes = Object.freeze(['insert', 'replace']);
suite('TypeScript Completions', () => {
const configDefaults: VsCodeConfiguration = Object.freeze({
[Config.autoClosingBrackets]: 'always',
[Config.completeFunctionCalls]: false,
[Config.typescriptCompleteFunctionCalls]: false,
[Config.insertMode]: 'insert',
[Config.snippetSuggestions]: 'none',
[Config.suggestSelection]: 'first',
[Config.javascriptQuoteStyle]: 'double',
[Config.typescriptQuoteStyle]: 'double',
});
const _disposables: vscode.Disposable[] = [];
@ -178,7 +180,7 @@ suite('TypeScript Completions', () => {
});
test('completeFunctionCalls should complete function parameters when at end of word', async () => {
await updateConfig(testDocumentUri, { [Config.completeFunctionCalls]: true });
await updateConfig(testDocumentUri, { [Config.typescriptCompleteFunctionCalls]: true });
// Complete with-in word
const editor = await createTestEditor(testDocumentUri,
@ -196,7 +198,7 @@ suite('TypeScript Completions', () => {
});
test.skip('completeFunctionCalls should complete function parameters when within word', async () => {
await updateConfig(testDocumentUri, { [Config.completeFunctionCalls]: true });
await updateConfig(testDocumentUri, { [Config.typescriptCompleteFunctionCalls]: true });
const editor = await createTestEditor(testDocumentUri,
`function abcdef(x, y, z) { }`,
@ -213,7 +215,7 @@ suite('TypeScript Completions', () => {
});
test('completeFunctionCalls should not complete function parameters at end of word if we are already in something that looks like a function call, #18131', async () => {
await updateConfig(testDocumentUri, { [Config.completeFunctionCalls]: true });
await updateConfig(testDocumentUri, { [Config.typescriptCompleteFunctionCalls]: true });
const editor = await createTestEditor(testDocumentUri,
`function abcdef(x, y, z) { }`,
@ -230,7 +232,7 @@ suite('TypeScript Completions', () => {
});
test.skip('completeFunctionCalls should not complete function parameters within word if we are already in something that looks like a function call, #18131', async () => {
await updateConfig(testDocumentUri, { [Config.completeFunctionCalls]: true });
await updateConfig(testDocumentUri, { [Config.typescriptCompleteFunctionCalls]: true });
const editor = await createTestEditor(testDocumentUri,
`function abcdef(x, y, z) { }`,

View file

@ -6,7 +6,7 @@
import * as assert from 'assert';
import 'mocha';
import * as vscode from 'vscode';
import { CURSOR, withRandomFileEditor } from './testUtils';
import { CURSOR, withRandomFileEditor, joinLines } from './testUtils';
const onDocumentChange = (doc: vscode.TextDocument): Promise<vscode.TextDocument> => {
return new Promise<vscode.TextDocument>(resolve => {
@ -31,28 +31,44 @@ suite('OnEnter', () => {
test('should indent after if block with braces', () => {
return withRandomFileEditor(`if (true) {${CURSOR}`, 'js', async (_editor, document) => {
await type(document, '\nx');
assert.strictEqual(document.getText(), `if (true) {\n x`);
assert.strictEqual(
document.getText(),
joinLines(
`if (true) {`,
` x`));
});
});
test('should indent within empty object literal', () => {
return withRandomFileEditor(`({${CURSOR}})`, 'js', async (_editor, document) => {
await type(document, '\nx');
assert.strictEqual(document.getText(), `({\n x\n})`);
assert.strictEqual(
document.getText(),
joinLines(`({`,
` x`,
`})`));
});
});
test('should indent after simple jsx tag with attributes', () => {
return withRandomFileEditor(`const a = <div onclick={bla}>${CURSOR}`, 'jsx', async (_editor, document) => {
await type(document, '\nx');
assert.strictEqual(document.getText(), `const a = <div onclick={bla}>\n x`);
assert.strictEqual(
document.getText(),
joinLines(
`const a = <div onclick={bla}>`,
` x`));
});
});
test('should indent after simple jsx tag with attributes', () => {
return withRandomFileEditor(`const a = <div onclick={bla}>${CURSOR}`, 'jsx', async (_editor, document) => {
await type(document, '\nx');
assert.strictEqual(document.getText(), `const a = <div onclick={bla}>\n x`);
assert.strictEqual(
document.getText(),
joinLines(
`const a = <div onclick={bla}>`,
` x`));
});
});
});
});

View file

@ -70,7 +70,7 @@ export function withRandomFileEditor(
export const wait = (ms: number) => new Promise<undefined>(resolve => setTimeout(() => resolve(), ms));
export const joinLines = (...args: string[]) => args.join('\n');
export const joinLines = (...args: string[]) => args.join(os.platform() === 'win32' ? '\r\n' : '\n');
export async function createTestEditor(uri: vscode.Uri, ...lines: string[]) {
const document = await vscode.workspace.openTextDocument(uri);
@ -102,6 +102,7 @@ export type VsCodeConfiguration = { [key: string]: any };
export async function updateConfig(documentUri: vscode.Uri, newConfig: VsCodeConfiguration): Promise<VsCodeConfiguration> {
const oldConfig: VsCodeConfiguration = {};
const config = vscode.workspace.getConfiguration(undefined, documentUri);
for (const configKey of Object.keys(newConfig)) {
oldConfig[configKey] = config.get(configKey);
await new Promise((resolve, reject) =>
@ -113,10 +114,12 @@ export async function updateConfig(documentUri: vscode.Uri, newConfig: VsCodeCon
export const Config = Object.freeze({
autoClosingBrackets: 'editor.autoClosingBrackets',
completeFunctionCalls: 'typescript.suggest.completeFunctionCalls',
typescriptCompleteFunctionCalls: 'typescript.suggest.completeFunctionCalls',
insertMode: 'editor.suggest.insertMode',
snippetSuggestions: 'editor.snippetSuggestions',
suggestSelection: 'editor.suggestSelection',
javascriptQuoteStyle: 'javascript.preferences.quoteStyle',
typescriptQuoteStyle: 'typescript.preferences.quoteStyle',
} as const);
export const insertModesValues = Object.freeze(['insert', 'replace']);

View file

@ -38,8 +38,8 @@ if "%INTEGRATION_TEST_ELECTRON_PATH%"=="" (
)
:: Integration & performance tests in AMD
call .\scripts\test.bat --runGlob **\*.integrationTest.js %*
if %errorlevel% neq 0 exit /b %errorlevel%
::call .\scripts\test.bat --runGlob **\*.integrationTest.js %*
::if %errorlevel% neq 0 exit /b %errorlevel%
:: Tests in the extension host
@ -55,7 +55,10 @@ if %errorlevel% neq 0 exit /b %errorlevel%
call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\vscode-colorize-tests\test --extensionDevelopmentPath=%~dp0\..\extensions\vscode-colorize-tests --extensionTestsPath=%~dp0\..\extensions\vscode-colorize-tests\out --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\out\test\test-fixtures --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% .
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%
if %errorlevel% neq 0 exit /b %errorlevel%
call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\markdown-language-features\out\test\test-fixtures --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%
call "%INTEGRATION_TEST_ELECTRON_PATH%" $%~dp0\..\extensions\emmet\out\test\test-fixtures --extensionDevelopmentPath=%~dp0\..\extensions\emmet --extensionTestsPath=%~dp0\..\extensions\emmet\out\test --disable-telemetry --crash-reporter-directory=%VSCODECRASHDIR% --no-cached-data --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR% .

View file

@ -53,6 +53,7 @@ fi
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_NO_SANDBOX $ROOT/extensions/vscode-api-tests/testworkspace.code-workspace --enable-proposed-api=vscode.vscode-api-tests --extensionDevelopmentPath=$ROOT/extensions/vscode-api-tests --extensionTestsPath=$ROOT/extensions/vscode-api-tests/out/workspace-tests --disable-telemetry --crash-reporter-directory=$VSCODECRASHDIR --no-cached-data --disable-updates --disable-extensions --user-data-dir=$VSCODEUSERDATADIR
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_NO_SANDBOX $ROOT/extensions/vscode-colorize-tests/test --extensionDevelopmentPath=$ROOT/extensions/vscode-colorize-tests --extensionTestsPath=$ROOT/extensions/vscode-colorize-tests/out --disable-telemetry --crash-reporter-directory=$VSCODECRASHDIR --no-cached-data --disable-updates --disable-extensions --user-data-dir=$VSCODEUSERDATADIR
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_NO_SANDBOX $ROOT/extensions/markdown-language-features/out/test/test-fixtures --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
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_NO_SANDBOX $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
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_NO_SANDBOX $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
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_NO_SANDBOX $(mktemp -d 2>/dev/null) --enable-proposed-api=vscode.git --extensionDevelopmentPath=$ROOT/extensions/git --extensionTestsPath=$ROOT/extensions/git/out/test --disable-telemetry --crash-reporter-directory=$VSCODECRASHDIR --no-cached-data --disable-updates --disable-extensions --user-data-dir=$VSCODEUSERDATADIR