Skip to content

Commit

Permalink
Remove the setting 'java.test.saveAllBeforeLaunchTest'(#861)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdneo authored Oct 29, 2019
1 parent 8e425e9 commit fbb7313
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 24 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

### Removed
- The setting `java.test.forceBuildBeforeLaunchTest` is removed, please use `java.debug.settings.forceBuildBeforeLaunch` instead. [PR#850](https://github.com/microsoft/vscode-java-test/pull/850)
- The setting `java.test.saveAllBeforeLaunchTest` is removed, now the unsaved files will always be saved before launching the tests.[PR#861](https://github.com/microsoft/vscode-java-test/pull/861)

### Fixed
- [Bugs fixed](https://github.com/microsoft/vscode-java-test/issues?q=is%3Aissue+is%3Aclosed+label%3Abug+milestone%3A0.21.0)
Expand Down
6 changes: 0 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,6 @@
"description": "%configuration.java.test.editor.enableShortcuts.description%",
"scope": "application"
},
"java.test.saveAllBeforeLaunchTest": {
"type": "boolean",
"default": true,
"description": "%configuration.java.test.saveAllBeforeLaunchTest.description%",
"scope": "application"
},
"java.test.log.level": {
"type": "string",
"enum": [
Expand Down
1 change: 0 additions & 1 deletion package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"configuration.java.test.report.showAfterExecution.description": "Specify if the test report will automatically be shown after execution",
"configuration.java.test.report.position.description": "Specify where to show the test report",
"configuration.java.test.editor.enableShortcuts.description": "Specify whether to show the Code Lenses in editor or not",
"configuration.java.test.saveAllBeforeLaunchTest.description": "Specify whether to save all of the dirty files before lauching the test",
"configuration.java.test.log.level.description": "Specify the level of the test logs",
"configuration.java.test.message.hintForDeprecatedConfig.description": "Specify whether the extension will show hint dialog when deprecated configuration file is used",
"configuration.java.test.message.hintForSetingDefaultConfig.description": "Specify whether the extension will show hint to set default test configuration",
Expand Down
1 change: 0 additions & 1 deletion package.nls.zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"configuration.java.test.report.showAfterExecution.description": "设定测试报告是否会在测试完成后自动显示",
"configuration.java.test.report.position.description": "设定测试报告的显示位置",
"configuration.java.test.editor.enableShortcuts.description": "设定是否在编辑器内显示 Code Lens 快捷方式",
"configuration.java.test.saveAllBeforeLaunchTest.description": "设定在执行测试之前是否需要保存工作空间内的所有文件",
"configuration.java.test.log.level.description": "设定日志级别",
"configuration.java.test.message.hintForDeprecatedConfig.description": "设定插件是否会对使用弃用的配置文件进行提示",
"configuration.java.test.message.hintForSetingDefaultConfig.description": "设定插件是否会对设置默认测试配置项进行提示",
Expand Down
2 changes: 0 additions & 2 deletions src/constants/configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

export const LOCAL_HOST: string = '127.0.0.1';

export const SAVE_ALL_BEFORE_LAUNCH_SETTING_KEY: string = 'java.test.saveAllBeforeLaunchTest';

export const LOG_FILE_NAME: string = 'java_test_runner.log';
export const LOG_FILE_MAX_SIZE: number = 5 * 1024 * 1024;
export const LOG_FILE_MAX_NUMBER: number = 2;
Expand Down
10 changes: 1 addition & 9 deletions src/runners/runnerScheduler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { testResultManager } from '../testResultManager';
import { testStatusBarProvider } from '../testStatusBarProvider';
import { getResolvedRunConfig } from '../utils/configUtils';
import { resolveLaunchConfigurationForRunner } from '../utils/launchUtils';
import { getShowReportSetting, needSaveAll } from '../utils/settingUtils';
import { getShowReportSetting } from '../utils/settingUtils';
import * as uiUtils from '../utils/uiUtils';
import { BaseRunner } from './baseRunner/BaseRunner';
import { JUnitRunner } from './junitRunner/JunitRunner';
Expand All @@ -38,8 +38,6 @@ class RunnerScheduler {
this._isRunning = true;
let finalResults: ITestResult[] = [];

await this.saveFilesIfNeeded();

try {
this._runnerMap = this.classifyTestsByKind(testItems);
for (const [runner, tests] of this._runnerMap.entries()) {
Expand Down Expand Up @@ -90,12 +88,6 @@ class RunnerScheduler {
this._isRunning = false;
}

private async saveFilesIfNeeded(): Promise<void> {
if (needSaveAll()) {
await workspace.saveAll();
}
}

private classifyTestsByKind(tests: ITestItem[]): Map<BaseRunner, ITestItem[]> {
const testMap: Map<string, ITestItem[]> = this.mapTestsByProjectAndKind(tests);
return this.mapTestsByRunner(testMap);
Expand Down
6 changes: 1 addition & 5 deletions src/utils/settingUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import * as _ from 'lodash';
import { Uri, ViewColumn, workspace, WorkspaceConfiguration, WorkspaceFolder } from 'vscode';
import { DEFAULT_LOG_LEVEL, DEFAULT_REPORT_POSITION, DEFAULT_REPORT_SHOW, LOG_LEVEL_SETTING_KEY, REPORT_POSITION_SETTING_KEY, REPORT_SHOW_SETTING_KEY, SAVE_ALL_BEFORE_LAUNCH_SETTING_KEY } from '../constants/configs';
import { DEFAULT_LOG_LEVEL, DEFAULT_REPORT_POSITION, DEFAULT_REPORT_SHOW, LOG_LEVEL_SETTING_KEY, REPORT_POSITION_SETTING_KEY, REPORT_SHOW_SETTING_KEY } from '../constants/configs';
import { logger } from '../logger/logger';
import { IExecutionConfig } from '../runConfigs';

Expand All @@ -13,10 +13,6 @@ export function getReportPosition(): ViewColumn {
return position === DEFAULT_REPORT_POSITION ? ViewColumn.Two : ViewColumn.Active;
}

export function needSaveAll(): boolean {
return workspace.getConfiguration().get<boolean>(SAVE_ALL_BEFORE_LAUNCH_SETTING_KEY, true);
}

export function getLogLevel(): string {
return workspace.getConfiguration().get<string>(LOG_LEVEL_SETTING_KEY, DEFAULT_LOG_LEVEL);
}
Expand Down

0 comments on commit fbb7313

Please sign in to comment.