CodeceptJS icon indicating copy to clipboard operation
CodeceptJS copied to clipboard

tests configuration as an array not working

Open mathmul opened this issue 2 years ago • 1 comments

What are you trying to achieve?

I want to cherry-pick which tests should run. tests: "./tests/*/*/*.js", works, but I'd like to use

tests: [
    "./tests/*/*.js",
    "./tests/*/*/*.js",
],

Documentation says:

Can either be a pattern to locate tests or an array of patterns to locate tests / test file names.

and offers an example: tests: ['./*_test.js','./sampleTest.js'],

What do you get instead?

A type error:

user@MacBook-Pro-2 Automation % npx codeceptjs run -c ./android.conf.js --steps --verbose
glob pattern string required
TypeError:
    at new Minimatch (/Users/user/app/Automation/node_modules/minimatch/minimatch.js:116:11)
    at setopts (/Users/user/app/Automation/node_modules/glob/common.js:112:20)
    at new GlobSync (/Users/user/app/Automation/node_modules/glob/sync.js:38:3)
    at Function.globSync [as sync] (/Users/user/app/Automation/node_modules/glob/sync.js:24:10)
    at Codecept.loadTests (/Users/user/app/Automation/node_modules/codeceptjs/lib/codecept.js:146:12)
    at Command.module.exports (/Users/user/app/Automation/node_modules/codeceptjs/lib/command/run.js:26:14)

Details

  • CodeceptJS version: 3.0.7
  • NodeJS Version: 14.17.6
  • Operating System: MacOS Monteray 12.3.1
  • Appium/Android
  • Configuration file:
# android.conf.js
require("dotenv").config();
const path = require('path');
const apk = '../build/app/outputs/apk/release/app-release.apk'
exports.config = {
  tests: "./tests/*/*/*.js",
  //tests: ["./tests/*/*/*.js", "./tests/*/*.js"], // TODO: Why is this not working?
  output: './output',
  helpers: {
    Appium: {
      app: path.resolve(apk),
      platform: "Android",
      device: 'Pixel 3a And 12',
      restart: false,
      // fullReset: true,
      desiredCapabilities: {
        platformVersion: "12",
        automationName: "UiAutomator2",
        chromeOptions: {
          w3c: false
        }
      },
    },
    // SMSHelper: {
    //   require: "./helpers/SMSHelper.js",
    //   accountSid: process.env.TWILIO_ACCOUNT_SID,
    //   authToken: process.env.TWILIO_AUTH_TOKEN,
    // },
    AssertWrapper : {
      require: "codeceptjs-assert"
    }
  },
  include: {
    I: './steps_file.js',
    L: './helpers/restoreHelper.js'
  },
  bootstrap: null,
  mocha: {},
  name: 'mobile-automation-codecept',
  plugins: {
    pauseOnFail: {},
    retryFailedStep: {
      enabled: true
    },
    tryTo: {
      enabled: true
    },
    screenshotOnFail: {
      enabled: true
    }
  }
}

mathmul avatar May 25 '22 10:05 mathmul

Hi @mathmul did you happen to try with latest version of codeceptjs?

kobenguyent avatar May 25 '22 12:05 kobenguyent

This issue is stale because it has been open for 90 days with no activity.

github-actions[bot] avatar Dec 13 '23 02:12 github-actions[bot]