diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 4e990707f..e6d33c047 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -5,9 +5,9 @@ name: Node.js CI on: push: - branches: [master] + branches: [master, rebranding] pull_request: - branches: [master] + branches: [master, rebranding] jobs: build: diff --git a/bin/hermione b/bin/hermione index e0a06e07b..552dbc4fa 100755 --- a/bin/hermione +++ b/bin/hermione @@ -1,4 +1,4 @@ #!/usr/bin/env node 'use strict'; -var cli = require('../build/src/cli').run(); +var cli = require('../build/src/cli').run({ cliName: 'hermione' }); diff --git a/bin/testplane b/bin/testplane new file mode 100755 index 000000000..e0a06e07b --- /dev/null +++ b/bin/testplane @@ -0,0 +1,4 @@ +#!/usr/bin/env node +'use strict'; + +var cli = require('../build/src/cli').run(); diff --git a/package-lock.json b/package-lock.json index 7629857d5..7ee208898 100644 --- a/package-lock.json +++ b/package-lock.json @@ -45,7 +45,8 @@ "yallist": "3.1.1" }, "bin": { - "hermione": "bin/hermione" + "hermione": "bin/hermione", + "testplane": "bin/hermione" }, "devDependencies": { "@commitlint/cli": "^19.0.3", diff --git a/package.json b/package.json index 679235325..059b6195d 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,8 @@ "test" ], "bin": { - "hermione": "./bin/hermione" + "hermione": "./bin/hermione", + "testplane": "./bin/testplane" }, "license": "MIT", "dependencies": { diff --git a/src/cli/index.js b/src/cli/index.js index 71af0e804..8f520b97f 100644 --- a/src/cli/index.js +++ b/src/cli/index.js @@ -39,8 +39,8 @@ process.on("unhandledRejection", (reason, p) => { } }); -exports.run = () => { - const program = new Command(); +exports.run = (opts = {}) => { + const program = new Command(opts.cliName || "testplane"); program.version(pkg.version).allowUnknownOption().option("-c, --config ", "path to configuration file"); @@ -48,7 +48,7 @@ exports.run = () => { hermione = Hermione.create(configPath); program - .on("--help", () => logger.log(info.configOverriding)) + .on("--help", () => logger.log(info.configOverriding(opts))) .option("-b, --browser ", "run tests only in specified browser", collect) .option("-s, --set ", "run tests only in the specified set", collect) .option("-r, --require ", "require module", collect) diff --git a/src/cli/info.js b/src/cli/info.js index 2933a8ec7..f4e267a5f 100644 --- a/src/cli/info.js +++ b/src/cli/info.js @@ -1,20 +1,24 @@ "use strict"; -exports.configOverriding = ` Overriding config +exports.configOverriding = (opts = {}) => { + const cliName = opts.cliName || "testplane"; + + return ` Overriding config To override any config option use full option path converted to --kebab-case Examples: - hermione --system-debug true - hermione --base-url http://example.com - hermione --browsers-firefox-sessions-per-browser 10 + ${cliName} --system-debug true + ${cliName} --base-url http://example.com + ${cliName} --browsers-firefox-sessions-per-browser 10 You can also use environment variables converted to snake_case with - hermione_ prefix + ${cliName}_ prefix Examples: - hermione_system_debug=true hermione - hermione_base_url=http://example.com hermione - hermione_browsers_firefox_sessions_per_browser=10 hermione + ${cliName}_system_debug=true ${cliName} + ${cliName}_base_url=http://example.com ${cliName} + ${cliName}_browsers_firefox_sessions_per_browser=10 ${cliName} If both cli option and environment variable are used, cli option takes precedence `; +}; diff --git a/test/src/cli/index.js b/test/src/cli/index.js index 2fa0514ac..b62bfaa2c 100644 --- a/test/src/cli/index.js +++ b/test/src/cli/index.js @@ -38,11 +38,27 @@ describe("cli", () => { afterEach(() => sandbox.restore()); - it('should show information about config overriding on "--help"', async () => { - await run_("--help"); + describe("config overriding", () => { + it('should show information about config overriding on "--help"', async () => { + await run_("--help"); - assert.calledOnce(logger.log); - assert.calledWith(logger.log, info.configOverriding); + assert.calledOnce(logger.log); + assert.calledWith(logger.log, info.configOverriding()); + }); + + it("should show information about testplane by default", async () => { + const defaultResult = info.configOverriding(); + + assert.isTrue(defaultResult.includes("testplane")); + assert.isFalse(defaultResult.includes("hermione")); + }); + + it("should show information about hermione", async () => { + const result = info.configOverriding({ cliName: "hermione" }); + + assert.isTrue(result.includes("hermione")); + assert.isFalse(result.includes("testplane")); + }); }); it("should create Hermione instance", async () => {