codeceptjs / CodeceptJS

Supercharged End 2 End Testing Framework for NodeJS
http://codecept.io
MIT License
4.1k stars 723 forks source link

Bug: run-workers --suites doesn't work in Codecept 3.x #2636

Closed joshuacoveauth0 closed 3 years ago

joshuacoveauth0 commented 3 years ago

What are you trying to achieve?

I'd like to use the --suites param for run-workers so that scenarios from a given feature are not split between different workers

What do you get instead?

codeceptjs run-workers 6 works as expected codeceptjs run-workers --suites 6 runs 0 tests

Provide console output if related. Use --verbose mode for more details.

# paste output here

Provide test source code if related

// paste test

Details

// updates process.env based on the contents of a .env file
if (process.env.ENV_FILE) {
  console.log(`Loading [${process.env.ENV_FILE}]...`);
  require("dotenv").config({ path: process.env.ENV_FILE });
} else {
  require("dotenv").config();
}

const path = require("path");
const pageObjects = require("./page-objects");
const customHelpers = require("./custom-helpers");

const ROOT = process.cwd();
const outputUniqueId = process.env.OUTPUT_UID
  ? `-${process.env.OUTPUT_UID}`
  : "";

const config = {
  name: "Functional Tests",
  tests: path.join(ROOT, "tests/**/*test.js"),
  timeout: 10000,
  output: path.join(ROOT, "output"),

  // objects that are included in the I object
  helpers: {
    AssertWrapper: {
      require: "codeceptjs-assert",
    },
    ChaiWrapper: {
      require: "codeceptjs-chai",
    },
    Mochawesome: {
      includeScreenshots: true,
      shortScrFileNames: true,
      uniqueScreenshotNames: true,
      screenshotUseRelativePath: true,
      inlineAssets: true,
    },
    ...customHelpers,
  },

  // objects that are available in test files without import / require
  include: {
    environmentConfig: path.join(
      ROOT,
      "config/environments/init-environment.js"
    ),
    ...pageObjects,
  },

  multiple: {
    jenkins: { browsers: ["chrome"] },
    basic: {
      browsers: [
        "safari",
        "internet explorer",
        "chrome",
        "firefox",
        "microsoft edge",
      ],
    },
  },

  mocha: {
    reporterOptions: {
      "mocha-junit-reporter": {
        stdout: "-",
        options: {
          mochaFile: path.join(
            ROOT,
            `output/junit/result${outputUniqueId}.xml`
          ),
          reportDir: path.join(ROOT, "output/junit"),
          enableCharts: true,
          inlineAssets: true,
        },
      },
      mochawesome: {
        stdout: path.join(
          ROOT,
          `output/mochawesome/console${outputUniqueId}.log`
        ),
        options: {
          reportDir: path.join(ROOT, "output/mochawesome"),
          reportFilename: `mochawesome${outputUniqueId}`,
        },
      },
      "codeceptjs-cli-reporter": {
        stdout: "-",
        options: {
          verbose: process.env.VERBOSE_OUTPUT == "true",
          steps: process.env.STEP_OUTPUT == "true",
        },
      },
    },
  },

  bootstrap: false,
  teardown: null,
  hooks: [],

  plugins: {
    datadogReporter: {
      require: path.join(ROOT, "plugins/datadog-reporter/datadog-reporter.js"),
      enabled: true,
      apiKey: process.env.DATADOG_API_KEY,
      metricsPrefix: "test_infra.auth0_functionaltests.",
      ciJobName: process.env.JOB_NAME,
      gitUrl: process.env.GIT_URL,
      gitBranch: process.env.GIT_BRANCH,
    },
    // loggingReporter: {
    //   require: path.join(ROOT, "plugins/logging-reporter/logging-reporter.js"),
    //   enabled: true,
    //   outputFile: `output/auth0-functionaltests-test-event-logs${outputUniqueId}.json`,
    // },
    testomat: {
      enabled: true,
      require: "@testomatio/reporter/lib/adapter/codecept",
      apiKey: process.env.TESTOMATIO || "fm281e805lbe",
    },
    allure: {
      enabled: true,
      outputDir: path.join(ROOT, "output/allure/allure-results"),
    },
  },
};

module.exports = {
  config,
};
Georgegriff commented 3 years ago

@joshuacoveauth0 this should have been fixed in 3.0.2. https://github.com/codeceptjs/CodeceptJS/blob/3.x/CHANGELOG.md#302

I will close the issue, please reopen if you do'nt believe it is fixed.