diff --git a/.github/workflows/apexE2E.yml b/.github/workflows/apexE2E.yml new file mode 100644 index 0000000000..d71f3d09c5 --- /dev/null +++ b/.github/workflows/apexE2E.yml @@ -0,0 +1,111 @@ +name: Apex End to End Tests + +on: + + workflow_dispatch: + inputs: + automationBranch: + description: 'Set the branch to use for automation tests' + required: false + default: 'develop' + type: string + apexLsp: + description: 'apexLsp.e2e.ts' + required: false + default: true + type: boolean + apexReplayDebugger: + description: 'apexReplayDebugger.e2e.ts' + required: false + default: true + type: boolean + debugApexTests: + description: 'debugApexTests.e2e.ts' + required: false + default: true + type: boolean + runApexTests: + description: 'runApexTests.e2e.ts' + required: false + default: true + type: boolean + trailApexReplayDebugger: + description: 'trailApexReplayDebugger.e2e.ts' + required: false + default: true + type: boolean + + workflow_call: + inputs: + automationBranch: + description: 'Set the branch to use for automation tests' + required: false + default: 'develop' + type: string + apexLsp: + description: 'apexLsp.e2e.ts' + required: false + default: true + type: boolean + apexReplayDebugger: + description: 'apexReplayDebugger.e2e.ts' + required: false + default: true + type: boolean + debugApexTests: + description: 'debugApexTests.e2e.ts' + required: false + default: true + type: boolean + runApexTests: + description: 'runApexTests.e2e.ts' + required: false + default: true + type: boolean + trailApexReplayDebugger: + description: 'trailApexReplayDebugger.e2e.ts' + required: false + default: true + type: boolean + +jobs: + + apexLSP: + if: ${{ inputs.apexLsp }} + uses: ./.github/workflows/runE2ETest.yml + secrets: inherit + with: + automationBranch: ${{ inputs.automationBranch }} + testToRun: 'apexLsp.e2e.ts' + + apexReplayDebugger: + if: ${{ inputs.apexReplayDebugger }} + uses: ./.github/workflows/runE2ETest.yml + secrets: inherit + with: + automationBranch: ${{ inputs.automationBranch }} + testToRun: 'apexReplayDebugger.e2e.ts' + + debugApexTests: + if: ${{ inputs.debugApexTests }} + uses: ./.github/workflows/runE2ETest.yml + secrets: inherit + with: + automationBranch: ${{ inputs.automationBranch }} + testToRun: 'debugApexTests.e2e.ts' + + runApexTests: + if: ${{ inputs.runApexTests }} + uses: ./.github/workflows/runE2ETest.yml + secrets: inherit + with: + automationBranch: ${{ inputs.automationBranch }} + testToRun: 'runApexTests.e2e.ts' + + trailApexReplayDebugger: + if: ${{ inputs.trailApexReplayDebugger }} + uses: ./.github/workflows/runE2ETest.yml + secrets: inherit + with: + automationBranch: ${{ inputs.automationBranch }} + testToRun: 'trailApexReplayDebugger.e2e.ts' diff --git a/.github/workflows/coreE2E.yml b/.github/workflows/coreE2E.yml new file mode 100644 index 0000000000..5eb4afb74c --- /dev/null +++ b/.github/workflows/coreE2E.yml @@ -0,0 +1,147 @@ +name: Core End to End Tests + +on: + + workflow_dispatch: + inputs: + automationBranch: + description: 'Set the branch to use for automation tests' + required: false + default: 'develop' + type: string + anInitialSuite: + description: 'anInitialSuite.e2e.ts' + required: false + default: true + type: boolean + authentication: + description: 'authentication.e2e.ts' + required: false + default: true + type: boolean + deployAndRetrieve: + description: 'deployAndRetrieve.e2e.ts' + required: false + default: true + type: boolean + manifestBuilder: + description: 'manifestBuilder.e2e.ts' + required: false + default: true + type: boolean + pushAndPull: + description: 'pushAndPull.e2e.ts' + required: false + default: true + type: boolean + sObjectsDefinitions: + description: 'sObjectsDefinitions.e2e.ts' + required: false + default: true + type: boolean + templates: + description: 'templates.e2e.ts' + required: false + default: true + type: boolean + + workflow_call: + inputs: + automationBranch: + description: 'Set the branch to use for automation tests' + required: false + default: 'develop' + type: string + anInitialSuite: + description: 'anInitialSuite.e2e.ts' + required: false + default: true + type: boolean + authentication: + description: 'authentication.e2e.ts' + required: false + default: true + type: boolean + deployAndRetrieve: + description: 'deployAndRetrieve.e2e.ts' + required: false + default: true + type: boolean + manifestBuilder: + description: 'manifestBuilder.e2e.ts' + required: false + default: true + type: boolean + pushAndPull: + description: 'pushAndPull.e2e.ts' + required: false + default: true + type: boolean + sObjectsDefinitions: + description: 'sObjectsDefinitions.e2e.ts' + required: false + default: true + type: boolean + templates: + description: 'templates.e2e.ts' + required: false + default: true + type: boolean + +jobs: + + anInitialSuite: + if: ${{ inputs.anInitialSuite }} + uses: ./.github/workflows/runE2ETest.yml + secrets: inherit + with: + automationBranch: ${{ inputs.automationBranch }} + testToRun: 'anInitialSuite.e2e.ts' + + authentication: + if: ${{ inputs.authentication }} + uses: ./.github/workflows/runE2ETest.yml + secrets: inherit + with: + automationBranch: ${{ inputs.automationBranch }} + testToRun: 'authentication.e2e.ts' + + deployAndRetrieve: + if: ${{ inputs.deployAndRetrieve }} + uses: ./.github/workflows/runE2ETest.yml + secrets: inherit + with: + automationBranch: ${{ inputs.automationBranch }} + testToRun: 'deployAndRetrieve.e2e.ts' + + manifestBuilder: + if: ${{ inputs.manifestBuilder }} + uses: ./.github/workflows/runE2ETest.yml + secrets: inherit + with: + automationBranch: ${{ inputs.automationBranch }} + testToRun: 'manifestBuilder.e2e.ts' + + pushAndPull: + if: ${{ inputs.pushAndPull }} + uses: ./.github/workflows/runE2ETest.yml + secrets: inherit + with: + automationBranch: ${{ inputs.automationBranch }} + testToRun: 'pushAndPull.e2e.ts' + + sObjectsDefinitions: + if: ${{ inputs.sObjectsDefinitions }} + uses: ./.github/workflows/runE2ETest.yml + secrets: inherit + with: + automationBranch: ${{ inputs.automationBranch }} + testToRun: 'sObjectsDefinitions.e2e.ts' + + templates: + if: ${{ inputs.templates }} + uses: ./.github/workflows/runE2ETest.yml + secrets: inherit + with: + automationBranch: ${{ inputs.automationBranch }} + testToRun: 'templates.e2e.ts' \ No newline at end of file diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index acc9a1a8e6..cb43c3548e 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -7,103 +7,41 @@ on: required: false default: 'develop' type: string - specFiles: - description: 'Run a specific spec file. Runs all by default.' + apexE2ETests: + description: 'Apex E2E Tests' required: false - type: choice - options: - - '*.e2e.ts' - - 'anInitialSuite.e2e.ts' - - 'apexLsp.e2e.ts' - - 'apexReplayDebugger.e2e.ts' - - 'auraLsp.e2e.ts' - - 'authentication.e2e.ts' - - 'debugApexTests.e2e.ts' - - 'deployAndRetrieve.e2e.ts' - - 'lwcLsp.e2e.ts' - - 'manifestBuilder.e2e.ts' - - 'orgBrowser.e2e.ts' - - 'pushAndPull.e2e.ts' - - 'runApexTests.e2e.ts' - - 'sObjectsDefinitions.e2e.ts' - - 'templates.e2e.ts' - - 'trailApexReplayDebugger.e2e.ts' - - 'visualforceLsp.e2e.ts' + default: true + type: boolean + coreE2ETests: + description: 'Core E2E Tests' + required: false + default: true + type: boolean + lspE2ETests: + description: 'LSP E2E Tests' + required: false + default: true + type: boolean jobs: - build: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [macos-latest, windows-latest, ubuntu-latest] - nodeVersion: - - 16.15.1 - vscodeVersion: - - stable - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - path: ./salesforcedx-vscode - ref: ${{ github.event.ref }} - - name: Setup node - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.nodeVersion }} - cache: npm - cache-dependency-path: | - salesforcedx-vscode/package-lock.json - salesforcedx-vscode-automation-tests/package-lock.json - - name: Setup java - uses: actions/setup-java@v3 - with: - distribution: 'zulu' - java-version: '11' - - name: Clone automation tests - uses: actions/checkout@v3 - with: - repository: forcedotcom/salesforcedx-vscode-automation-tests - path: salesforcedx-vscode-automation-tests - ref: ${{ inputs.automationBranch }} - - name: Install Extension Dependencies - run: | - npm install - npm run compile - working-directory: salesforcedx-vscode - - name: Install Test Dependencies - run: | - npm install - working-directory: salesforcedx-vscode-automation-tests - - name: Install the SFDX CLI - run: npm install -g sfdx-cli - - name: Verify CLI - shell: bash - run: | - set -e - sfdx version - SFDX_CLI_VERSION=$(sfdx version) - if [[ ((`echo $SFDX_CLI_VERSION | grep -c "sfdx-cli/"` > 0))]] - then - echo "sfdx-cli installed -" $SFDX_CLI_VERSION - else - echo "The sfdx-cli installation could not be verified" - exit 1 - fi - - name: Run headless test - uses: coactions/setup-xvfb@b6b4fcfb9f5a895edadc3bc76318fae0ac17c8b3 - with: - run: | - npm run setup - npm run automation-tests - working-directory: salesforcedx-vscode-automation-tests - env: - VSCODE_VERSION: ${{ matrix.vscodeVersion }} - SPEC_FILES: ${{ inputs.specFiles || '*.e2e.ts' }} - SFDX_AUTH_URL: ${{ secrets.SFDX_AUTH_URL_E2E }} - ORG_ID: ${{ secrets.ORG_ID_E2E }} - - uses: actions/upload-artifact@v3 - if: failure() - with: - name: screenshots - path: ./salesforcedx-vscode-automation-tests/screenshots + + Apex_E2E_tests: + if: ${{ inputs.apexE2ETests }} + uses: ./.github/workflows/apexE2E.yml + secrets: inherit + with: + automationBranch: ${{ inputs.automationBranch }} + + Core_E2E_tests: + if: ${{ inputs.coreE2ETests }} + uses: ./.github/workflows/coreE2E.yml + secrets: inherit + with: + automationBranch: ${{ inputs.automationBranch }} + + LSP_E2E_tests: + if: ${{ inputs.lspE2ETests }} + uses: ./.github/workflows/lspE2E.yml + secrets: inherit + with: + automationBranch: ${{ inputs.automationBranch }} diff --git a/.github/workflows/lspE2E.yml b/.github/workflows/lspE2E.yml new file mode 100644 index 0000000000..69913260a1 --- /dev/null +++ b/.github/workflows/lspE2E.yml @@ -0,0 +1,57 @@ +name: LSP End to End Tests + +on: + + workflow_dispatch: + inputs: + automationBranch: + description: 'Set the branch to use for automation tests' + required: false + default: 'develop' + type: string + auraLsp: + description: 'auraLsp.e2e.ts' + required: false + default: true + type: boolean + visualforceLsp: + description: 'visualforceLsp.e2e.ts' + required: false + default: true + type: boolean + + workflow_call: + inputs: + automationBranch: + description: 'Set the branch to use for automation tests' + required: false + default: 'develop' + type: string + auraLsp: + description: 'auraLsp.e2e.ts' + required: false + default: true + type: boolean + visualforceLsp: + description: 'visualforceLsp.e2e.ts' + required: false + default: true + type: boolean + +jobs: + + auraLSP: + if: ${{ inputs.auraLsp }} + uses: ./.github/workflows/runE2ETest.yml + secrets: inherit + with: + automationBranch: ${{ inputs.automationBranch }} + testToRun: 'auraLsp.e2e.ts' + + visualforceLSP: + if: ${{ inputs.visualforceLsp }} + uses: ./.github/workflows/runE2ETest.yml + secrets: inherit + with: + automationBranch: ${{ inputs.automationBranch }} + testToRun: 'visualforceLsp.e2e.ts' diff --git a/.github/workflows/runE2ETest.yml b/.github/workflows/runE2ETest.yml new file mode 100644 index 0000000000..f1454fd96b --- /dev/null +++ b/.github/workflows/runE2ETest.yml @@ -0,0 +1,91 @@ +name: Run E2E Test +on: + workflow_call: + inputs: + automationBranch: + description: 'Set the branch to use for automation tests' + required: false + default: 'develop' + type: string + testToRun: + description: 'Run this E2E test' + required: false + type: string + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [macos-latest, windows-latest, ubuntu-latest] + nodeVersion: + - 16.15.1 + vscodeVersion: + - stable + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + path: ./salesforcedx-vscode + ref: ${{ github.event.ref }} + - name: Setup node + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.nodeVersion }} + cache: npm + cache-dependency-path: | + salesforcedx-vscode/package-lock.json + salesforcedx-vscode-automation-tests/package-lock.json + - name: Setup java + uses: actions/setup-java@v3 + with: + distribution: 'zulu' + java-version: '11' + - name: Clone automation tests + uses: actions/checkout@v3 + with: + repository: forcedotcom/salesforcedx-vscode-automation-tests + path: salesforcedx-vscode-automation-tests + ref: ${{ inputs.automationBranch }} + - name: Install Extension Dependencies + run: | + npm install + npm run compile + working-directory: salesforcedx-vscode + - name: Install Test Dependencies + run: | + npm install + working-directory: salesforcedx-vscode-automation-tests + - name: Install the SFDX CLI + run: npm install -g sfdx-cli + - name: Verify CLI + shell: bash + run: | + set -e + sfdx version + SFDX_CLI_VERSION=$(sfdx version) + if [[ ((`echo $SFDX_CLI_VERSION | grep -c "sfdx-cli/"` > 0))]] + then + echo "sfdx-cli installed -" $SFDX_CLI_VERSION + else + echo "The sfdx-cli installation could not be verified" + exit 1 + fi + - name: Run headless test + uses: coactions/setup-xvfb@b6b4fcfb9f5a895edadc3bc76318fae0ac17c8b3 + with: + run: | + npm run setup + npm run automation-tests + working-directory: salesforcedx-vscode-automation-tests + env: + VSCODE_VERSION: ${{ matrix.vscodeVersion }} + SPEC_FILES: ${{ inputs.testToRun }} + SFDX_AUTH_URL: ${{ secrets.SFDX_AUTH_URL_E2E }} + ORG_ID: ${{ secrets.ORG_ID_E2E }} + - uses: actions/upload-artifact@v3 + if: failure() + with: + name: screenshots + path: ./salesforcedx-vscode-automation-tests/screenshots diff --git a/packages/salesforcedx-utils-vscode/src/commands/commandletExecutors.ts b/packages/salesforcedx-utils-vscode/src/commands/commandletExecutors.ts index 4fa06f9e18..a2f26cba93 100644 --- a/packages/salesforcedx-utils-vscode/src/commands/commandletExecutors.ts +++ b/packages/salesforcedx-utils-vscode/src/commands/commandletExecutors.ts @@ -76,7 +76,7 @@ export abstract class SfdxCommandletExecutor const cancellationToken = cancellationTokenSource.token; const execution = new CliCommandExecutor(this.build(response.data), { cwd: this.executionCwd, - env: { SFDX_JSON_TO_STDOUT: 'true' } + env: { SF_JSON_TO_STDOUT: 'true' } }).execute(cancellationToken); let output = ''; diff --git a/packages/salesforcedx-utils-vscode/test/unit/cli/orgOpenContainerResultParser.test.ts b/packages/salesforcedx-utils-vscode/test/unit/cli/orgOpenContainerResultParser.test.ts index 5b6b2d33d5..47c54cad31 100644 --- a/packages/salesforcedx-utils-vscode/test/unit/cli/orgOpenContainerResultParser.test.ts +++ b/packages/salesforcedx-utils-vscode/test/unit/cli/orgOpenContainerResultParser.test.ts @@ -15,7 +15,7 @@ import { } from '../../../src/cli'; // tslint:disable:no-unused-expression -describe('force:org:open container parser', () => { +describe('org:open container parser', () => { const orgOpenSuccessResult: OrgOpenSuccessResult = { status: 0, result: { @@ -73,10 +73,10 @@ describe('force:org:open container parser', () => { it('Should parse success info successfully when provided along other info', () => { const parser = new OrgOpenContainerResultParser( - `Warning: sfdx-cli update available from 7.7.0 to 7.14.0.${EOL} sfdx force:org:open --json --loglevel fatal ${EOL} + `Warning: sfdx-cli update available from 7.7.0 to 7.14.0.${EOL} sfdx org:open --json --loglevel fatal ${EOL} ${JSON.stringify( orgOpenSuccessResult - )} ${EOL} sfdx force:org:open --json --loglevel fatal ended with exit code 0` + )} ${EOL} sfdx org:open --json --loglevel fatal ended with exit code 0` ); expect(parser.openIsSuccessful()).to.be.true; @@ -94,7 +94,7 @@ describe('force:org:open container parser', () => { it('should throw an error when cli does not respond with json result info', () => { try { new OrgOpenContainerResultParser( - 'sfdx force:org:open --urlonly --json --loglevel fatal ended with exit code 0' + 'sfdx org:open --url-only --json --loglevel fatal ended with exit code 0' ); } catch (err) { if (err instanceof Error) { diff --git a/packages/salesforcedx-vscode-apex/package.nls.json b/packages/salesforcedx-vscode-apex/package.nls.json index 65ff85d2f9..635b73f52d 100644 --- a/packages/salesforcedx-vscode-apex/package.nls.json +++ b/packages/salesforcedx-vscode-apex/package.nls.json @@ -7,7 +7,7 @@ "run_single_test_title": "Run Single Test", "show_error_title": "Display Error", "go_to_definition_title": "Go to Definition", - "java_home_description": "Specifies the folder path to the Java 8, Java 11, or Java 17 runtime used to launch the Apex Language Server (for example, /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home).", + "java_home_description": "Specifies the folder path to the Java 11, or Java 17 runtime used to launch the Apex Language Server (for example, /Library/Java/JavaVirtualMachines/openjdk-11.jdk/Contents/Home).", "java_memory_description": "Specifies the amount of memory allocation to the Apex Language Server in MB, or null to use the system default value.", "apex_semantic_errors_description": "Allow Apex Language Server to surface semantic errors", "force_anon_apex_execute_document_text": "SFDX: Execute Anonymous Apex with Editor Contents", diff --git a/packages/salesforcedx-vscode-apex/src/index.ts b/packages/salesforcedx-vscode-apex/src/index.ts index 21751e544b..fbf42cef00 100644 --- a/packages/salesforcedx-vscode-apex/src/index.ts +++ b/packages/salesforcedx-vscode-apex/src/index.ts @@ -28,7 +28,7 @@ import { forceApexTestSuiteRun, forceLaunchApexReplayDebuggerWithCurrentFile } from './commands'; -import { APEX_EXTENSION_NAME, LSP_ERR } from './constants'; +import { APEX_EXTENSION_NAME, LSP_ERR, SET_JAVA_DOC_LINK } from './constants'; import { workspaceContext } from './context'; import { ClientStatus, @@ -326,8 +326,12 @@ async function createLanguageClient(extensionContext: vscode.ExtensionContext) { extensionContext.subscriptions.push(handle); } catch (e) { languageClientUtils.setStatus(ClientStatus.Error, e); + let eMsg = typeof e === 'string' ? e : e.message ?? nls.localize('unknown_error'); + if (eMsg.includes(nls.localize('wrong_java_version_text', SET_JAVA_DOC_LINK))) { + eMsg = nls.localize('wrong_java_version_short'); + } languageServerStatusBarItem.error( - `${nls.localize('apex_language_server_failed_activate')} - ${e.message}` + `${nls.localize('apex_language_server_failed_activate')} - ${eMsg}` ); } } @@ -361,8 +365,7 @@ function addOnReadyHandlerToLanguageClient( nls.localize('apex_language_server_failed_activate') ); languageServerStatusBarItem.error( - `${nls.localize('apex_language_server_failed_activate')} - ${ - err.message + `${nls.localize('apex_language_server_failed_activate')} - ${err.message }` ); }); diff --git a/packages/salesforcedx-vscode-apex/src/messages/i18n.ja.ts b/packages/salesforcedx-vscode-apex/src/messages/i18n.ja.ts index 2f9f30b24d..c35610e748 100644 --- a/packages/salesforcedx-vscode-apex/src/messages/i18n.ja.ts +++ b/packages/salesforcedx-vscode-apex/src/messages/i18n.ja.ts @@ -75,7 +75,7 @@ export const messages = { source_missing_text: '指定されたフォルダ %s は存在しません。Salesforce Apex 拡張機能の設定方法についての詳細は、[Java 設定](%s) を参照してください。', wrong_java_version_text: - 'サポートされていない Java のバージョンが検出されました。拡張機能を実行するには、[Java 8](https://java.com/en/download/)、[Java 11](https://www.oracle.com/technetwork/java/javase/downloads/jdk11-downloads-5066655.html)、または [Java 17](https://www.oracle.com/java/technologies/downloads/#java17) をダウンロードし、インストールしてください。詳細については、[Java バージョンを設定する](%s) を参照してください。', + 'サポートされていない Java のバージョンが検出されました。拡張機能を実行するには、[Java 11](https://www.oracle.com/technetwork/java/javase/downloads/jdk11-downloads-5066655.html)、または [Java 17](https://www.oracle.com/java/technologies/downloads/#java17) をダウンロードし、インストールしてください。詳細については、[Java バージョンを設定する](%s) を参照してください。', force_apex_test_suite_build_text: 'SFDX: Apex テストスイートを作成', unable_to_locate_editor: 'ソースファイルに対してのみこのコマンドを実行できます。', diff --git a/packages/salesforcedx-vscode-apex/src/messages/i18n.ts b/packages/salesforcedx-vscode-apex/src/messages/i18n.ts index 953884f8bc..f35fd93e53 100644 --- a/packages/salesforcedx-vscode-apex/src/messages/i18n.ts +++ b/packages/salesforcedx-vscode-apex/src/messages/i18n.ts @@ -77,10 +77,13 @@ export const messages = { source_missing_text: '%s points to a missing folder. For information on how to setup the Salesforce Apex extension, see [Set Your Java Version](%s).', wrong_java_version_text: - 'An unsupported Java version was detected. Download and install [Java 8](https://java.com/en/download/), [Java 11](https://www.oracle.com/technetwork/java/javase/downloads/jdk11-downloads-5066655.html), or [Java 17](https://www.oracle.com/java/technologies/downloads/#java17) to run the extensions. For more information, see [Set Your Java Version](%s).', + 'An unsupported Java version was detected. Download and install [Java 11](https://www.oracle.com/technetwork/java/javase/downloads/jdk11-downloads-5066655.html), or [Java 17](https://www.oracle.com/java/technologies/downloads/#java17) to run the extensions. For more information, see [Set Your Java Version](%s).', + wrong_java_version_short: + 'Unsupported Java version', force_apex_test_suite_build_text: 'SFDX: Build Apex Test Suite', unable_to_locate_editor: 'You can run this command only on a source file.', unable_to_locate_document: 'You can run this command only on a source file.', launch_apex_replay_debugger_unsupported_file: - 'You can only run this command with Anonymous Apex files, Apex Test files, or Apex Debug Log files.' + 'You can only run this command with Anonymous Apex files, Apex Test files, or Apex Debug Log files.', + unknown_error: 'Unknown error' }; diff --git a/packages/salesforcedx-vscode-apex/src/requirements.ts b/packages/salesforcedx-vscode-apex/src/requirements.ts index 865388ed38..e96c9e44bd 100644 --- a/packages/salesforcedx-vscode-apex/src/requirements.ts +++ b/packages/salesforcedx-vscode-apex/src/requirements.ts @@ -108,7 +108,6 @@ export function checkJavaVersion(javaHome: string): Promise { {}, (error, stdout, stderr) => { if ( - stderr.indexOf('build 1.8') < 0 && stderr.indexOf('build 11.') < 0 && stderr.indexOf('build 17.') < 0 ) { diff --git a/packages/salesforcedx-vscode-apex/test/vscode-integration/languageClientUtils/languageClientUtils.test.ts b/packages/salesforcedx-vscode-apex/test/jest/languageUtils/languageClientUtils.test.ts similarity index 100% rename from packages/salesforcedx-vscode-apex/test/vscode-integration/languageClientUtils/languageClientUtils.test.ts rename to packages/salesforcedx-vscode-apex/test/jest/languageUtils/languageClientUtils.test.ts diff --git a/packages/salesforcedx-vscode-apex/test/vscode-integration/requirements.test.ts b/packages/salesforcedx-vscode-apex/test/vscode-integration/requirements.test.ts index c872ef85f9..e6936532ba 100644 --- a/packages/salesforcedx-vscode-apex/test/vscode-integration/requirements.test.ts +++ b/packages/salesforcedx-vscode-apex/test/vscode-integration/requirements.test.ts @@ -62,19 +62,19 @@ describe('Java Requirements Test', () => { it('Should allow valid java runtime path outside the project', async () => { settingStub.withArgs(JAVA_HOME_KEY).returns(runtimePath); - execFileStub.yields('', '', 'build 1.8'); + execFileStub.yields('', '', 'build 11.0.0'); const requirements = await resolveRequirements(); expect(requirements.java_home).contains(jdk); }); - it('Should support Java 8', async () => { + it('Should not support Java 8', async () => { execFileStub.yields('', '', 'build 1.8.0'); try { - const result = await checkJavaVersion('~/java_home'); - expect(result).to.equal(true); + await checkJavaVersion('~/java_home'); + fail('Should have thrown when the Java version is not supported'); } catch (err) { - fail( - `Should not have thrown when the Java version is 17. The error was: ${err}` + expect(err).to.equal( + nls.localize('wrong_java_version_text', SET_JAVA_DOC_LINK) ); } }); diff --git a/packages/salesforcedx-vscode-core/package.json b/packages/salesforcedx-vscode-core/package.json index c8d8da3b76..e334a86156 100644 --- a/packages/salesforcedx-vscode-core/package.json +++ b/packages/salesforcedx-vscode-core/package.json @@ -341,7 +341,7 @@ "when": "sfdx:project_opened" }, { - "command": "sfdx.force.auth.dev.hub", + "command": "sfdx.org.login.web.dev.hub", "when": "sfdx:project_opened" }, { @@ -349,7 +349,7 @@ "when": "sfdx:project_opened" }, { - "command": "sfdx.force.auth.web.login", + "command": "sfdx.org.login.web", "when": "sfdx:project_opened" }, { @@ -369,7 +369,7 @@ "when": "sfdx:project_opened" }, { - "command": "sfdx.force.org.open", + "command": "sfdx.org.open", "when": "sfdx:project_opened" }, { @@ -628,12 +628,12 @@ "title": "%force_package_install_text%" }, { - "command": "sfdx.force.auth.dev.hub", - "title": "%force_auth_web_login_authorize_dev_hub_text%" + "command": "sfdx.org.login.web.dev.hub", + "title": "%org_login_web_authorize_dev_hub_text%" }, { - "command": "sfdx.force.auth.web.login", - "title": "%force_auth_web_login_authorize_org_text%" + "command": "sfdx.org.login.web", + "title": "%org_login_web_authorize_org_text%" }, { "command": "sfdx.force.auth.accessToken", @@ -656,8 +656,8 @@ "title": "%force_org_create_default_scratch_org_text%" }, { - "command": "sfdx.force.org.open", - "title": "%force_org_open_default_scratch_org_text%" + "command": "sfdx.org.open", + "title": "%org_open_default_scratch_org_text%" }, { "command": "sfdx.force.source.pull", diff --git a/packages/salesforcedx-vscode-core/package.nls.ja.json b/packages/salesforcedx-vscode-core/package.nls.ja.json index 7dbd869831..69b5b4f1c1 100644 --- a/packages/salesforcedx-vscode-core/package.nls.ja.json +++ b/packages/salesforcedx-vscode-core/package.nls.ja.json @@ -1,12 +1,12 @@ { "running_tasks_title_text": "実行中のタスク", - "force_auth_web_login_authorize_dev_hub_text": "SFDX: Dev Hub を認証", - "force_auth_web_login_authorize_org_text": "SFDX: 組織を認証", + "org_login_web_authorize_dev_hub_text": "SFDX: Dev Hub を認証", + "org_login_web_authorize_org_text": "SFDX: 組織を認証", "force_auth_access_token_authorize_org_text": "SFDX: Authorize an Org using Session ID", "force_auth_logout_all_text": "SFDX: すべての認証済み組織からログアウト", "force_auth_logout_default_text": "SFDX: Log Out from Default Org", "force_org_create_default_scratch_org_text": "SFDX: デフォルトのスクラッチ組織を作成...", - "force_org_open_default_scratch_org_text": "SFDX: デフォルトの組織を開く", + "org_open_default_scratch_org_text": "SFDX: デフォルトの組織を開く", "force_source_pull_default_org_text": "SFDX: デフォルトのスクラッチ組織からソースをプル", "force_source_pull_force_default_org_text": "SFDX: デフォルトのスクラッチ組織からソースをプルして競合を上書き", "force_source_push_default_org_text": "SFDX: デフォルトのスクラッチ組織へソースをプッシュ", diff --git a/packages/salesforcedx-vscode-core/package.nls.json b/packages/salesforcedx-vscode-core/package.nls.json index b2e607fa47..5d09d92d13 100644 --- a/packages/salesforcedx-vscode-core/package.nls.json +++ b/packages/salesforcedx-vscode-core/package.nls.json @@ -1,13 +1,13 @@ { "running_tasks_title_text": "Running Tasks", - "force_auth_web_login_authorize_dev_hub_text": "SFDX: Authorize a Dev Hub", - "force_auth_web_login_authorize_org_text": "SFDX: Authorize an Org", + "org_login_web_authorize_dev_hub_text": "SFDX: Authorize a Dev Hub", + "org_login_web_authorize_org_text": "SFDX: Authorize an Org", "force_auth_access_token_authorize_org_text": "SFDX: Authorize an Org using Session ID", "force_auth_logout_all_text": "SFDX: Log Out from All Authorized Orgs", "force_auth_logout_default_text": "SFDX: Log Out from Default Org", "force_open_documentation_text": "SFDX: Open Documentation", "force_org_create_default_scratch_org_text": "SFDX: Create a Default Scratch Org...", - "force_org_open_default_scratch_org_text": "SFDX: Open Default Org", + "org_open_default_scratch_org_text": "SFDX: Open Default Org", "force_source_pull_default_org_text": "SFDX: Pull Source from Default Org", "force_source_pull_force_default_org_text": "SFDX: Pull Source from Default Org and Override Conflicts", "force_source_push_default_org_text": "SFDX: Push Source to Default Org", diff --git a/packages/salesforcedx-vscode-core/src/commands/auth/forceAuthWebLogin.ts b/packages/salesforcedx-vscode-core/src/commands/auth/orgLoginWeb.ts similarity index 81% rename from packages/salesforcedx-vscode-core/src/commands/auth/forceAuthWebLogin.ts rename to packages/salesforcedx-vscode-core/src/commands/auth/orgLoginWeb.ts index d16e1d8c40..5383136bb5 100644 --- a/packages/salesforcedx-vscode-core/src/commands/auth/forceAuthWebLogin.ts +++ b/packages/salesforcedx-vscode-core/src/commands/auth/orgLoginWeb.ts @@ -46,7 +46,7 @@ export interface DeviceCodeResponse { verification_uri: string; } -export class ForceAuthWebLoginContainerExecutor extends SfdxCommandletExecutor< +export class OrgLoginWebContainerExecutor extends SfdxCommandletExecutor< AuthParams > { protected showChannelOutput = false; @@ -55,15 +55,15 @@ export class ForceAuthWebLoginContainerExecutor extends SfdxCommandletExecutor< public build(data: AuthParams): Command { const command = new SfdxCommandBuilder().withDescription( - nls.localize('force_auth_web_login_authorize_org_text') + nls.localize('org_login_web_authorize_org_text') ); command - .withArg(CLI.AUTH_DEVICE_LOGIN) + .withArg(CLI.ORG_LOGIN_DEVICE) .withLogName('force_auth_device_login') - .withFlag('--setalias', data.alias) - .withFlag('--instanceurl', data.loginUrl) - .withArg('--setdefaultusername') + .withFlag('--alias', data.alias) + .withFlag('--instance-url', data.loginUrl) + .withArg('--set-default') .withJson(); return command.build(); @@ -75,7 +75,7 @@ export class ForceAuthWebLoginContainerExecutor extends SfdxCommandletExecutor< const cancellationToken = cancellationTokenSource.token; const execution = new CliCommandExecutor(this.build(response.data), { cwd: workspaceUtils.getRootWorkspacePath(), - env: { SFDX_JSON_TO_STDOUT: 'true' } + env: { SF_JSON_TO_STDOUT: 'true' } }).execute(cancellationToken); channelService.streamCommandStartStop(execution); @@ -126,7 +126,7 @@ export class ForceAuthWebLoginContainerExecutor extends SfdxCommandletExecutor< } } catch (error) { channelService.appendLine( - nls.localize('force_auth_web_login_device_code_parse_error') + nls.localize('org_login_device_code_parse_error') ); telemetryService.sendException( 'force_auth_web_container', @@ -141,28 +141,26 @@ export class ForceAuthWebLoginContainerExecutor extends SfdxCommandletExecutor< channelService.appendLine(`${EOL}`); channelService.appendLine(nls.localize('action_required')); channelService.appendLine( - nls.localize('force_auth_device_login_enter_code', code, url) + nls.localize('org_login_device_enter_code', code, url) ); channelService.appendLine(`${EOL}`); } } -export class ForceAuthWebLoginExecutor extends SfdxCommandletExecutor< - AuthParams -> { +export class OrgLoginWebExecutor extends SfdxCommandletExecutor { protected showChannelOutput = false; public build(data: AuthParams): Command { const command = new SfdxCommandBuilder().withDescription( - nls.localize('force_auth_web_login_authorize_org_text') + nls.localize('org_login_web_authorize_org_text') ); command - .withArg(CLI.AUTH_WEB_LOGIN) + .withArg(CLI.ORG_LOGIN_WEB) .withLogName('force_auth_web_login') - .withFlag('--setalias', data.alias) - .withFlag('--instanceurl', data.loginUrl) - .withArg('--setdefaultusername'); + .withFlag('--alias', data.alias) + .withFlag('--instance-url', data.loginUrl) + .withArg('--set-default'); return command.build(); } @@ -209,17 +207,17 @@ export abstract class ForceAuthDemoModeExecutor< } } -export class ForceAuthWebLoginDemoModeExecutor extends ForceAuthDemoModeExecutor< +export class OrgLoginWebDemoModeExecutor extends ForceAuthDemoModeExecutor< AuthParams > { public build(data: AuthParams): Command { return new SfdxCommandBuilder() - .withDescription(nls.localize('force_auth_web_login_authorize_org_text')) - .withArg(CLI.AUTH_WEB_LOGIN) - .withFlag('--setalias', data.alias) - .withFlag('--instanceurl', data.loginUrl) - .withArg('--setdefaultusername') - .withArg('--noprompt') + .withDescription(nls.localize('org_login_web_authorize_org_text')) + .withArg(CLI.ORG_LOGIN_WEB) + .withFlag('--alias', data.alias) + .withFlag('--instance-url', data.loginUrl) + .withArg('--set-default') + .withArg('--no-prompt') .withJson() .withLogName('force_auth_web_login_demo_mode') .build(); @@ -237,22 +235,22 @@ export async function promptLogOutForProdOrg() { const workspaceChecker = new SfdxWorkspaceChecker(); const parameterGatherer = new AuthParamsGatherer(); -export function createAuthWebLoginExecutor(): SfdxCommandletExecutor<{}> { +export function createOrgLoginWebExecutor(): SfdxCommandletExecutor<{}> { switch (true) { case isSFContainerMode(): - return new ForceAuthWebLoginContainerExecutor(); + return new OrgLoginWebContainerExecutor(); case isDemoMode(): - return new ForceAuthWebLoginDemoModeExecutor(); + return new OrgLoginWebDemoModeExecutor(); default: - return new ForceAuthWebLoginExecutor(); + return new OrgLoginWebExecutor(); } } -export async function forceAuthWebLogin() { +export async function orgLoginWeb() { const commandlet = new SfdxCommandlet( workspaceChecker, parameterGatherer, - createAuthWebLoginExecutor() + createOrgLoginWebExecutor() ); await commandlet.run(); } diff --git a/packages/salesforcedx-vscode-core/src/commands/auth/forceAuthDevHub.ts b/packages/salesforcedx-vscode-core/src/commands/auth/orgLoginWebDevHub.ts similarity index 64% rename from packages/salesforcedx-vscode-core/src/commands/auth/forceAuthDevHub.ts rename to packages/salesforcedx-vscode-core/src/commands/auth/orgLoginWebDevHub.ts index e43ea80d9c..fe94b8d014 100644 --- a/packages/salesforcedx-vscode-core/src/commands/auth/forceAuthDevHub.ts +++ b/packages/salesforcedx-vscode-core/src/commands/auth/orgLoginWebDevHub.ts @@ -6,7 +6,6 @@ */ import { - CliCommandExecutor, Command, SfdxCommandBuilder } from '@salesforce/salesforcedx-utils-vscode'; @@ -19,38 +18,31 @@ import { SfdxWorkspaceChecker } from '../util'; -import { workspaceUtils } from '../../util'; - -import { ConfigFile } from '@salesforce/core'; import { CancelResponse, - ConfigSource, ContinueResponse, - isNullOrUndefined, isSFContainerMode, ParametersGatherer } from '@salesforce/salesforcedx-utils-vscode'; -import { homedir } from 'os'; import * as vscode from 'vscode'; -import { CLI, SFDX_CONFIG_FILE } from '../../constants'; +import { CLI } from '../../constants'; import { nls } from '../../messages'; import { isDemoMode } from '../../modes/demo-mode'; -import { OrgAuthInfo } from '../../util/index'; import { ForceAuthDemoModeExecutor, - ForceAuthWebLoginContainerExecutor -} from './forceAuthWebLogin'; + OrgLoginWebContainerExecutor +} from './orgLoginWeb'; -export class ForceAuthDevHubContainerExecutor extends ForceAuthWebLoginContainerExecutor { +export class OrgLoginWebDevHubContainerExecutor extends OrgLoginWebContainerExecutor { public build(data: AuthDevHubParams): Command { const command = new SfdxCommandBuilder().withDescription( - nls.localize('force_auth_web_login_authorize_dev_hub_text') + nls.localize('org_login_web_authorize_dev_hub_text') ); command - .withArg(CLI.AUTH_DEVICE_LOGIN) - .withFlag('--setalias', data.alias) - .withArg('--setdefaultdevhubusername') + .withArg(CLI.ORG_LOGIN_DEVICE) + .withFlag('--alias', data.alias) + .withArg('--set-default-dev-hub') .withLogName('force_auth_device_dev_hub') .withJson(); @@ -58,33 +50,31 @@ export class ForceAuthDevHubContainerExecutor extends ForceAuthWebLoginContainer } } -export class ForceAuthDevHubExecutor extends SfdxCommandletExecutor<{}> { +export class OrgLoginWebDevHubExecutor extends SfdxCommandletExecutor<{}> { protected showChannelOutput = false; public build(data: AuthDevHubParams): Command { const command = new SfdxCommandBuilder().withDescription( - nls.localize('force_auth_web_login_authorize_dev_hub_text') + nls.localize('org_login_web_authorize_dev_hub_text') ); command - .withArg(CLI.AUTH_WEB_LOGIN) + .withArg(CLI.ORG_LOGIN_WEB) .withLogName('force_auth_dev_hub') - .withFlag('--setalias', data.alias) - .withArg('--setdefaultdevhubusername'); + .withFlag('--alias', data.alias) + .withArg('--set-default-dev-hub'); return command.build(); } } -export class ForceAuthDevHubDemoModeExecutor extends ForceAuthDemoModeExecutor<{}> { +export class OrgLoginWebDevHubDemoModeExecutor extends ForceAuthDemoModeExecutor<{}> { public build(data: AuthDevHubParams): Command { return new SfdxCommandBuilder() - .withDescription( - nls.localize('force_auth_web_login_authorize_dev_hub_text') - ) - .withArg(CLI.AUTH_WEB_LOGIN) - .withFlag('--setalias', data.alias) - .withArg('--setdefaultdevhubusername') - .withArg('--noprompt') + .withDescription(nls.localize('org_login_web_authorize_dev_hub_text')) + .withArg(CLI.ORG_LOGIN_WEB) + .withFlag('--alias', data.alias) + .withArg('--set-default-dev-hub') + .withArg('--no-prompt') .withJson() .withLogName('force_auth_dev_hub_demo_mode') .build(); @@ -124,15 +114,15 @@ const parameterGatherer = new AuthDevHubParamsGatherer(); export function createAuthDevHubExecutor(): SfdxCommandletExecutor<{}> { switch (true) { case isSFContainerMode(): - return new ForceAuthDevHubContainerExecutor(); + return new OrgLoginWebDevHubContainerExecutor(); case isDemoMode(): - return new ForceAuthDevHubDemoModeExecutor(); + return new OrgLoginWebDevHubDemoModeExecutor(); default: - return new ForceAuthDevHubExecutor(); + return new OrgLoginWebDevHubExecutor(); } } -export async function forceAuthDevHub() { +export async function orgLoginWebDevHub() { const commandlet = new SfdxCommandlet( workspaceChecker, parameterGatherer, diff --git a/packages/salesforcedx-vscode-core/src/commands/index.ts b/packages/salesforcedx-vscode-core/src/commands/index.ts index 2c98cb0b8b..8c1ac3ccc7 100644 --- a/packages/salesforcedx-vscode-core/src/commands/index.ts +++ b/packages/salesforcedx-vscode-core/src/commands/index.ts @@ -16,22 +16,22 @@ export { } from './auth/authParamsGatherer'; export { forceAuthAccessToken } from './auth/forceAuthAccessTokenLogin'; export { - forceAuthWebLogin, - createAuthWebLoginExecutor, - ForceAuthWebLoginDemoModeExecutor, - ForceAuthWebLoginExecutor, - ForceAuthWebLoginContainerExecutor, + orgLoginWeb, + createOrgLoginWebExecutor, + OrgLoginWebDemoModeExecutor, + OrgLoginWebExecutor, + OrgLoginWebContainerExecutor, DeviceCodeResponse -} from './auth/forceAuthWebLogin'; +} from './auth/orgLoginWeb'; export { AuthDevHubParams, AuthDevHubParamsGatherer, - forceAuthDevHub, + orgLoginWebDevHub, createAuthDevHubExecutor, - ForceAuthDevHubDemoModeExecutor, - ForceAuthDevHubExecutor, - ForceAuthDevHubContainerExecutor -} from './auth/forceAuthDevHub'; + OrgLoginWebDevHubDemoModeExecutor, + OrgLoginWebDevHubExecutor, + OrgLoginWebDevHubContainerExecutor +} from './auth/orgLoginWebDevHub'; export { forceDataSoqlQuery } from './forceDataSoqlQuery'; export { forceOpenDocumentation } from './forceOpenDocumentation'; export { @@ -40,11 +40,11 @@ export { ForceOrgCreateExecutor } from './forceOrgCreate'; export { - forceOrgOpen, - ForceOrgOpenContainerExecutor, - ForceOrgOpenExecutor, + orgOpen, + OrgOpenContainerExecutor, + OrgOpenExecutor, getExecutor -} from './forceOrgOpen'; +} from './orgOpen'; export { forceSourceDelete, ConfirmationAndSourcePathGatherer, diff --git a/packages/salesforcedx-vscode-core/src/commands/forceOrgOpen.ts b/packages/salesforcedx-vscode-core/src/commands/orgOpen.ts similarity index 84% rename from packages/salesforcedx-vscode-core/src/commands/forceOrgOpen.ts rename to packages/salesforcedx-vscode-core/src/commands/orgOpen.ts index ce6d43031c..4bca5b7e81 100644 --- a/packages/salesforcedx-vscode-core/src/commands/forceOrgOpen.ts +++ b/packages/salesforcedx-vscode-core/src/commands/orgOpen.ts @@ -31,20 +31,20 @@ import { SfdxWorkspaceChecker } from './util'; -export class ForceOrgOpenContainerExecutor extends SfdxCommandletExecutor<{}> { +export class OrgOpenContainerExecutor extends SfdxCommandletExecutor<{}> { public build(data: {}): Command { return new SfdxCommandBuilder() - .withDescription(nls.localize('force_org_open_default_scratch_org_text')) - .withArg('force:org:open') + .withDescription(nls.localize('org_open_default_scratch_org_text')) + .withArg('org:open') .withLogName('force_org_open_default_scratch_org') - .withArg('--urlonly') + .withArg('--url-only') .withJson() .build(); } public buildUserMessageWith(orgData: OrgOpenSuccessResult): string { return nls.localize( - 'force_org_open_container_mode_message_text', + 'org_open_container_mode_message_text', orgData.result.orgId, orgData.result.username, orgData.result.url @@ -57,7 +57,7 @@ export class ForceOrgOpenContainerExecutor extends SfdxCommandletExecutor<{}> { const cancellationToken = cancellationTokenSource.token; const execution = new CliCommandExecutor(this.build(response.data), { cwd: workspaceUtils.getRootWorkspacePath(), - env: { SFDX_JSON_TO_STDOUT: 'true' } + env: { SF_JSON_TO_STDOUT: 'true' } }).execute(cancellationToken); channelService.streamCommandStartStop(execution); @@ -85,7 +85,7 @@ export class ForceOrgOpenContainerExecutor extends SfdxCommandletExecutor<{}> { } } catch (error) { channelService.appendLine( - nls.localize('force_org_open_default_scratch_org_container_error') + nls.localize('org_open_default_scratch_org_container_error') ); telemetryService.sendException( 'force_org_open_container', @@ -103,12 +103,12 @@ export class ForceOrgOpenContainerExecutor extends SfdxCommandletExecutor<{}> { } } -export class ForceOrgOpenExecutor extends SfdxCommandletExecutor<{}> { +export class OrgOpenExecutor extends SfdxCommandletExecutor<{}> { protected showChannelOutput = false; public build(data: {}): Command { return new SfdxCommandBuilder() - .withDescription(nls.localize('force_org_open_default_scratch_org_text')) - .withArg('force:org:open') + .withDescription(nls.localize('org_open_default_scratch_org_text')) + .withArg('org:open') .withLogName('force_org_open_default_scratch_org') .build(); } @@ -116,14 +116,14 @@ export class ForceOrgOpenExecutor extends SfdxCommandletExecutor<{}> { export function getExecutor(): SfdxCommandletExecutor<{}> { return isSFContainerMode() - ? new ForceOrgOpenContainerExecutor() - : new ForceOrgOpenExecutor(); + ? new OrgOpenContainerExecutor() + : new OrgOpenExecutor(); } const workspaceChecker = new SfdxWorkspaceChecker(); const parameterGatherer = new EmptyParametersGatherer(); -export async function forceOrgOpen() { +export async function orgOpen() { const commandlet = new SfdxCommandlet( workspaceChecker, parameterGatherer, diff --git a/packages/salesforcedx-vscode-core/src/commands/util/sfdxCommandletExecutor.ts b/packages/salesforcedx-vscode-core/src/commands/util/sfdxCommandletExecutor.ts index 80d490086c..1138a31cb3 100644 --- a/packages/salesforcedx-vscode-core/src/commands/util/sfdxCommandletExecutor.ts +++ b/packages/salesforcedx-vscode-core/src/commands/util/sfdxCommandletExecutor.ts @@ -89,7 +89,7 @@ export abstract class SfdxCommandletExecutor const cancellationToken = cancellationTokenSource.token; const execution = new CliCommandExecutor(this.build(response.data), { cwd: this.executionCwd, - env: { SFDX_JSON_TO_STDOUT: 'true' } + env: { SF_JSON_TO_STDOUT: 'true' } }).execute(cancellationToken); let output = ''; diff --git a/packages/salesforcedx-vscode-core/src/constants.ts b/packages/salesforcedx-vscode-core/src/constants.ts index fc45fae0ea..9d486c344c 100644 --- a/packages/salesforcedx-vscode-core/src/constants.ts +++ b/packages/salesforcedx-vscode-core/src/constants.ts @@ -45,10 +45,11 @@ export const ENABLE_SOBJECT_REFRESH_ON_STARTUP = 'enable-sobject-refresh-on-startup'; export const ENABLE_DEPLOY_AND_RETRIEVE_FOR_SOURCE_TRACKED_ORGS = 'enableDeployAndRetrieveForSourceTrackedOrgs.enabled'; -export const ENABLE_SOURCE_TRACKING_FOR_DEPLOY_RETRIEVE = 'experimental.enableSourceTrackingForDeployAndRetrieve'; +export const ENABLE_SOURCE_TRACKING_FOR_DEPLOY_RETRIEVE = + 'experimental.enableSourceTrackingForDeployAndRetrieve'; export const CLI = { - AUTH_DEVICE_LOGIN: 'force:auth:device:login', - AUTH_WEB_LOGIN: 'force:auth:web:login' + ORG_LOGIN_DEVICE: 'org:login:device', + ORG_LOGIN_WEB: 'org:login:web' }; export const APEX_FILE_NAME_EXTENSION = '.apex'; export const SOQL_FILE_NAME_EXTENSION = '.soql'; @@ -58,7 +59,7 @@ export const LWC_PATH = '/force-app/main/default/lwc/'; export const FUNCTIONS_PATH = '/functions/'; // Commands -export const ORG_OPEN_COMMAND = 'sfdx.force.org.open'; +export const ORG_OPEN_COMMAND = 'sfdx.org.open'; export const FORCE_SOURCE_PULL_LOG_NAME = 'force_source_pull_default_scratch_org'; export const FORCE_SOURCE_PUSH_LOG_NAME = diff --git a/packages/salesforcedx-vscode-core/src/index.ts b/packages/salesforcedx-vscode-core/src/index.ts index e8e73200e1..2aa0853c22 100644 --- a/packages/salesforcedx-vscode-core/src/index.ts +++ b/packages/salesforcedx-vscode-core/src/index.ts @@ -20,10 +20,8 @@ import { forceApexClassCreate, forceApexTriggerCreate, forceAuthAccessToken, - forceAuthDevHub, forceAuthLogoutAll, forceAuthLogoutDefault, - forceAuthWebLogin, forceConfigList, forceConfigSet, forceCreateManifest, @@ -50,7 +48,6 @@ import { forceOrgDelete, forceOrgDisplay, forceOrgList, - forceOrgOpen, forcePackageInstall, forceProjectWithManifestCreate, forceRefreshSObjects, @@ -66,15 +63,16 @@ import { forceSourceRetrieveCmp, forceSourceRetrieveManifest, forceSourceRetrieveSourcePaths, - forceSourceStatus, forceStartApexDebugLogging, forceStopApexDebugLogging, forceTaskStop, forceVisualforceComponentCreate, forceVisualforcePageCreate, initSObjectDefinitions, + orgLoginWeb, + orgLoginWebDevHub, + orgOpen, registerFunctionInvokeCodeLensProvider, - SourceStatusFlags, turnOffLogging, viewAllChanges, viewLocalChanges, @@ -123,12 +121,6 @@ import { OrgAuthInfo } from './util/authInfo'; const flagOverwrite: FlagParameter = { flag: '--forceoverwrite' }; -const flagStatusLocal: FlagParameter = { - flag: SourceStatusFlags.Local -}; -const flagStatusRemote: FlagParameter = { - flag: SourceStatusFlags.Remote -}; function registerCommands( extensionContext: vscode.ExtensionContext @@ -138,13 +130,13 @@ function registerCommands( 'sfdx.force.auth.accessToken', forceAuthAccessToken ); - const forceAuthWebLoginCmd = vscode.commands.registerCommand( - 'sfdx.force.auth.web.login', - forceAuthWebLogin + const orgLoginWebCmd = vscode.commands.registerCommand( + 'sfdx.org.login.web', + orgLoginWeb ); - const forceAuthDevHubCmd = vscode.commands.registerCommand( - 'sfdx.force.auth.dev.hub', - forceAuthDevHub + const orgLoginWebDevHubCmd = vscode.commands.registerCommand( + 'sfdx.org.login.web.dev.hub', + orgLoginWebDevHub ); const forceAuthLogoutAllCmd = vscode.commands.registerCommand( 'sfdx.force.auth.logout.all', @@ -162,10 +154,7 @@ function registerCommands( 'sfdx.force.org.create', forceOrgCreate ); - const forceOrgOpenCmd = vscode.commands.registerCommand( - ORG_OPEN_COMMAND, - forceOrgOpen - ); + const orgOpenCmd = vscode.commands.registerCommand(ORG_OPEN_COMMAND, orgOpen); const forceSourceDeleteCmd = vscode.commands.registerCommand( 'sfdx.force.source.delete', forceSourceDelete @@ -411,8 +400,6 @@ function registerCommands( return vscode.Disposable.from( forceAuthAccessTokenCmd, - forceAuthWebLoginCmd, - forceAuthDevHubCmd, forceAuthLogoutAllCmd, forceAuthLogoutDefaultCmd, forceDataSoqlQueryInputCmd, @@ -425,7 +412,6 @@ function registerCommands( forceFunctionStopCmd, forceOpenDocumentationCmd, forceOrgCreateCmd, - forceOrgOpenCmd, forceOrgDeleteDefaultCmd, forceOrgDeleteUsernameCmd, forceOrgListCleanCmd, @@ -469,7 +455,10 @@ function registerCommands( forceStartApexDebugLoggingCmd, forceStopApexDebugLoggingCmd, isvDebugBootstrapCmd, - forceConfigSetCmd + forceConfigSetCmd, + orgLoginWebCmd, + orgLoginWebDevHubCmd, + orgOpenCmd ); } diff --git a/packages/salesforcedx-vscode-core/src/messages/i18n.ja.ts b/packages/salesforcedx-vscode-core/src/messages/i18n.ja.ts index 7323dade98..0b762d3e8a 100644 --- a/packages/salesforcedx-vscode-core/src/messages/i18n.ja.ts +++ b/packages/salesforcedx-vscode-core/src/messages/i18n.ja.ts @@ -38,8 +38,8 @@ export const messages = { status_bar_text: `$(x) %s`, status_bar_tooltip: 'クリックしてコマンドをキャンセル', - force_auth_web_login_authorize_dev_hub_text: 'SFDX: Dev Hub 組織を認証', - force_auth_web_login_authorize_org_text: 'SFDX: 組織を認証', + org_login_web_authorize_dev_hub_text: 'SFDX: Dev Hub 組織を認証', + org_login_web_authorize_org_text: 'SFDX: 組織を認証', force_auth_access_token_authorize_org_text: 'SFDX: Authorize an Org using Session ID', force_auth_access_token_login_bad_oauth_token_message: @@ -75,10 +75,10 @@ export const messages = { force_org_create_result_parsing_error: '組織を作成するレスポンスの処理中に予期せぬエラーが発生しました。', - force_org_open_default_scratch_org_text: 'SFDX: デフォルトの組織を開く', - force_org_open_default_scratch_org_container_error: + org_open_default_scratch_org_text: 'SFDX: デフォルトの組織を開く', + org_open_default_scratch_org_container_error: '組織を開くレスポンスの処理中に予期せぬエラーが発生しました。', - force_org_open_container_mode_message_text: + org_open_container_mode_message_text: '組織 %s にユーザ %s として次の URL: %s を使用してアクセス', force_source_pull_default_org_text: diff --git a/packages/salesforcedx-vscode-core/src/messages/i18n.ts b/packages/salesforcedx-vscode-core/src/messages/i18n.ts index 4718dafc11..e042b16d3b 100644 --- a/packages/salesforcedx-vscode-core/src/messages/i18n.ts +++ b/packages/salesforcedx-vscode-core/src/messages/i18n.ts @@ -40,16 +40,15 @@ export const messages = { status_bar_open_org_tooltip: 'Open Org', status_bar_org_picker_tooltip: 'Change Default Org', - force_auth_web_login_authorize_dev_hub_text: 'SFDX: Authorize a Dev Hub', - force_auth_web_login_authorize_org_text: 'SFDX: Authorize an Org', + org_login_web_authorize_dev_hub_text: 'SFDX: Authorize a Dev Hub', + org_login_web_authorize_org_text: 'SFDX: Authorize an Org', force_auth_access_token_authorize_org_text: 'SFDX: Authorize an Org using Session ID', force_auth_access_token_login_bad_oauth_token_message: 'The session ID that you are trying to use is not valid. Check if it has expired, or use a valid session ID.', - force_auth_web_login_device_code_parse_error: + org_login_device_code_parse_error: 'There was an unexpected error authorizing to your org in a container environment.', - force_auth_device_login_enter_code: - 'Enter %s user code in the verification URL %s', + org_login_device_enter_code: 'Enter %s user code in the verification URL %s', action_required: '=== Action Required!', parameter_directory_strict_not_available: 'A required metadata folder named "%s" does not exist in this workspace.', @@ -97,10 +96,10 @@ export const messages = { force_org_create_result_parsing_error: 'An unexpected error occurred while processing the org create response.', - force_org_open_default_scratch_org_text: 'SFDX: Open Default Org', - force_org_open_default_scratch_org_container_error: + org_open_default_scratch_org_text: 'SFDX: Open Default Org', + org_open_default_scratch_org_container_error: 'There was an unexpected error when processing the org open response.', - force_org_open_container_mode_message_text: + org_open_container_mode_message_text: 'Access org %s as user %s with the following URL: %s', force_source_pull_default_org_text: 'SFDX: Pull Source from Default Org', force_source_pull_force_default_org_text: diff --git a/packages/salesforcedx-vscode-core/src/orgPicker/orgList.ts b/packages/salesforcedx-vscode-core/src/orgPicker/orgList.ts index a517ff0861..943bd20898 100644 --- a/packages/salesforcedx-vscode-core/src/orgPicker/orgList.ts +++ b/packages/salesforcedx-vscode-core/src/orgPicker/orgList.ts @@ -121,8 +121,8 @@ export class OrgList implements vscode.Disposable { public async setDefaultOrg(): Promise> { let quickPickList = [ - '$(plus) ' + nls.localize('force_auth_web_login_authorize_org_text'), - '$(plus) ' + nls.localize('force_auth_web_login_authorize_dev_hub_text'), + '$(plus) ' + nls.localize('org_login_web_authorize_org_text'), + '$(plus) ' + nls.localize('org_login_web_authorize_dev_hub_text'), '$(plus) ' + nls.localize('force_org_create_default_scratch_org_text'), '$(plus) ' + nls.localize('force_auth_access_token_authorize_org_text'), '$(plus) ' + nls.localize('force_org_list_clean_text') @@ -139,14 +139,12 @@ export class OrgList implements vscode.Disposable { return { type: 'CANCEL' }; } switch (selection) { - case '$(plus) ' + - nls.localize('force_auth_web_login_authorize_org_text'): { - vscode.commands.executeCommand('sfdx.force.auth.web.login'); + case '$(plus) ' + nls.localize('org_login_web_authorize_org_text'): { + vscode.commands.executeCommand('sfdx.org.login.web'); return { type: 'CONTINUE', data: {} }; } - case '$(plus) ' + - nls.localize('force_auth_web_login_authorize_dev_hub_text'): { - vscode.commands.executeCommand('sfdx.force.auth.dev.hub'); + case '$(plus) ' + nls.localize('org_login_web_authorize_dev_hub_text'): { + vscode.commands.executeCommand('sfdx.org.login.web.dev.hub'); return { type: 'CONTINUE', data: {} }; } case '$(plus) ' + diff --git a/packages/salesforcedx-vscode-core/src/util/authInfo.ts b/packages/salesforcedx-vscode-core/src/util/authInfo.ts index 9fe774d6cf..6446d2efd4 100644 --- a/packages/salesforcedx-vscode-core/src/util/authInfo.ts +++ b/packages/salesforcedx-vscode-core/src/util/authInfo.ts @@ -84,7 +84,7 @@ export class OrgAuthInfo { [showButtonText] ); if (selection && selection === showButtonText) { - vscode.commands.executeCommand('sfdx.force.auth.dev.hub'); + vscode.commands.executeCommand('sfdx.org.login.web.dev.hub'); } return undefined; } diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/auth/forceAuthWebLogin.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/auth/orgLoginWeb.test.ts similarity index 77% rename from packages/salesforcedx-vscode-core/test/vscode-integration/commands/auth/forceAuthWebLogin.test.ts rename to packages/salesforcedx-vscode-core/test/vscode-integration/commands/auth/orgLoginWeb.test.ts index 76754121bf..33387456e4 100644 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/auth/forceAuthWebLogin.test.ts +++ b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/auth/orgLoginWeb.test.ts @@ -10,12 +10,12 @@ import * as sinon from 'sinon'; import * as vscode from 'vscode'; import { AuthParamsGatherer, - createAuthWebLoginExecutor, + createOrgLoginWebExecutor, DEFAULT_ALIAS, DeviceCodeResponse, - ForceAuthWebLoginContainerExecutor, - ForceAuthWebLoginDemoModeExecutor, - ForceAuthWebLoginExecutor, + OrgLoginWebContainerExecutor, + OrgLoginWebDemoModeExecutor, + OrgLoginWebExecutor, OrgTypeItem, PRODUCTION_URL, SANDBOX_URL @@ -26,34 +26,34 @@ const TEST_ALIAS = 'testAlias'; const TEST_URL = 'https://my.testdomain.salesforce.com'; // tslint:disable:no-unused-expression -describe('Force Auth Web Login', () => { - it('Should build the auth web login command', async () => { - const authWebLogin = new ForceAuthWebLoginExecutor(); - const authWebLoginCommand = authWebLogin.build({ +describe('Org Login Web', () => { + it('Should build the org login web login command', async () => { + const orgLoginWeb = new OrgLoginWebExecutor(); + const orgLoginWebCommand = orgLoginWeb.build({ alias: TEST_ALIAS, loginUrl: TEST_URL }); - expect(authWebLoginCommand.toCommand()).to.equal( - `sfdx force:auth:web:login --setalias ${TEST_ALIAS} --instanceurl ${TEST_URL} --setdefaultusername` + expect(orgLoginWebCommand.toCommand()).to.equal( + `sfdx org:login:web --alias ${TEST_ALIAS} --instance-url ${TEST_URL} --set-default` ); - expect(authWebLoginCommand.description).to.equal( - nls.localize('force_auth_web_login_authorize_org_text') + expect(orgLoginWebCommand.description).to.equal( + nls.localize('org_login_web_authorize_org_text') ); }); }); -describe('Force Auth Web Login in Demo Mode', () => { - it('Should build the auth web login command', async () => { - const authWebLogin = new ForceAuthWebLoginDemoModeExecutor(); - const authWebLoginCommand = authWebLogin.build({ +describe('Org Login Web in Demo Mode', () => { + it('Should build the org login web login command', async () => { + const orgLoginWeb = new OrgLoginWebDemoModeExecutor(); + const orgLoginWebCommand = orgLoginWeb.build({ alias: TEST_ALIAS, loginUrl: TEST_URL }); - expect(authWebLoginCommand.toCommand()).to.equal( - `sfdx force:auth:web:login --setalias ${TEST_ALIAS} --instanceurl ${TEST_URL} --setdefaultusername --noprompt --json --loglevel fatal` + expect(orgLoginWebCommand.toCommand()).to.equal( + `sfdx org:login:web --alias ${TEST_ALIAS} --instance-url ${TEST_URL} --set-default --no-prompt --json --loglevel fatal` ); - expect(authWebLoginCommand.description).to.equal( - nls.localize('force_auth_web_login_authorize_org_text') + expect(orgLoginWebCommand.description).to.equal( + nls.localize('org_login_web_authorize_org_text') ); }); }); @@ -207,7 +207,7 @@ describe('Auth Params Gatherer', () => { }); }); -describe('Force Auth Web Login is based on environment variables', () => { +describe('Org Login Web is based on environment variables', () => { describe('in demo mode', () => { let originalValue: any; @@ -219,18 +219,16 @@ describe('Force Auth Web Login is based on environment variables', () => { process.env.SFDX_ENV = originalValue; }); - it('Should use ForceAuthDevHubDemoModeExecutor if demo mode is true', () => { + it('Should use OrgLoginWebDevHubDemoModeExecutor if demo mode is true', () => { process.env.SFDX_ENV = 'DEMO'; - expect( - createAuthWebLoginExecutor() instanceof - ForceAuthWebLoginDemoModeExecutor - ).to.be.true; + expect(createOrgLoginWebExecutor() instanceof OrgLoginWebDemoModeExecutor) + .to.be.true; }); - it('Should use ForceAuthDevHubExecutor if demo mode is false', () => { + it('Should use OrgLoginWebDevHubExecutor if demo mode is false', () => { process.env.SFDX_ENV = ''; - expect(createAuthWebLoginExecutor() instanceof ForceAuthWebLoginExecutor) - .to.be.true; + expect(createOrgLoginWebExecutor() instanceof OrgLoginWebExecutor).to.be + .true; }); }); @@ -239,43 +237,42 @@ describe('Force Auth Web Login is based on environment variables', () => { delete process.env.SF_CONTAINER_MODE; }); - it('Should use ForceAuthWebLoginExecutor when container mode is not defined', () => { - expect(createAuthWebLoginExecutor() instanceof ForceAuthWebLoginExecutor) - .to.be.true; + it('Should use OrgLoginWebExecutor when container mode is not defined', () => { + expect(createOrgLoginWebExecutor() instanceof OrgLoginWebExecutor).to.be + .true; }); - it('Should use ForceAuthWebLoginExecutor when container mode is empty', () => { + it('Should use OrgLoginWebExecutor when container mode is empty', () => { process.env.SF_CONTAINER_MODE = ''; - expect(createAuthWebLoginExecutor() instanceof ForceAuthWebLoginExecutor) - .to.be.true; + expect(createOrgLoginWebExecutor() instanceof OrgLoginWebExecutor).to.be + .true; }); - it('Should use ForceAuthWebLoginContainerExecutor when container mode is defined', () => { + it('Should use OrgLoginWebContainerExecutor when container mode is defined', () => { process.env.SF_CONTAINER_MODE = 'true'; expect( - createAuthWebLoginExecutor() instanceof - ForceAuthWebLoginContainerExecutor + createOrgLoginWebExecutor() instanceof OrgLoginWebContainerExecutor ).to.be.true; }); - it('should build the force:auth:device:login command', () => { - const authWebLogin = new ForceAuthWebLoginContainerExecutor(); - const authWebLoginCommand = authWebLogin.build({ + it('should build the org:login:device command', () => { + const orgLoginWeb = new OrgLoginWebContainerExecutor(); + const orgLoginWebCommand = orgLoginWeb.build({ alias: TEST_ALIAS, loginUrl: TEST_URL }); - expect(authWebLoginCommand.toCommand()).to.equal( - `sfdx force:auth:device:login --setalias ${TEST_ALIAS} --instanceurl ${TEST_URL} --setdefaultusername --json --loglevel fatal` + expect(orgLoginWebCommand.toCommand()).to.equal( + `sfdx org:login:device --alias ${TEST_ALIAS} --instance-url ${TEST_URL} --set-default --json --loglevel fatal` ); - expect(authWebLoginCommand.description).to.equal( - nls.localize('force_auth_web_login_authorize_org_text') + expect(orgLoginWebCommand.description).to.equal( + nls.localize('org_login_web_authorize_org_text') ); }); }); }); describe('Force Auth Device Login', () => { - class TestForceAuthDeviceLogin extends ForceAuthWebLoginContainerExecutor { + class TestForceAuthDeviceLogin extends OrgLoginWebContainerExecutor { public deviceCodeReceived = false; public stdOut = ''; diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/auth/forceAuthDevHub.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/auth/orgLoginWebDevHub.test.ts similarity index 59% rename from packages/salesforcedx-vscode-core/test/vscode-integration/commands/auth/forceAuthDevHub.test.ts rename to packages/salesforcedx-vscode-core/test/vscode-integration/commands/auth/orgLoginWebDevHub.test.ts index 2fb5fdef26..fdfd1e2d5a 100644 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/auth/forceAuthDevHub.test.ts +++ b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/auth/orgLoginWebDevHub.test.ts @@ -21,33 +21,33 @@ import { AuthDevHubParamsGatherer, createAuthDevHubExecutor, DEFAULT_ALIAS, - ForceAuthDevHubContainerExecutor, - ForceAuthDevHubDemoModeExecutor, - ForceAuthDevHubExecutor + OrgLoginWebDevHubContainerExecutor, + OrgLoginWebDevHubDemoModeExecutor, + OrgLoginWebDevHubExecutor } from '../../../../src/commands'; import { nls } from '../../../../src/messages'; import { OrgAuthInfo } from '../../../../src/util'; const TEST_ALIAS = 'testAlias'; -class TestForceAuthDevHubExecutor extends ForceAuthDevHubExecutor { +class TestOrgLoginWebDevHubExecutor extends OrgLoginWebDevHubExecutor { public getShowChannelOutput() { return this.showChannelOutput; } } // tslint:disable:no-unused-expression -describe('Force Auth Web Login for Dev Hub', () => { - it('Should build the auth web login command', async () => { - const authWebLogin = new ForceAuthDevHubExecutor(); - const authWebLoginCommand = authWebLogin.build({ +describe('Org Login Web for Dev Hub', () => { + it('Should build the org login web login command', async () => { + const orgLoginWeb = new OrgLoginWebDevHubExecutor(); + const orgLoginWebCommand = orgLoginWeb.build({ alias: TEST_ALIAS }); - expect(authWebLoginCommand.toCommand()).to.equal( - `sfdx force:auth:web:login --setalias ${TEST_ALIAS} --setdefaultdevhubusername` + expect(orgLoginWebCommand.toCommand()).to.equal( + `sfdx org:login:web --alias ${TEST_ALIAS} --set-default-dev-hub` ); - expect(authWebLoginCommand.description).to.equal( - nls.localize('force_auth_web_login_authorize_dev_hub_text') + expect(orgLoginWebCommand.description).to.equal( + nls.localize('org_login_web_authorize_dev_hub_text') ); }); }); @@ -55,17 +55,17 @@ describe('Force Auth Web Login for Dev Hub', () => { // Setup the test environment. const $$ = instantiateContext(); -describe('Force Auth Web Login For Dev Hub in Demo Mode', () => { - it('Should build the auth web login command', async () => { - const authWebLogin = new ForceAuthDevHubDemoModeExecutor(); - const authWebLoginCommand = authWebLogin.build({ +describe('Org Login Web For Dev Hub in Demo Mode', () => { + it('Should build the org login web login command', async () => { + const orgLoginWeb = new OrgLoginWebDevHubDemoModeExecutor(); + const orgLoginWebCommand = orgLoginWeb.build({ alias: TEST_ALIAS }); - expect(authWebLoginCommand.toCommand()).to.equal( - `sfdx force:auth:web:login --setalias ${TEST_ALIAS} --setdefaultdevhubusername --noprompt --json --loglevel fatal` + expect(orgLoginWebCommand.toCommand()).to.equal( + `sfdx org:login:web --alias ${TEST_ALIAS} --set-default-dev-hub --no-prompt --json --loglevel fatal` ); - expect(authWebLoginCommand.description).to.equal( - nls.localize('force_auth_web_login_authorize_dev_hub_text') + expect(orgLoginWebCommand.description).to.equal( + nls.localize('org_login_web_authorize_dev_hub_text') ); }); }); @@ -135,16 +135,16 @@ describe('Force Auth Dev Hub is based on environment variables', () => { process.env.SFDX_ENV = originalValue; }); - it('Should use ForceAuthDevHubDemoModeExecutor if demo mode is true', () => { + it('Should use OrgLoginWebDevHubDemoModeExecutor if demo mode is true', () => { process.env.SFDX_ENV = 'DEMO'; expect( - createAuthDevHubExecutor() instanceof ForceAuthDevHubDemoModeExecutor + createAuthDevHubExecutor() instanceof OrgLoginWebDevHubDemoModeExecutor ).to.be.true; }); - it('Should use ForceAuthDevHubExecutor if demo mode is false', () => { + it('Should use OrgLoginWebDevHubExecutor if demo mode is false', () => { process.env.SFDX_ENV = ''; - expect(createAuthDevHubExecutor() instanceof ForceAuthDevHubExecutor).to + expect(createAuthDevHubExecutor() instanceof OrgLoginWebDevHubExecutor).to .be.true; }); }); @@ -154,49 +154,49 @@ describe('Force Auth Dev Hub is based on environment variables', () => { delete process.env.SF_CONTAINER_MODE; }); it('Should not expose the output channel when not in container mode', () => { - const notContainerMode = new TestForceAuthDevHubExecutor(); + const notContainerMode = new TestOrgLoginWebDevHubExecutor(); expect(notContainerMode.getShowChannelOutput()).to.be.false; }); - it('Should use ForceAuthDevHubExecutor when container mode is not defined', () => { - const authWebLogin = new ForceAuthDevHubExecutor(); - expect(createAuthDevHubExecutor() instanceof ForceAuthDevHubExecutor).to + it('Should use OrgLoginWebDevHubExecutor when container mode is not defined', () => { + const orgLoginWeb = new OrgLoginWebDevHubExecutor(); + expect(createAuthDevHubExecutor() instanceof OrgLoginWebDevHubExecutor).to .be.true; - const authWebLoginCommand = authWebLogin.build( + const orgLoginWebCommand = orgLoginWeb.build( ({} as unknown) as AuthDevHubParams ); - expect(authWebLoginCommand.toCommand()).to.equal( - 'sfdx force:auth:web:login --setalias --setdefaultdevhubusername' + expect(orgLoginWebCommand.toCommand()).to.equal( + 'sfdx org:login:web --alias --set-default-dev-hub' ); }); - it('Should use ForceAuthDevHubExecutor when container mode is empty', () => { + it('Should use OrgLoginWebDevHubExecutor when container mode is empty', () => { process.env.SF_CONTAINER_MODE = ''; - const authWebLogin = new ForceAuthDevHubExecutor(); - expect(createAuthDevHubExecutor() instanceof ForceAuthDevHubExecutor).to + const orgLoginWeb = new OrgLoginWebDevHubExecutor(); + expect(createAuthDevHubExecutor() instanceof OrgLoginWebDevHubExecutor).to .be.true; - const authWebLoginCommand = authWebLogin.build( + const orgLoginWebCommand = orgLoginWeb.build( ({} as unknown) as AuthDevHubParams ); - expect(authWebLoginCommand.toCommand()).to.equal( - 'sfdx force:auth:web:login --setalias --setdefaultdevhubusername' + expect(orgLoginWebCommand.toCommand()).to.equal( + 'sfdx org:login:web --alias --set-default-dev-hub' ); }); - it('Should use ForceAuthDevHubContainerExecutor when container mode is defined', () => { + it('Should use OrgLoginWebDevHubContainerExecutor when container mode is defined', () => { process.env.SF_CONTAINER_MODE = 'true'; - const authDevhubLogin = new ForceAuthDevHubContainerExecutor(); + const authDevhubLogin = new OrgLoginWebDevHubContainerExecutor(); expect( - createAuthDevHubExecutor() instanceof ForceAuthDevHubContainerExecutor + createAuthDevHubExecutor() instanceof OrgLoginWebDevHubContainerExecutor ).to.be.true; const authDevhubLoginCommand = authDevhubLogin.build( ({} as unknown) as AuthDevHubParams ); expect(authDevhubLoginCommand.toCommand()).to.equal( - 'sfdx force:auth:device:login --setalias --setdefaultdevhubusername --json --loglevel fatal' + 'sfdx org:login:device --alias --set-default-dev-hub --json --loglevel fatal' ); expect(authDevhubLoginCommand.description).to.equal( - nls.localize('force_auth_web_login_authorize_dev_hub_text') + nls.localize('org_login_web_authorize_dev_hub_text') ); }); }); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/forceOrgOpen.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/forceOrgOpen.test.ts deleted file mode 100644 index c1d9852483..0000000000 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/forceOrgOpen.test.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2019, salesforce.com, inc. - * All rights reserved. - * Licensed under the BSD 3-Clause license. - * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause - */ - -import { expect } from 'chai'; -import { - ForceOrgOpenContainerExecutor, - ForceOrgOpenExecutor, - getExecutor -} from '../../../src/commands'; -import { nls } from '../../../src/messages'; - -// tslint:disable:no-unused-expression -describe('Force Org Open', () => { - it('should build the org open command', () => { - const forceOrgOpenContainer = new ForceOrgOpenExecutor(); - const orgOpenCommand = forceOrgOpenContainer.build({}); - - expect(orgOpenCommand.toCommand()).to.equal('sfdx force:org:open'); - expect(orgOpenCommand.description).to.equal( - nls.localize('force_org_open_default_scratch_org_text') - ); - }); - - it('should build the org open command for use in a container', () => { - const forceOrgOpenContainer = new ForceOrgOpenContainerExecutor(); - const orgOpenCommand = forceOrgOpenContainer.build({}); - - expect(orgOpenCommand.toCommand()).to.equal( - 'sfdx force:org:open --urlonly --json --loglevel fatal' - ); - expect(orgOpenCommand.description).to.equal( - nls.localize('force_org_open_default_scratch_org_text') - ); - }); - - describe('Executor is chosen based on environment', () => { - afterEach(() => { - delete process.env.SF_CONTAINER_MODE; - }); - it('should use ForceOrgOpenExecutor if container mode is not defined', () => { - expect(getExecutor()).to.be.instanceOf(ForceOrgOpenExecutor); - }); - it('should use ForceOrgOpenExecutor if container mode is empty', () => { - process.env.SF_CONTAINER_MODE = ''; - expect(getExecutor()).to.be.instanceOf(ForceOrgOpenExecutor); - }); - - it('should use ForceOrgOpenContainerExecutor if container mode is defined', () => { - process.env.SF_CONTAINER_MODE = 'true'; - expect(getExecutor()).to.be.instanceOf(ForceOrgOpenContainerExecutor); - }); - }); -}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/commands/orgOpen.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/orgOpen.test.ts new file mode 100644 index 0000000000..744c346a62 --- /dev/null +++ b/packages/salesforcedx-vscode-core/test/vscode-integration/commands/orgOpen.test.ts @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2019, salesforce.com, inc. + * All rights reserved. + * Licensed under the BSD 3-Clause license. + * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause + */ + +import { expect } from 'chai'; +import { + getExecutor, + OrgOpenContainerExecutor, + OrgOpenExecutor +} from '../../../src/commands'; +import { nls } from '../../../src/messages'; + +// tslint:disable:no-unused-expression +describe('Org Open', () => { + it('should build the org open command', () => { + const orgOpenContainer = new OrgOpenExecutor(); + const orgOpenCommand = orgOpenContainer.build({}); + + expect(orgOpenCommand.toCommand()).to.equal('sfdx org:open'); + expect(orgOpenCommand.description).to.equal( + nls.localize('org_open_default_scratch_org_text') + ); + }); + + it('should build the org open command for use in a container', () => { + const orgOpenContainer = new OrgOpenContainerExecutor(); + const orgOpenCommand = orgOpenContainer.build({}); + + expect(orgOpenCommand.toCommand()).to.equal( + 'sfdx org:open --url-only --json --loglevel fatal' + ); + expect(orgOpenCommand.description).to.equal( + nls.localize('org_open_default_scratch_org_text') + ); + }); + + describe('Executor is chosen based on environment', () => { + afterEach(() => { + delete process.env.SF_CONTAINER_MODE; + }); + it('should use OrgOpenExecutor if container mode is not defined', () => { + expect(getExecutor()).to.be.instanceOf(OrgOpenExecutor); + }); + it('should use OrgOpenExecutor if container mode is empty', () => { + process.env.SF_CONTAINER_MODE = ''; + expect(getExecutor()).to.be.instanceOf(OrgOpenExecutor); + }); + + it('should use OrgOpenContainerExecutor if container mode is defined', () => { + process.env.SF_CONTAINER_MODE = 'true'; + expect(getExecutor()).to.be.instanceOf(OrgOpenContainerExecutor); + }); + }); +}); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/orgPicker/orgList.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/orgPicker/orgList.test.ts index 2097a50e17..922539df49 100644 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/orgPicker/orgList.test.ts +++ b/packages/salesforcedx-vscode-core/test/vscode-integration/orgPicker/orgList.test.ts @@ -328,16 +328,16 @@ describe('orgList Tests', () => { expect(response.type).to.equal('CANCEL'); }); - it('should return Continue and call force:auth:web:login command if SFDX: Authorize an Org is selected', async () => { + it('should return Continue and call org:login:web command if SFDX: Authorize an Org is selected', async () => { orgListStub.returns(orgsList); quickPickStub.returns( - '$(plus) ' + nls.localize('force_auth_web_login_authorize_org_text') + '$(plus) ' + nls.localize('org_login_web_authorize_org_text') ); const response = await orgList.setDefaultOrg(); expect(response.type).to.equal('CONTINUE'); - expect( - executeCommandStub.calledWith('sfdx.force.auth.web.login') - ).to.equal(true); + expect(executeCommandStub.calledWith('sfdx.org.login.web')).to.equal( + true + ); }); it('should return Continue and call force:org:create command if SFDX: Create a Default Scratch Org is selected', async () => { @@ -355,13 +355,12 @@ describe('orgList Tests', () => { it('should return Continue and call force:auth:dev:hub command if SFDX: Authorize a Dev Hub is selected', async () => { orgListStub.returns(orgsList); quickPickStub.returns( - '$(plus) ' + - nls.localize('force_auth_web_login_authorize_dev_hub_text') + '$(plus) ' + nls.localize('org_login_web_authorize_dev_hub_text') ); const response = await orgList.setDefaultOrg(); expect(response.type).to.equal('CONTINUE'); expect( - executeCommandStub.calledWith('sfdx.force.auth.dev.hub') + executeCommandStub.calledWith('sfdx.org.login.web.dev.hub') ).to.equal(true); }); diff --git a/packages/salesforcedx-vscode-core/test/vscode-integration/util/authInfo.test.ts b/packages/salesforcedx-vscode-core/test/vscode-integration/util/authInfo.test.ts index 072200d09b..b3f4eb1482 100644 --- a/packages/salesforcedx-vscode-core/test/vscode-integration/util/authInfo.test.ts +++ b/packages/salesforcedx-vscode-core/test/vscode-integration/util/authInfo.test.ts @@ -78,9 +78,9 @@ describe('OrgAuthInfo', () => { await OrgAuthInfo.getDefaultDevHubUsernameOrAlias(true); - expect(executeCommandStub.calledWith('sfdx.force.auth.dev.hub')).to.equal( - true - ); + expect( + executeCommandStub.calledWith('sfdx.org.login.web.dev.hub') + ).to.equal(true); expect(showMessageStub.calledOnce).to.equal(true); });