From eb44d96cf313e229ffcbc56d9bf80d738c7c9e9f Mon Sep 17 00:00:00 2001 From: Pileks Date: Wed, 19 Oct 2022 18:17:30 +0200 Subject: [PATCH 1/6] CLI - rename "run" command to "test" --- packages/cli/lang/en.json | 6 +-- packages/cli/lang/es.json | 8 ++-- packages/cli/src/__tests__/e2e/help.spec.ts | 2 +- .../cli/src/__tests__/e2e/no-command.spec.ts | 2 +- packages/cli/src/__tests__/e2e/run.spec.ts | 45 +++++++++---------- packages/cli/src/commands/run.ts | 4 +- .../001-yaml-workflow/polywrap.test.yaml | 0 .../{run => test}/002-json-workflow/cmd.json | 0 .../002-json-workflow/polywrap.test.json | 0 .../{run => test}/003-json-output/cmd.json | 0 .../003-json-output/polywrap.test.yaml | 0 .../{run => test}/004-yaml-output/cmd.json | 0 .../004-yaml-output/polywrap.test.yaml | 0 .../005-validate/polywrap.test.yaml | 0 .../{run => test}/005-validate/validator.cue | 0 .../006-validation-fail/polywrap.test.yaml | 0 .../006-validation-fail/validator.cue | 0 .../007-invalid-manifest/polywrap.test.yaml | 0 .../{run => test}/008-custom-config/cmd.json | 0 .../{run => test}/008-custom-config/config.ts | 0 .../008-custom-config/polywrap.test.yaml | 0 .../008-custom-config/validator.cue | 0 .../009-nested-props/polywrap.test.yaml | 0 .../009-nested-props/validator.cue | 0 .../010-reserved-job-names/polywrap.test.yaml | 0 .../cli/{run => test}/011-id-subset/cmd.json | 0 .../011-id-subset/polywrap.test.yaml | 0 .../{run => test}/011-id-subset/validator.cue | 0 .../polywrap.test.yaml | 0 .../validator.cue | 0 .../run-test-wrapper/package.json | 0 .../run-test-wrapper/polywrap.build.yaml | 0 .../run-test-wrapper/polywrap.yaml | 0 .../run-test-wrapper/src/index.ts | 0 .../run-test-wrapper/src/schema.graphql | 0 35 files changed, 33 insertions(+), 34 deletions(-) rename packages/test-cases/cases/cli/{run => test}/001-yaml-workflow/polywrap.test.yaml (100%) rename packages/test-cases/cases/cli/{run => test}/002-json-workflow/cmd.json (100%) rename packages/test-cases/cases/cli/{run => test}/002-json-workflow/polywrap.test.json (100%) rename packages/test-cases/cases/cli/{run => test}/003-json-output/cmd.json (100%) rename packages/test-cases/cases/cli/{run => test}/003-json-output/polywrap.test.yaml (100%) rename packages/test-cases/cases/cli/{run => test}/004-yaml-output/cmd.json (100%) rename packages/test-cases/cases/cli/{run => test}/004-yaml-output/polywrap.test.yaml (100%) rename packages/test-cases/cases/cli/{run => test}/005-validate/polywrap.test.yaml (100%) rename packages/test-cases/cases/cli/{run => test}/005-validate/validator.cue (100%) rename packages/test-cases/cases/cli/{run => test}/006-validation-fail/polywrap.test.yaml (100%) rename packages/test-cases/cases/cli/{run => test}/006-validation-fail/validator.cue (100%) rename packages/test-cases/cases/cli/{run => test}/007-invalid-manifest/polywrap.test.yaml (100%) rename packages/test-cases/cases/cli/{run => test}/008-custom-config/cmd.json (100%) rename packages/test-cases/cases/cli/{run => test}/008-custom-config/config.ts (100%) rename packages/test-cases/cases/cli/{run => test}/008-custom-config/polywrap.test.yaml (100%) rename packages/test-cases/cases/cli/{run => test}/008-custom-config/validator.cue (100%) rename packages/test-cases/cases/cli/{run => test}/009-nested-props/polywrap.test.yaml (100%) rename packages/test-cases/cases/cli/{run => test}/009-nested-props/validator.cue (100%) rename packages/test-cases/cases/cli/{run => test}/010-reserved-job-names/polywrap.test.yaml (100%) rename packages/test-cases/cases/cli/{run => test}/011-id-subset/cmd.json (100%) rename packages/test-cases/cases/cli/{run => test}/011-id-subset/polywrap.test.yaml (100%) rename packages/test-cases/cases/cli/{run => test}/011-id-subset/validator.cue (100%) rename packages/test-cases/cases/cli/{run => test}/012-validation-error-expected/polywrap.test.yaml (100%) rename packages/test-cases/cases/cli/{run => test}/012-validation-error-expected/validator.cue (100%) rename packages/test-cases/cases/cli/{run => test}/run-test-wrapper/package.json (100%) rename packages/test-cases/cases/cli/{run => test}/run-test-wrapper/polywrap.build.yaml (100%) rename packages/test-cases/cases/cli/{run => test}/run-test-wrapper/polywrap.yaml (100%) rename packages/test-cases/cases/cli/{run => test}/run-test-wrapper/src/index.ts (100%) rename packages/test-cases/cases/cli/{run => test}/run-test-wrapper/src/schema.graphql (100%) diff --git a/packages/cli/lang/en.json b/packages/cli/lang/en.json index 00931b3595..213281f8d6 100644 --- a/packages/cli/lang/en.json +++ b/packages/cli/lang/en.json @@ -126,9 +126,9 @@ "commands_run_options_outputFilePath": "output-file-path", "commands_run_options_validateScript": "Validate the output of the workflow jobs", "commands_run_options_validate": "cue-file", - "commands_run_options_outputFile": "Output file path for the workflow result", + "commands_run_options_outputFile": "Output file path for the test result", "commands_run_options_m_path": "path", - "commands_run_options_m": "Path to the Polywrap Workflow manifest file (default: {default})", + "commands_run_options_m": "Path to the Polywrap Test manifest file (default: {default})", "commands_run_options_jobIds": "jobs", "commands_run_options_jobs": "Specify ids of jobs that you want to run", "commands_run_error_validatorNotFound": "validate script not found at: {path}", @@ -158,7 +158,7 @@ "commands_run_error_envsItemNotObject": "Env at index {index} must be an object with properties 'uri'", "commands_run_error_envsItemUriNotString": "Env property 'uri' at index {index} must be a valid wrap:// URI string", "commands_run_error_envsItemModuleNotObject": "Env property 'env' at index {index} must be an object", - "commands_run_description": "Runs Workflows", + "commands_run_description": "Execute Test Manifests", "commands_run_error_missingScript": "Required argument {script} is missing", "commands_run_error_noApi": "API needs to be initialized", "commands_run_error_readFail": "Failed to read query {query}", diff --git a/packages/cli/lang/es.json b/packages/cli/lang/es.json index fc27c873b1..213281f8d6 100644 --- a/packages/cli/lang/es.json +++ b/packages/cli/lang/es.json @@ -126,9 +126,9 @@ "commands_run_options_outputFilePath": "output-file-path", "commands_run_options_validateScript": "Validate the output of the workflow jobs", "commands_run_options_validate": "cue-file", - "commands_run_options_outputFile": "Output file path for the workflow result", + "commands_run_options_outputFile": "Output file path for the test result", "commands_run_options_m_path": "path", - "commands_run_options_m": "Path to the Polywrap Workflow manifest file (default: {default})", + "commands_run_options_m": "Path to the Polywrap Test manifest file (default: {default})", "commands_run_options_jobIds": "jobs", "commands_run_options_jobs": "Specify ids of jobs that you want to run", "commands_run_error_validatorNotFound": "validate script not found at: {path}", @@ -158,7 +158,7 @@ "commands_run_error_envsItemNotObject": "Env at index {index} must be an object with properties 'uri'", "commands_run_error_envsItemUriNotString": "Env property 'uri' at index {index} must be a valid wrap:// URI string", "commands_run_error_envsItemModuleNotObject": "Env property 'env' at index {index} must be an object", - "commands_run_description": "Runs Workflows", + "commands_run_description": "Execute Test Manifests", "commands_run_error_missingScript": "Required argument {script} is missing", "commands_run_error_noApi": "API needs to be initialized", "commands_run_error_readFail": "Failed to read query {query}", @@ -233,8 +233,8 @@ "lib_helpers_copyText": "Artifacts written to {path}", "lib_helpers_copyError": "Failed to write build artifacts to {path}", "lib_helpers_copyWarning": "Warnings write build artifacts to {path}", - "lib_helpers_docker_couldNotConnect": "Could not connect to the Docker daemon. Is the docker daemon running?", "lib_helpers_docker_copyText": "Artifacts written to {path} from the image `{image}`", + "lib_helpers_docker_couldNotConnect": "Could not connect to the Docker daemon. Is the docker daemon running?", "lib_helpers_docker_copyError": "Failed to write build artifacts to {path} from the image `{image}`", "lib_helpers_docker_copyWarning": "Warnings write build artifacts to {path} from the image `{image}`", "lib_helpers_docker_buildText": "Building source image `{image}` using dockerfile `{dockerfile}` in context `{context}`", diff --git a/packages/cli/src/__tests__/e2e/help.spec.ts b/packages/cli/src/__tests__/e2e/help.spec.ts index 0c368a76ec..f4eed59efa 100644 --- a/packages/cli/src/__tests__/e2e/help.spec.ts +++ b/packages/cli/src/__tests__/e2e/help.spec.ts @@ -14,7 +14,7 @@ Commands: create|c Create New Projects deploy|d [options] Deploys Polywrap Projects infra|i [options] Modular Infrastructure-As-Code Orchestrator - run|r [options] Runs Workflows + test|t [options] Execute Test Manifests docgen|o [options] Generate wrapper documentation manifest|m Inspect & Migrade Polywrap Manifests help [command] display help for command diff --git a/packages/cli/src/__tests__/e2e/no-command.spec.ts b/packages/cli/src/__tests__/e2e/no-command.spec.ts index 69289461a6..0c6cb32b53 100644 --- a/packages/cli/src/__tests__/e2e/no-command.spec.ts +++ b/packages/cli/src/__tests__/e2e/no-command.spec.ts @@ -14,7 +14,7 @@ Commands: create|c Create New Projects deploy|d [options] Deploys Polywrap Projects infra|i [options] Modular Infrastructure-As-Code Orchestrator - run|r [options] Runs Workflows + test|t [options] Execute Test Manifests docgen|o [options] Generate wrapper documentation manifest|m Inspect & Migrade Polywrap Manifests help [command] display help for command diff --git a/packages/cli/src/__tests__/e2e/run.spec.ts b/packages/cli/src/__tests__/e2e/run.spec.ts index 9781c4cb89..d1a5f886e7 100644 --- a/packages/cli/src/__tests__/e2e/run.spec.ts +++ b/packages/cli/src/__tests__/e2e/run.spec.ts @@ -9,18 +9,17 @@ import { GetPathToCliTestFiles } from "@polywrap/test-cases"; jest.setTimeout(200000); -const HELP = `Usage: polywrap run|r [options] +const HELP = `Usage: polywrap test|t [options] -Runs Workflows +Execute Test Manifests Options: - -m, --manifest-file Path to the Polywrap Workflow manifest - file (default: polywrap.test.yaml | + -m, --manifest-file Path to the Polywrap Test manifest file + (default: polywrap.test.yaml | polywrap.test.yml) -c, --client-config Add custom configuration to the PolywrapClient - -o, --output-file Output file path for the workflow - result + -o, --output-file Output file path for the test result -j, --jobs Specify ids of jobs that you want to run -v, --verbose Verbose output (default: false) @@ -28,8 +27,8 @@ Options: -h, --help display help for command `; -describe("e2e tests for run command", () => { - const testCaseRoot = path.join(GetPathToCliTestFiles(), "run"); +describe("e2e tests for test command", () => { + const testCaseRoot = path.join(GetPathToCliTestFiles(), "test"); const testCases = fs .readdirSync(testCaseRoot, { withFileTypes: true }) .filter((dirent) => dirent.isDirectory() && !isNaN(parseInt(dirent.name))) @@ -56,7 +55,7 @@ describe("e2e tests for run command", () => { it("Should show help text", async () => { const { exitCode: code, stdout: output, stderr: error } = await runCLI({ - args: ["run", "--help"], + args: ["test", "--help"], cwd: getTestCaseDir(0), }); @@ -75,7 +74,7 @@ describe("e2e tests for run command", () => { for (const [option, errorMessage] of Object.entries(missingOptionArgs)) { it(`Should throw error if params not specified for ${option} option`, async () => { const { exitCode: code, stdout: output, stderr: error } = await runCLI({ - args: ["run", option], + args: ["test", option], cwd: getTestCaseDir(0), cli: polywrapCli, }); @@ -93,7 +92,7 @@ describe("e2e tests for run command", () => { const testCaseDir = getTestCaseDir(0); const args = getCmdArgs(testCaseDir); const { exitCode, stdout, stderr } = await runCLI({ - args: ["run", ...args], + args: ["test", ...args], cwd: testCaseDir, cli: polywrapCli, }); @@ -113,7 +112,7 @@ describe("e2e tests for run command", () => { const testCaseDir = getTestCaseDir(1); const args = getCmdArgs(testCaseDir); const { exitCode, stdout, stderr } = await runCLI({ - args: ["run", ...args], + args: ["test", ...args], cwd: testCaseDir, cli: polywrapCli, }); @@ -133,7 +132,7 @@ describe("e2e tests for run command", () => { const testCaseDir = getTestCaseDir(2); const args = getCmdArgs(testCaseDir); const { exitCode, stdout, stderr } = await runCLI({ - args: ["run", ...args], + args: ["test", ...args], cwd: testCaseDir, cli: polywrapCli, }); @@ -157,7 +156,7 @@ describe("e2e tests for run command", () => { const testCaseDir = getTestCaseDir(3); const args = getCmdArgs(testCaseDir); const { exitCode, stdout, stderr } = await runCLI({ - args: ["run", ...args], + args: ["test", ...args], cwd: testCaseDir, cli: polywrapCli, }); @@ -183,7 +182,7 @@ describe("e2e tests for run command", () => { it("Should suppress the output if --quiet option is specified", async () => { const { exitCode, stdout, stderr } = await runCLI({ - args: ["run", "--quiet" ], + args: ["test", "--quiet" ], cwd: getTestCaseDir(0), cli: polywrapCli, }); @@ -197,7 +196,7 @@ describe("e2e tests for run command", () => { const testCaseDir = getTestCaseDir(4); const args = getCmdArgs(testCaseDir); const { exitCode, stdout, stderr } = await runCLI({ - args: ["run", ...args], + args: ["test", ...args], cwd: testCaseDir, cli: polywrapCli, }); @@ -215,7 +214,7 @@ describe("e2e tests for run command", () => { const testCaseDir = getTestCaseDir(5); const args = getCmdArgs(testCaseDir); const { exitCode, stdout, stderr } = await runCLI({ - args: ["run", ...args], + args: ["test", ...args], cwd: testCaseDir, cli: polywrapCli, }); @@ -237,7 +236,7 @@ describe("e2e tests for run command", () => { const testCaseDir = getTestCaseDir(6); const args = getCmdArgs(testCaseDir); const { exitCode, stderr } = await runCLI({ - args: ["run", ...args], + args: ["test", ...args], cwd: testCaseDir, cli: polywrapCli, }); @@ -252,7 +251,7 @@ describe("e2e tests for run command", () => { const testCaseDir = getTestCaseDir(7); const args = getCmdArgs(testCaseDir); const { exitCode, stdout, stderr } = await runCLI({ - args: ["run", ...args], + args: ["test", ...args], cwd: testCaseDir, cli: polywrapCli, }); @@ -271,7 +270,7 @@ describe("e2e tests for run command", () => { const testCaseDir = getTestCaseDir(8); const args = getCmdArgs(testCaseDir); const { exitCode, stdout, stderr } = await runCLI({ - args: ["run", ...args], + args: ["test", ...args], cwd: testCaseDir, cli: polywrapCli, }); @@ -289,7 +288,7 @@ describe("e2e tests for run command", () => { const testCaseDir = getTestCaseDir(9); const args = getCmdArgs(testCaseDir); const { exitCode, stderr } = await runCLI({ - args: ["run", ...args], + args: ["test", ...args], cwd: testCaseDir, cli: polywrapCli, }); @@ -304,7 +303,7 @@ describe("e2e tests for run command", () => { const testCaseDir = getTestCaseDir(10); const args = getCmdArgs(testCaseDir); const { exitCode, stdout, stderr } = await runCLI({ - args: ["run", ...args], + args: ["test", ...args], cwd: testCaseDir, cli: polywrapCli, }); @@ -323,7 +322,7 @@ describe("e2e tests for run command", () => { it("Should validate expected error", async () => { const testCaseDir = getTestCaseDir(11); const { exitCode, stdout } = await runCLI({ - args: ["run"], + args: ["test"], cwd: testCaseDir, cli: polywrapCli, }); diff --git a/packages/cli/src/commands/run.ts b/packages/cli/src/commands/run.ts index 04c4e69504..61a6e20134 100644 --- a/packages/cli/src/commands/run.ts +++ b/packages/cli/src/commands/run.ts @@ -38,8 +38,8 @@ const pathStr = intlMsg.commands_run_options_m_path(); export const run: Command = { setup: (program: Program) => { program - .command("run") - .alias("r") + .command("test") + .alias("t") .description(intlMsg.commands_run_description()) .option( `-m, --manifest-file <${pathStr}>`, diff --git a/packages/test-cases/cases/cli/run/001-yaml-workflow/polywrap.test.yaml b/packages/test-cases/cases/cli/test/001-yaml-workflow/polywrap.test.yaml similarity index 100% rename from packages/test-cases/cases/cli/run/001-yaml-workflow/polywrap.test.yaml rename to packages/test-cases/cases/cli/test/001-yaml-workflow/polywrap.test.yaml diff --git a/packages/test-cases/cases/cli/run/002-json-workflow/cmd.json b/packages/test-cases/cases/cli/test/002-json-workflow/cmd.json similarity index 100% rename from packages/test-cases/cases/cli/run/002-json-workflow/cmd.json rename to packages/test-cases/cases/cli/test/002-json-workflow/cmd.json diff --git a/packages/test-cases/cases/cli/run/002-json-workflow/polywrap.test.json b/packages/test-cases/cases/cli/test/002-json-workflow/polywrap.test.json similarity index 100% rename from packages/test-cases/cases/cli/run/002-json-workflow/polywrap.test.json rename to packages/test-cases/cases/cli/test/002-json-workflow/polywrap.test.json diff --git a/packages/test-cases/cases/cli/run/003-json-output/cmd.json b/packages/test-cases/cases/cli/test/003-json-output/cmd.json similarity index 100% rename from packages/test-cases/cases/cli/run/003-json-output/cmd.json rename to packages/test-cases/cases/cli/test/003-json-output/cmd.json diff --git a/packages/test-cases/cases/cli/run/003-json-output/polywrap.test.yaml b/packages/test-cases/cases/cli/test/003-json-output/polywrap.test.yaml similarity index 100% rename from packages/test-cases/cases/cli/run/003-json-output/polywrap.test.yaml rename to packages/test-cases/cases/cli/test/003-json-output/polywrap.test.yaml diff --git a/packages/test-cases/cases/cli/run/004-yaml-output/cmd.json b/packages/test-cases/cases/cli/test/004-yaml-output/cmd.json similarity index 100% rename from packages/test-cases/cases/cli/run/004-yaml-output/cmd.json rename to packages/test-cases/cases/cli/test/004-yaml-output/cmd.json diff --git a/packages/test-cases/cases/cli/run/004-yaml-output/polywrap.test.yaml b/packages/test-cases/cases/cli/test/004-yaml-output/polywrap.test.yaml similarity index 100% rename from packages/test-cases/cases/cli/run/004-yaml-output/polywrap.test.yaml rename to packages/test-cases/cases/cli/test/004-yaml-output/polywrap.test.yaml diff --git a/packages/test-cases/cases/cli/run/005-validate/polywrap.test.yaml b/packages/test-cases/cases/cli/test/005-validate/polywrap.test.yaml similarity index 100% rename from packages/test-cases/cases/cli/run/005-validate/polywrap.test.yaml rename to packages/test-cases/cases/cli/test/005-validate/polywrap.test.yaml diff --git a/packages/test-cases/cases/cli/run/005-validate/validator.cue b/packages/test-cases/cases/cli/test/005-validate/validator.cue similarity index 100% rename from packages/test-cases/cases/cli/run/005-validate/validator.cue rename to packages/test-cases/cases/cli/test/005-validate/validator.cue diff --git a/packages/test-cases/cases/cli/run/006-validation-fail/polywrap.test.yaml b/packages/test-cases/cases/cli/test/006-validation-fail/polywrap.test.yaml similarity index 100% rename from packages/test-cases/cases/cli/run/006-validation-fail/polywrap.test.yaml rename to packages/test-cases/cases/cli/test/006-validation-fail/polywrap.test.yaml diff --git a/packages/test-cases/cases/cli/run/006-validation-fail/validator.cue b/packages/test-cases/cases/cli/test/006-validation-fail/validator.cue similarity index 100% rename from packages/test-cases/cases/cli/run/006-validation-fail/validator.cue rename to packages/test-cases/cases/cli/test/006-validation-fail/validator.cue diff --git a/packages/test-cases/cases/cli/run/007-invalid-manifest/polywrap.test.yaml b/packages/test-cases/cases/cli/test/007-invalid-manifest/polywrap.test.yaml similarity index 100% rename from packages/test-cases/cases/cli/run/007-invalid-manifest/polywrap.test.yaml rename to packages/test-cases/cases/cli/test/007-invalid-manifest/polywrap.test.yaml diff --git a/packages/test-cases/cases/cli/run/008-custom-config/cmd.json b/packages/test-cases/cases/cli/test/008-custom-config/cmd.json similarity index 100% rename from packages/test-cases/cases/cli/run/008-custom-config/cmd.json rename to packages/test-cases/cases/cli/test/008-custom-config/cmd.json diff --git a/packages/test-cases/cases/cli/run/008-custom-config/config.ts b/packages/test-cases/cases/cli/test/008-custom-config/config.ts similarity index 100% rename from packages/test-cases/cases/cli/run/008-custom-config/config.ts rename to packages/test-cases/cases/cli/test/008-custom-config/config.ts diff --git a/packages/test-cases/cases/cli/run/008-custom-config/polywrap.test.yaml b/packages/test-cases/cases/cli/test/008-custom-config/polywrap.test.yaml similarity index 100% rename from packages/test-cases/cases/cli/run/008-custom-config/polywrap.test.yaml rename to packages/test-cases/cases/cli/test/008-custom-config/polywrap.test.yaml diff --git a/packages/test-cases/cases/cli/run/008-custom-config/validator.cue b/packages/test-cases/cases/cli/test/008-custom-config/validator.cue similarity index 100% rename from packages/test-cases/cases/cli/run/008-custom-config/validator.cue rename to packages/test-cases/cases/cli/test/008-custom-config/validator.cue diff --git a/packages/test-cases/cases/cli/run/009-nested-props/polywrap.test.yaml b/packages/test-cases/cases/cli/test/009-nested-props/polywrap.test.yaml similarity index 100% rename from packages/test-cases/cases/cli/run/009-nested-props/polywrap.test.yaml rename to packages/test-cases/cases/cli/test/009-nested-props/polywrap.test.yaml diff --git a/packages/test-cases/cases/cli/run/009-nested-props/validator.cue b/packages/test-cases/cases/cli/test/009-nested-props/validator.cue similarity index 100% rename from packages/test-cases/cases/cli/run/009-nested-props/validator.cue rename to packages/test-cases/cases/cli/test/009-nested-props/validator.cue diff --git a/packages/test-cases/cases/cli/run/010-reserved-job-names/polywrap.test.yaml b/packages/test-cases/cases/cli/test/010-reserved-job-names/polywrap.test.yaml similarity index 100% rename from packages/test-cases/cases/cli/run/010-reserved-job-names/polywrap.test.yaml rename to packages/test-cases/cases/cli/test/010-reserved-job-names/polywrap.test.yaml diff --git a/packages/test-cases/cases/cli/run/011-id-subset/cmd.json b/packages/test-cases/cases/cli/test/011-id-subset/cmd.json similarity index 100% rename from packages/test-cases/cases/cli/run/011-id-subset/cmd.json rename to packages/test-cases/cases/cli/test/011-id-subset/cmd.json diff --git a/packages/test-cases/cases/cli/run/011-id-subset/polywrap.test.yaml b/packages/test-cases/cases/cli/test/011-id-subset/polywrap.test.yaml similarity index 100% rename from packages/test-cases/cases/cli/run/011-id-subset/polywrap.test.yaml rename to packages/test-cases/cases/cli/test/011-id-subset/polywrap.test.yaml diff --git a/packages/test-cases/cases/cli/run/011-id-subset/validator.cue b/packages/test-cases/cases/cli/test/011-id-subset/validator.cue similarity index 100% rename from packages/test-cases/cases/cli/run/011-id-subset/validator.cue rename to packages/test-cases/cases/cli/test/011-id-subset/validator.cue diff --git a/packages/test-cases/cases/cli/run/012-validation-error-expected/polywrap.test.yaml b/packages/test-cases/cases/cli/test/012-validation-error-expected/polywrap.test.yaml similarity index 100% rename from packages/test-cases/cases/cli/run/012-validation-error-expected/polywrap.test.yaml rename to packages/test-cases/cases/cli/test/012-validation-error-expected/polywrap.test.yaml diff --git a/packages/test-cases/cases/cli/run/012-validation-error-expected/validator.cue b/packages/test-cases/cases/cli/test/012-validation-error-expected/validator.cue similarity index 100% rename from packages/test-cases/cases/cli/run/012-validation-error-expected/validator.cue rename to packages/test-cases/cases/cli/test/012-validation-error-expected/validator.cue diff --git a/packages/test-cases/cases/cli/run/run-test-wrapper/package.json b/packages/test-cases/cases/cli/test/run-test-wrapper/package.json similarity index 100% rename from packages/test-cases/cases/cli/run/run-test-wrapper/package.json rename to packages/test-cases/cases/cli/test/run-test-wrapper/package.json diff --git a/packages/test-cases/cases/cli/run/run-test-wrapper/polywrap.build.yaml b/packages/test-cases/cases/cli/test/run-test-wrapper/polywrap.build.yaml similarity index 100% rename from packages/test-cases/cases/cli/run/run-test-wrapper/polywrap.build.yaml rename to packages/test-cases/cases/cli/test/run-test-wrapper/polywrap.build.yaml diff --git a/packages/test-cases/cases/cli/run/run-test-wrapper/polywrap.yaml b/packages/test-cases/cases/cli/test/run-test-wrapper/polywrap.yaml similarity index 100% rename from packages/test-cases/cases/cli/run/run-test-wrapper/polywrap.yaml rename to packages/test-cases/cases/cli/test/run-test-wrapper/polywrap.yaml diff --git a/packages/test-cases/cases/cli/run/run-test-wrapper/src/index.ts b/packages/test-cases/cases/cli/test/run-test-wrapper/src/index.ts similarity index 100% rename from packages/test-cases/cases/cli/run/run-test-wrapper/src/index.ts rename to packages/test-cases/cases/cli/test/run-test-wrapper/src/index.ts diff --git a/packages/test-cases/cases/cli/run/run-test-wrapper/src/schema.graphql b/packages/test-cases/cases/cli/test/run-test-wrapper/src/schema.graphql similarity index 100% rename from packages/test-cases/cases/cli/run/run-test-wrapper/src/schema.graphql rename to packages/test-cases/cases/cli/test/run-test-wrapper/src/schema.graphql From 5587887e97c6534916bdb2cf3b21f2818e54ad9c Mon Sep 17 00:00:00 2001 From: Pileks Date: Wed, 19 Oct 2022 18:54:33 +0200 Subject: [PATCH 2/6] Rename files --- packages/cli/src/__tests__/e2e/{run.spec.ts => test.spec.ts} | 0 packages/cli/src/commands/index.ts | 2 +- packages/cli/src/commands/{run.ts => test.ts} | 0 3 files changed, 1 insertion(+), 1 deletion(-) rename packages/cli/src/__tests__/e2e/{run.spec.ts => test.spec.ts} (100%) rename packages/cli/src/commands/{run.ts => test.ts} (100%) diff --git a/packages/cli/src/__tests__/e2e/run.spec.ts b/packages/cli/src/__tests__/e2e/test.spec.ts similarity index 100% rename from packages/cli/src/__tests__/e2e/run.spec.ts rename to packages/cli/src/__tests__/e2e/test.spec.ts diff --git a/packages/cli/src/commands/index.ts b/packages/cli/src/commands/index.ts index 679a6877ff..978a0c4149 100644 --- a/packages/cli/src/commands/index.ts +++ b/packages/cli/src/commands/index.ts @@ -3,6 +3,6 @@ export * from "./codegen"; export * from "./create"; export * from "./deploy"; export * from "./infra"; -export * from "./run"; +export * from "./test"; export * from "./docgen"; export * from "./manifest"; diff --git a/packages/cli/src/commands/run.ts b/packages/cli/src/commands/test.ts similarity index 100% rename from packages/cli/src/commands/run.ts rename to packages/cli/src/commands/test.ts From 1fdbf93d23fa08eef35c98869ee5b1177870a2fc Mon Sep 17 00:00:00 2001 From: Pileks Date: Wed, 19 Oct 2022 18:56:37 +0200 Subject: [PATCH 3/6] missed rename for run->test rename --- packages/cli/src/commands/test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/src/commands/test.ts b/packages/cli/src/commands/test.ts index 61a6e20134..928734c648 100644 --- a/packages/cli/src/commands/test.ts +++ b/packages/cli/src/commands/test.ts @@ -35,7 +35,7 @@ type WorkflowCommandOptions = { const defaultManifestStr = defaultWorkflowManifest.join(" | "); const pathStr = intlMsg.commands_run_options_m_path(); -export const run: Command = { +export const test: Command = { setup: (program: Program) => { program .command("test") From 04a8e5334ccb1fbe33914e5ef7376e586aca6ad3 Mon Sep 17 00:00:00 2001 From: Pileks Date: Wed, 19 Oct 2022 19:11:03 +0200 Subject: [PATCH 4/6] rename run to test within intl --- packages/cli/lang/en.json | 90 +++++++++---------- packages/cli/lang/es.json | 90 +++++++++---------- packages/cli/src/commands/deploy.ts | 2 +- packages/cli/src/commands/test.ts | 16 ++-- .../src/lib/helpers/validate-client-config.ts | 42 ++++----- .../cli/src/lib/helpers/workflow-validator.ts | 2 +- .../src/lib/option-parsers/client-config.ts | 6 +- packages/cli/src/lib/option-parsers/index.ts | 2 +- .../lib/option-parsers/{run.ts => test.ts} | 2 +- packages/cli/src/lib/workflow/util.ts | 2 +- 10 files changed, 127 insertions(+), 127 deletions(-) rename packages/cli/src/lib/option-parsers/{run.ts => test.ts} (84%) diff --git a/packages/cli/lang/en.json b/packages/cli/lang/en.json index 213281f8d6..629e2096b8 100644 --- a/packages/cli/lang/en.json +++ b/packages/cli/lang/en.json @@ -121,51 +121,51 @@ "commands_create_readyPlugin": "You are ready to build a plugin into a Polywrap", "commands_create_readyProtocol": "You are ready to turn your protocol into a Polywrap", "commands_create_settingUp": "Setting everything up...", - "commands_run_options_workflow": "workflow", - "commands_run_options_workflowScript": "Path to workflow script", - "commands_run_options_outputFilePath": "output-file-path", - "commands_run_options_validateScript": "Validate the output of the workflow jobs", - "commands_run_options_validate": "cue-file", - "commands_run_options_outputFile": "Output file path for the test result", - "commands_run_options_m_path": "path", - "commands_run_options_m": "Path to the Polywrap Test manifest file (default: {default})", - "commands_run_options_jobIds": "jobs", - "commands_run_options_jobs": "Specify ids of jobs that you want to run", - "commands_run_error_validatorNotFound": "validate script not found at: {path}", - "commands_run_error_outputFileMissing": "{option} option missing {argument} argument", - "commands_run_error_clientConfigMissingPath": "{option} option missing {argument} argument", - "commands_run_error_clientConfigModuleMissingExport": "Custom client config module missing named export 'getClientConfig' at {module}", - "commands_run_error_clientConfigInvalidFileExt": "Custom client config file: {module} must be a JS/TS file", - "commands_run_error_clientConfigNotObject": "Custom client config must be an object", - "commands_run_error_redirectsExportNotArray": "Exported redirects must be an array", - "commands_run_error_redirectsItemNotValid": "Redirect at index {index} must be an object with properties 'from' and 'to'", - "commands_run_error_redirectsItemFromNotString": "Redirect property 'from' at index {index} must be a valid wrap:// URI string", - "commands_run_error_redirectsItemToNotStringOrObject": "Redirect property 'to' at index {index} must be a valid wrap:// URI string, or a plugin", - "commands_run_error_redirectsItemToNotValidPlugin": "Redirect property 'to' at index {index} must be a valid plugin instance", - "commands_run_error_pluginsExportNotArray": "Exported plugins must be an array", - "commands_run_error_pluginsItemNotObject": "Plugin at index {index} must be an object with properties 'uri' and 'plugin'", - "commands_run_error_pluginsItemUriNotString": "Plugin property 'uri' at index {index} must be a valid wrap:// URI string", - "commands_run_error_pluginsItemPluginNotObject": "Plugin property 'plugin' at index {index} must be an object with properties 'factory' and 'manifest'", - "commands_run_error_pluginsItemPluginFactoryNotFunction": "Plugin property 'plugin.factory' at index {index} must be a function", - "commands_run_error_pluginsItemPluginManifestNotObject": "Plugin property 'plugin.manifest' at index {index} must be an object", - "commands_run_error_interfacesExportNotArray": "Exported interfaces must be an array", - "commands_run_error_interfacesItemNotObject": "Interface at index {index} must be an object with properties 'interface' and 'implementations'", - "commands_run_error_interfacesItemInterfaceNotString": "Interface property 'interface' at index {index} must be a valid wrap:// URI string", - "commands_run_error_interfacesItemImplementationsNotArray": "Interface property 'implementations' at index {index} must be an array", - "commands_run_error_interfacesItemImplementationsEmpty": "Interface property 'implementations' at index {index} must not be an empty array", - "commands_run_error_interfacesItemImplementationsItemNotString": "Implementation at index ({index}, {implementationIndex}) must be a valid wrap:// URI string", - "commands_run_error_envsExportNotArray": "Exported envs must be an array", - "commands_run_error_envsItemNotObject": "Env at index {index} must be an object with properties 'uri'", - "commands_run_error_envsItemUriNotString": "Env property 'uri' at index {index} must be a valid wrap:// URI string", - "commands_run_error_envsItemModuleNotObject": "Env property 'env' at index {index} must be an object", - "commands_run_description": "Execute Test Manifests", - "commands_run_error_missingScript": "Required argument {script} is missing", - "commands_run_error_noApi": "API needs to be initialized", - "commands_run_error_readFail": "Failed to read query {query}", - "commands_run_error_unsupportedOutputFileExt": "Unsupported outputFile extention: {outputFileExt}", - "commands_run_error_cueDoesNotExist": "Require cue to run validator, checkout https://cuelang.org/ for more information", - "commands_run_error_noWorkflowScriptFound": "Workflow script not found at path: {path}", - "commands_run_error_noTestEnvFound": "polywrap test-env not found, please run 'polywrap infra up --modules=eth-ens-ipfs'", + "commands_test_options_workflow": "workflow", + "commands_test_options_workflowScript": "Path to workflow script", + "commands_test_options_outputFilePath": "output-file-path", + "commands_test_options_validateScript": "Validate the output of the workflow jobs", + "commands_test_options_validate": "cue-file", + "commands_test_options_outputFile": "Output file path for the test result", + "commands_test_options_m_path": "path", + "commands_test_options_m": "Path to the Polywrap Test manifest file (default: {default})", + "commands_test_options_jobIds": "jobs", + "commands_test_options_jobs": "Specify ids of jobs that you want to run", + "commands_test_error_validatorNotFound": "validate script not found at: {path}", + "commands_test_error_outputFileMissing": "{option} option missing {argument} argument", + "commands_test_error_clientConfigMissingPath": "{option} option missing {argument} argument", + "commands_test_error_clientConfigModuleMissingExport": "Custom client config module missing named export 'getClientConfig' at {module}", + "commands_test_error_clientConfigInvalidFileExt": "Custom client config file: {module} must be a JS/TS file", + "commands_test_error_clientConfigNotObject": "Custom client config must be an object", + "commands_test_error_redirectsExportNotArray": "Exported redirects must be an array", + "commands_test_error_redirectsItemNotValid": "Redirect at index {index} must be an object with properties 'from' and 'to'", + "commands_test_error_redirectsItemFromNotString": "Redirect property 'from' at index {index} must be a valid wrap:// URI string", + "commands_test_error_redirectsItemToNotStringOrObject": "Redirect property 'to' at index {index} must be a valid wrap:// URI string, or a plugin", + "commands_test_error_redirectsItemToNotValidPlugin": "Redirect property 'to' at index {index} must be a valid plugin instance", + "commands_test_error_pluginsExportNotArray": "Exported plugins must be an array", + "commands_test_error_pluginsItemNotObject": "Plugin at index {index} must be an object with properties 'uri' and 'plugin'", + "commands_test_error_pluginsItemUriNotString": "Plugin property 'uri' at index {index} must be a valid wrap:// URI string", + "commands_test_error_pluginsItemPluginNotObject": "Plugin property 'plugin' at index {index} must be an object with properties 'factory' and 'manifest'", + "commands_test_error_pluginsItemPluginFactoryNotFunction": "Plugin property 'plugin.factory' at index {index} must be a function", + "commands_test_error_pluginsItemPluginManifestNotObject": "Plugin property 'plugin.manifest' at index {index} must be an object", + "commands_test_error_interfacesExportNotArray": "Exported interfaces must be an array", + "commands_test_error_interfacesItemNotObject": "Interface at index {index} must be an object with properties 'interface' and 'implementations'", + "commands_test_error_interfacesItemInterfaceNotString": "Interface property 'interface' at index {index} must be a valid wrap:// URI string", + "commands_test_error_interfacesItemImplementationsNotArray": "Interface property 'implementations' at index {index} must be an array", + "commands_test_error_interfacesItemImplementationsEmpty": "Interface property 'implementations' at index {index} must not be an empty array", + "commands_test_error_interfacesItemImplementationsItemNotString": "Implementation at index ({index}, {implementationIndex}) must be a valid wrap:// URI string", + "commands_test_error_envsExportNotArray": "Exported envs must be an array", + "commands_test_error_envsItemNotObject": "Env at index {index} must be an object with properties 'uri'", + "commands_test_error_envsItemUriNotString": "Env property 'uri' at index {index} must be a valid wrap:// URI string", + "commands_test_error_envsItemModuleNotObject": "Env property 'env' at index {index} must be an object", + "commands_test_description": "Execute Tests", + "commands_test_error_missingScript": "Required argument {script} is missing", + "commands_test_error_noApi": "API needs to be initialized", + "commands_test_error_readFail": "Failed to read query {query}", + "commands_test_error_unsupportedOutputFileExt": "Unsupported outputFile extention: {outputFileExt}", + "commands_test_error_cueDoesNotExist": "Require cue to run validator, checkout https://cuelang.org/ for more information", + "commands_test_error_noWorkflowScriptFound": "Workflow script not found at path: {path}", + "commands_test_error_noTestEnvFound": "polywrap test-env not found, please run 'polywrap infra up --modules=eth-ens-ipfs'", "commands_polywrap_error_notACommand": "is not a command", "commands_polywrap_helpPrompt": "Type {command} to view common commands", "commands_manifest_description": "Inspect & Migrade Polywrap Manifests", diff --git a/packages/cli/lang/es.json b/packages/cli/lang/es.json index 213281f8d6..629e2096b8 100644 --- a/packages/cli/lang/es.json +++ b/packages/cli/lang/es.json @@ -121,51 +121,51 @@ "commands_create_readyPlugin": "You are ready to build a plugin into a Polywrap", "commands_create_readyProtocol": "You are ready to turn your protocol into a Polywrap", "commands_create_settingUp": "Setting everything up...", - "commands_run_options_workflow": "workflow", - "commands_run_options_workflowScript": "Path to workflow script", - "commands_run_options_outputFilePath": "output-file-path", - "commands_run_options_validateScript": "Validate the output of the workflow jobs", - "commands_run_options_validate": "cue-file", - "commands_run_options_outputFile": "Output file path for the test result", - "commands_run_options_m_path": "path", - "commands_run_options_m": "Path to the Polywrap Test manifest file (default: {default})", - "commands_run_options_jobIds": "jobs", - "commands_run_options_jobs": "Specify ids of jobs that you want to run", - "commands_run_error_validatorNotFound": "validate script not found at: {path}", - "commands_run_error_outputFileMissing": "{option} option missing {argument} argument", - "commands_run_error_clientConfigMissingPath": "{option} option missing {argument} argument", - "commands_run_error_clientConfigModuleMissingExport": "Custom client config module missing named export 'getClientConfig' at {module}", - "commands_run_error_clientConfigInvalidFileExt": "Custom client config file: {module} must be a JS/TS file", - "commands_run_error_clientConfigNotObject": "Custom client config must be an object", - "commands_run_error_redirectsExportNotArray": "Exported redirects must be an array", - "commands_run_error_redirectsItemNotValid": "Redirect at index {index} must be an object with properties 'from' and 'to'", - "commands_run_error_redirectsItemFromNotString": "Redirect property 'from' at index {index} must be a valid wrap:// URI string", - "commands_run_error_redirectsItemToNotStringOrObject": "Redirect property 'to' at index {index} must be a valid wrap:// URI string, or a plugin", - "commands_run_error_redirectsItemToNotValidPlugin": "Redirect property 'to' at index {index} must be a valid plugin instance", - "commands_run_error_pluginsExportNotArray": "Exported plugins must be an array", - "commands_run_error_pluginsItemNotObject": "Plugin at index {index} must be an object with properties 'uri' and 'plugin'", - "commands_run_error_pluginsItemUriNotString": "Plugin property 'uri' at index {index} must be a valid wrap:// URI string", - "commands_run_error_pluginsItemPluginNotObject": "Plugin property 'plugin' at index {index} must be an object with properties 'factory' and 'manifest'", - "commands_run_error_pluginsItemPluginFactoryNotFunction": "Plugin property 'plugin.factory' at index {index} must be a function", - "commands_run_error_pluginsItemPluginManifestNotObject": "Plugin property 'plugin.manifest' at index {index} must be an object", - "commands_run_error_interfacesExportNotArray": "Exported interfaces must be an array", - "commands_run_error_interfacesItemNotObject": "Interface at index {index} must be an object with properties 'interface' and 'implementations'", - "commands_run_error_interfacesItemInterfaceNotString": "Interface property 'interface' at index {index} must be a valid wrap:// URI string", - "commands_run_error_interfacesItemImplementationsNotArray": "Interface property 'implementations' at index {index} must be an array", - "commands_run_error_interfacesItemImplementationsEmpty": "Interface property 'implementations' at index {index} must not be an empty array", - "commands_run_error_interfacesItemImplementationsItemNotString": "Implementation at index ({index}, {implementationIndex}) must be a valid wrap:// URI string", - "commands_run_error_envsExportNotArray": "Exported envs must be an array", - "commands_run_error_envsItemNotObject": "Env at index {index} must be an object with properties 'uri'", - "commands_run_error_envsItemUriNotString": "Env property 'uri' at index {index} must be a valid wrap:// URI string", - "commands_run_error_envsItemModuleNotObject": "Env property 'env' at index {index} must be an object", - "commands_run_description": "Execute Test Manifests", - "commands_run_error_missingScript": "Required argument {script} is missing", - "commands_run_error_noApi": "API needs to be initialized", - "commands_run_error_readFail": "Failed to read query {query}", - "commands_run_error_unsupportedOutputFileExt": "Unsupported outputFile extention: {outputFileExt}", - "commands_run_error_cueDoesNotExist": "Require cue to run validator, checkout https://cuelang.org/ for more information", - "commands_run_error_noWorkflowScriptFound": "Workflow script not found at path: {path}", - "commands_run_error_noTestEnvFound": "polywrap test-env not found, please run 'polywrap infra up --modules=eth-ens-ipfs'", + "commands_test_options_workflow": "workflow", + "commands_test_options_workflowScript": "Path to workflow script", + "commands_test_options_outputFilePath": "output-file-path", + "commands_test_options_validateScript": "Validate the output of the workflow jobs", + "commands_test_options_validate": "cue-file", + "commands_test_options_outputFile": "Output file path for the test result", + "commands_test_options_m_path": "path", + "commands_test_options_m": "Path to the Polywrap Test manifest file (default: {default})", + "commands_test_options_jobIds": "jobs", + "commands_test_options_jobs": "Specify ids of jobs that you want to run", + "commands_test_error_validatorNotFound": "validate script not found at: {path}", + "commands_test_error_outputFileMissing": "{option} option missing {argument} argument", + "commands_test_error_clientConfigMissingPath": "{option} option missing {argument} argument", + "commands_test_error_clientConfigModuleMissingExport": "Custom client config module missing named export 'getClientConfig' at {module}", + "commands_test_error_clientConfigInvalidFileExt": "Custom client config file: {module} must be a JS/TS file", + "commands_test_error_clientConfigNotObject": "Custom client config must be an object", + "commands_test_error_redirectsExportNotArray": "Exported redirects must be an array", + "commands_test_error_redirectsItemNotValid": "Redirect at index {index} must be an object with properties 'from' and 'to'", + "commands_test_error_redirectsItemFromNotString": "Redirect property 'from' at index {index} must be a valid wrap:// URI string", + "commands_test_error_redirectsItemToNotStringOrObject": "Redirect property 'to' at index {index} must be a valid wrap:// URI string, or a plugin", + "commands_test_error_redirectsItemToNotValidPlugin": "Redirect property 'to' at index {index} must be a valid plugin instance", + "commands_test_error_pluginsExportNotArray": "Exported plugins must be an array", + "commands_test_error_pluginsItemNotObject": "Plugin at index {index} must be an object with properties 'uri' and 'plugin'", + "commands_test_error_pluginsItemUriNotString": "Plugin property 'uri' at index {index} must be a valid wrap:// URI string", + "commands_test_error_pluginsItemPluginNotObject": "Plugin property 'plugin' at index {index} must be an object with properties 'factory' and 'manifest'", + "commands_test_error_pluginsItemPluginFactoryNotFunction": "Plugin property 'plugin.factory' at index {index} must be a function", + "commands_test_error_pluginsItemPluginManifestNotObject": "Plugin property 'plugin.manifest' at index {index} must be an object", + "commands_test_error_interfacesExportNotArray": "Exported interfaces must be an array", + "commands_test_error_interfacesItemNotObject": "Interface at index {index} must be an object with properties 'interface' and 'implementations'", + "commands_test_error_interfacesItemInterfaceNotString": "Interface property 'interface' at index {index} must be a valid wrap:// URI string", + "commands_test_error_interfacesItemImplementationsNotArray": "Interface property 'implementations' at index {index} must be an array", + "commands_test_error_interfacesItemImplementationsEmpty": "Interface property 'implementations' at index {index} must not be an empty array", + "commands_test_error_interfacesItemImplementationsItemNotString": "Implementation at index ({index}, {implementationIndex}) must be a valid wrap:// URI string", + "commands_test_error_envsExportNotArray": "Exported envs must be an array", + "commands_test_error_envsItemNotObject": "Env at index {index} must be an object with properties 'uri'", + "commands_test_error_envsItemUriNotString": "Env property 'uri' at index {index} must be a valid wrap:// URI string", + "commands_test_error_envsItemModuleNotObject": "Env property 'env' at index {index} must be an object", + "commands_test_description": "Execute Tests", + "commands_test_error_missingScript": "Required argument {script} is missing", + "commands_test_error_noApi": "API needs to be initialized", + "commands_test_error_readFail": "Failed to read query {query}", + "commands_test_error_unsupportedOutputFileExt": "Unsupported outputFile extention: {outputFileExt}", + "commands_test_error_cueDoesNotExist": "Require cue to run validator, checkout https://cuelang.org/ for more information", + "commands_test_error_noWorkflowScriptFound": "Workflow script not found at path: {path}", + "commands_test_error_noTestEnvFound": "polywrap test-env not found, please run 'polywrap infra up --modules=eth-ens-ipfs'", "commands_polywrap_error_notACommand": "is not a command", "commands_polywrap_helpPrompt": "Type {command} to view common commands", "commands_manifest_description": "Inspect & Migrade Polywrap Manifests", diff --git a/packages/cli/src/commands/deploy.ts b/packages/cli/src/commands/deploy.ts index c35f6ef210..df0d449f71 100644 --- a/packages/cli/src/commands/deploy.ts +++ b/packages/cli/src/commands/deploy.ts @@ -150,7 +150,7 @@ async function run(options: DeployCommandOptions): Promise { break; default: throw new Error( - intlMsg.commands_run_error_unsupportedOutputFileExt({ outputFileExt }) + intlMsg.commands_test_error_unsupportedOutputFileExt({ outputFileExt }) ); } } diff --git a/packages/cli/src/commands/test.ts b/packages/cli/src/commands/test.ts index 928734c648..5a5647e860 100644 --- a/packages/cli/src/commands/test.ts +++ b/packages/cli/src/commands/test.ts @@ -33,17 +33,17 @@ type WorkflowCommandOptions = { }; const defaultManifestStr = defaultWorkflowManifest.join(" | "); -const pathStr = intlMsg.commands_run_options_m_path(); +const pathStr = intlMsg.commands_test_options_m_path(); export const test: Command = { setup: (program: Program) => { program .command("test") .alias("t") - .description(intlMsg.commands_run_description()) + .description(intlMsg.commands_test_description()) .option( `-m, --manifest-file <${pathStr}>`, - intlMsg.commands_run_options_m({ + intlMsg.commands_test_options_m({ default: defaultManifestStr, }) ) @@ -52,12 +52,12 @@ export const test: Command = { `${intlMsg.commands_common_options_config()}` ) .option( - `-o, --output-file <${intlMsg.commands_run_options_outputFilePath()}>`, - `${intlMsg.commands_run_options_outputFile()}` + `-o, --output-file <${intlMsg.commands_test_options_outputFilePath()}>`, + `${intlMsg.commands_test_options_outputFile()}` ) .option( - `-j, --jobs <${intlMsg.commands_run_options_jobIds()}...>`, - intlMsg.commands_run_options_jobs() + `-j, --jobs <${intlMsg.commands_test_options_jobIds()}...>`, + intlMsg.commands_test_options_jobs() ) .option("-v, --verbose", intlMsg.commands_common_options_verbose()) .option("-q, --quiet", intlMsg.commands_common_options_quiet()) @@ -133,7 +133,7 @@ const _run = async (options: WorkflowCommandOptions) => { break; default: throw new Error( - intlMsg.commands_run_error_unsupportedOutputFileExt({ outputFileExt }) + intlMsg.commands_test_error_unsupportedOutputFileExt({ outputFileExt }) ); } } diff --git a/packages/cli/src/lib/helpers/validate-client-config.ts b/packages/cli/src/lib/helpers/validate-client-config.ts index 0538796e05..2ab535ecd8 100644 --- a/packages/cli/src/lib/helpers/validate-client-config.ts +++ b/packages/cli/src/lib/helpers/validate-client-config.ts @@ -14,7 +14,7 @@ export function validateRedirects< TUri extends PluginPackage | Uri | string >(redirects: readonly UriRedirect[]): void { if (!Array.isArray(redirects)) { - throw new Error(intlMsg.commands_run_error_redirectsExportNotArray()); + throw new Error(intlMsg.commands_test_error_redirectsExportNotArray()); } // Ensure each redirect in the array is valid @@ -23,19 +23,19 @@ export function validateRedirects< if (typeof redirect !== "object" || !redirect.from || !redirect.to) { throw new Error( - intlMsg.commands_run_error_redirectsItemNotValid({ + intlMsg.commands_test_error_redirectsItemNotValid({ index: i.toString(), }) ); } else if (typeof redirect.from !== "string") { throw new Error( - intlMsg.commands_run_error_redirectsItemFromNotString({ + intlMsg.commands_test_error_redirectsItemFromNotString({ index: i.toString(), }) ); } else if (typeof redirect.to !== "string") { throw new Error( - intlMsg.commands_run_error_redirectsItemToNotStringOrObject({ + intlMsg.commands_test_error_redirectsItemToNotStringOrObject({ index: i.toString(), }) ); @@ -47,7 +47,7 @@ export function validatePlugins( plugins: readonly PluginRegistration[] ): void { if (!Array.isArray(plugins)) { - throw new Error(intlMsg.commands_run_error_pluginsExportNotArray()); + throw new Error(intlMsg.commands_test_error_pluginsExportNotArray()); } // Ensure each plugin in the array is valid @@ -55,31 +55,31 @@ export function validatePlugins( const plugin = plugins[i]; if (typeof plugin !== "object") { throw new Error( - intlMsg.commands_run_error_pluginsItemNotObject({ + intlMsg.commands_test_error_pluginsItemNotObject({ index: i.toString(), }) ); } else if (typeof plugin.uri !== "string") { throw new Error( - intlMsg.commands_run_error_pluginsItemUriNotString({ + intlMsg.commands_test_error_pluginsItemUriNotString({ index: i.toString(), }) ); } else if (typeof plugin.plugin !== "object") { throw new Error( - intlMsg.commands_run_error_pluginsItemPluginNotObject({ + intlMsg.commands_test_error_pluginsItemPluginNotObject({ index: i.toString(), }) ); } else if (typeof plugin.plugin.factory !== "function") { throw new Error( - intlMsg.commands_run_error_pluginsItemPluginFactoryNotFunction({ + intlMsg.commands_test_error_pluginsItemPluginFactoryNotFunction({ index: i.toString(), }) ); } else if (typeof plugin.plugin.manifest !== "object") { throw new Error( - intlMsg.commands_run_error_pluginsItemPluginManifestNotObject({ + intlMsg.commands_test_error_pluginsItemPluginManifestNotObject({ index: i.toString(), }) ); @@ -91,32 +91,32 @@ export function validateInterfaces( interfaces: readonly InterfaceImplementations[] ): void { if (!Array.isArray(interfaces)) { - throw new Error(intlMsg.commands_run_error_interfacesExportNotArray()); + throw new Error(intlMsg.commands_test_error_interfacesExportNotArray()); } // Ensure each interface in the array is valid for (let i = 0; i < interfaces.length; ++i) { const interfaceImplementations = interfaces[i]; if (typeof interfaceImplementations !== "object") { throw new Error( - intlMsg.commands_run_error_interfacesItemNotObject({ + intlMsg.commands_test_error_interfacesItemNotObject({ index: i.toString(), }) ); } else if (typeof interfaceImplementations.interface !== "string") { throw new Error( - intlMsg.commands_run_error_interfacesItemInterfaceNotString({ + intlMsg.commands_test_error_interfacesItemInterfaceNotString({ index: i.toString(), }) ); } else if (!Array.isArray(interfaceImplementations.implementations)) { throw new Error( - intlMsg.commands_run_error_interfacesItemImplementationsNotArray({ + intlMsg.commands_test_error_interfacesItemImplementationsNotArray({ index: i.toString(), }) ); } else if (interfaceImplementations.implementations.length === 0) { throw new Error( - intlMsg.commands_run_error_interfacesItemImplementationsEmpty({ + intlMsg.commands_test_error_interfacesItemImplementationsEmpty({ index: i.toString(), }) ); @@ -125,7 +125,7 @@ export function validateInterfaces( const implementation = interfaceImplementations.implementations[j]; if (typeof implementation !== "string") { throw new Error( - intlMsg.commands_run_error_interfacesItemImplementationsItemNotString( + intlMsg.commands_test_error_interfacesItemImplementationsItemNotString( { index: i.toString(), implementationIndex: j.toString(), @@ -141,25 +141,25 @@ export function validateEnvs( envs: readonly Env[] ): void { if (!Array.isArray(envs)) { - throw new Error(intlMsg.commands_run_error_envsExportNotArray()); + throw new Error(intlMsg.commands_test_error_envsExportNotArray()); } for (let i = 0; i < envs.length; ++i) { const env = envs[i]; if (typeof env !== "object") { throw new Error( - intlMsg.commands_run_error_envsItemNotObject({ + intlMsg.commands_test_error_envsItemNotObject({ index: i.toString(), }) ); } else if (typeof env.uri !== "string") { throw new Error( - intlMsg.commands_run_error_envsItemUriNotString({ + intlMsg.commands_test_error_envsItemUriNotString({ index: i.toString(), }) ); } else if (!env.env && typeof env.env !== "object") { throw new Error( - intlMsg.commands_run_error_envsItemModuleNotObject({ + intlMsg.commands_test_error_envsItemModuleNotObject({ index: i.toString(), }) ); @@ -171,7 +171,7 @@ export function validateClientConfig( config: Partial ): void { if (!config || typeof config !== "object") { - throw new Error(intlMsg.commands_run_error_clientConfigNotObject()); + throw new Error(intlMsg.commands_test_error_clientConfigNotObject()); } if (config.plugins) validatePlugins(config.plugins); if (config.envs) validateEnvs(config.envs); diff --git a/packages/cli/src/lib/helpers/workflow-validator.ts b/packages/cli/src/lib/helpers/workflow-validator.ts index 91c0a3e9ab..b75c9fdd88 100644 --- a/packages/cli/src/lib/helpers/workflow-validator.ts +++ b/packages/cli/src/lib/helpers/workflow-validator.ts @@ -20,7 +20,7 @@ export function validateOutput( logger: Logger ): void { if (!cueExists(logger)) { - console.warn(intlMsg.commands_run_error_cueDoesNotExist()); + console.warn(intlMsg.commands_test_error_cueDoesNotExist()); } const { id, data, error } = output; diff --git a/packages/cli/src/lib/option-parsers/client-config.ts b/packages/cli/src/lib/option-parsers/client-config.ts index 0f3f464d03..1cd1dd93f5 100644 --- a/packages/cli/src/lib/option-parsers/client-config.ts +++ b/packages/cli/src/lib/option-parsers/client-config.ts @@ -14,7 +14,7 @@ export async function parseClientConfigOption( try { finalClientConfig = await getTestEnvClientConfig(); } catch (e) { - console.error(intlMsg.commands_run_error_noTestEnvFound()); + console.error(intlMsg.commands_test_error_noTestEnvFound()); process.exit(1); } @@ -27,7 +27,7 @@ export async function parseClientConfigOption( } else if (configPath.endsWith(".ts")) { configModule = await importTypescriptModule(path.resolve(configPath)); } else { - const configsModuleMissingExportMessage = intlMsg.commands_run_error_clientConfigInvalidFileExt( + const configsModuleMissingExportMessage = intlMsg.commands_test_error_clientConfigInvalidFileExt( { module: configPath } ); console.error(configsModuleMissingExportMessage); @@ -35,7 +35,7 @@ export async function parseClientConfigOption( } if (!configModule || !configModule.getClientConfig) { - const configsModuleMissingExportMessage = intlMsg.commands_run_error_clientConfigModuleMissingExport( + const configsModuleMissingExportMessage = intlMsg.commands_test_error_clientConfigModuleMissingExport( { module: configModule } ); console.error(configsModuleMissingExportMessage); diff --git a/packages/cli/src/lib/option-parsers/index.ts b/packages/cli/src/lib/option-parsers/index.ts index 482fd2ecde..05f0f83311 100644 --- a/packages/cli/src/lib/option-parsers/index.ts +++ b/packages/cli/src/lib/option-parsers/index.ts @@ -1,5 +1,5 @@ export * from "./client-config"; export * from "./codegen"; export * from "./dir"; -export * from "./run"; +export * from "./test"; export * from "./manifestFile"; diff --git a/packages/cli/src/lib/option-parsers/run.ts b/packages/cli/src/lib/option-parsers/test.ts similarity index 84% rename from packages/cli/src/lib/option-parsers/run.ts rename to packages/cli/src/lib/option-parsers/test.ts index cab0a10afa..0e9b07ba45 100644 --- a/packages/cli/src/lib/option-parsers/run.ts +++ b/packages/cli/src/lib/option-parsers/test.ts @@ -7,7 +7,7 @@ export function parseWorkflowScriptPathOption(script: string): string { const absPath = path.resolve(script); if (!fs.existsSync(absPath)) { throw new Error( - intlMsg.commands_run_error_noWorkflowScriptFound({ path: absPath }) + intlMsg.commands_test_error_noWorkflowScriptFound({ path: absPath }) ); } return absPath; diff --git a/packages/cli/src/lib/workflow/util.ts b/packages/cli/src/lib/workflow/util.ts index adba189b4b..2bbdc6df73 100644 --- a/packages/cli/src/lib/workflow/util.ts +++ b/packages/cli/src/lib/workflow/util.ts @@ -28,7 +28,7 @@ export function loadValidationScript( if (!fs.existsSync(cueFilepath)) { console.error( - intlMsg.commands_run_error_validatorNotFound({ + intlMsg.commands_test_error_validatorNotFound({ path: cueFilepath, }) ); From 503a9562997c5f39a56a68058f1f5993aac1671e Mon Sep 17 00:00:00 2001 From: Pileks Date: Wed, 19 Oct 2022 19:12:22 +0200 Subject: [PATCH 5/6] Update HELP text tests --- packages/cli/src/__tests__/e2e/help.spec.ts | 2 +- packages/cli/src/__tests__/e2e/no-command.spec.ts | 2 +- packages/cli/src/__tests__/e2e/test.spec.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/cli/src/__tests__/e2e/help.spec.ts b/packages/cli/src/__tests__/e2e/help.spec.ts index f4eed59efa..455940204e 100644 --- a/packages/cli/src/__tests__/e2e/help.spec.ts +++ b/packages/cli/src/__tests__/e2e/help.spec.ts @@ -14,7 +14,7 @@ Commands: create|c Create New Projects deploy|d [options] Deploys Polywrap Projects infra|i [options] Modular Infrastructure-As-Code Orchestrator - test|t [options] Execute Test Manifests + test|t [options] Execute Tests docgen|o [options] Generate wrapper documentation manifest|m Inspect & Migrade Polywrap Manifests help [command] display help for command diff --git a/packages/cli/src/__tests__/e2e/no-command.spec.ts b/packages/cli/src/__tests__/e2e/no-command.spec.ts index 0c6cb32b53..c870cb2ee6 100644 --- a/packages/cli/src/__tests__/e2e/no-command.spec.ts +++ b/packages/cli/src/__tests__/e2e/no-command.spec.ts @@ -14,7 +14,7 @@ Commands: create|c Create New Projects deploy|d [options] Deploys Polywrap Projects infra|i [options] Modular Infrastructure-As-Code Orchestrator - test|t [options] Execute Test Manifests + test|t [options] Execute Tests docgen|o [options] Generate wrapper documentation manifest|m Inspect & Migrade Polywrap Manifests help [command] display help for command diff --git a/packages/cli/src/__tests__/e2e/test.spec.ts b/packages/cli/src/__tests__/e2e/test.spec.ts index d1a5f886e7..dc6a88dd39 100644 --- a/packages/cli/src/__tests__/e2e/test.spec.ts +++ b/packages/cli/src/__tests__/e2e/test.spec.ts @@ -11,7 +11,7 @@ jest.setTimeout(200000); const HELP = `Usage: polywrap test|t [options] -Execute Test Manifests +Execute Tests Options: -m, --manifest-file Path to the Polywrap Test manifest file From 522b41f0e2ff647b5946b7f7dfb790feb6318b80 Mon Sep 17 00:00:00 2001 From: Pileks Date: Wed, 19 Oct 2022 19:13:28 +0200 Subject: [PATCH 6/6] chore: lint --- packages/cli/src/commands/deploy.ts | 4 +++- packages/cli/src/commands/test.ts | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/cli/src/commands/deploy.ts b/packages/cli/src/commands/deploy.ts index df0d449f71..ce159e48ef 100644 --- a/packages/cli/src/commands/deploy.ts +++ b/packages/cli/src/commands/deploy.ts @@ -150,7 +150,9 @@ async function run(options: DeployCommandOptions): Promise { break; default: throw new Error( - intlMsg.commands_test_error_unsupportedOutputFileExt({ outputFileExt }) + intlMsg.commands_test_error_unsupportedOutputFileExt({ + outputFileExt, + }) ); } } diff --git a/packages/cli/src/commands/test.ts b/packages/cli/src/commands/test.ts index 5a5647e860..fb65ffedb4 100644 --- a/packages/cli/src/commands/test.ts +++ b/packages/cli/src/commands/test.ts @@ -133,7 +133,9 @@ const _run = async (options: WorkflowCommandOptions) => { break; default: throw new Error( - intlMsg.commands_test_error_unsupportedOutputFileExt({ outputFileExt }) + intlMsg.commands_test_error_unsupportedOutputFileExt({ + outputFileExt, + }) ); } }