In a node script (or outside, direct in the command) I want to add an custom argument as a flag to trigger different behaviour. By adding this argument it would be taken, if there is no argument the same evaluation code (in the backround) take a default value. This argument hand over works, validated by debugging, also with colleagues! This flag concerns a different behavior before all tests are running (execution in bootstrap). Afterwards all tag matching tests should be executed. In some cases it wouldn't executed (no error messages).
package.json
"scripts": {
"test1a": "npx codeceptjs run --grep '@debug' --plugins allure flagToDoSomething=true",
"test1b": "npx codeceptjs run --grep '@debug' --plugins allure src/setup/file.ts flagToDoSomething=true",
"test1c": "npx codeceptjs run --grep '@debug' --plugins allure --flagToDoSomething=true",
"test2": "npx codeceptjs run --grep '@debug' --plugins allure",
"test2a": "npx codeceptjs run --grep '@debug' --plugins allure flagToDoSomething=bla"
},
In general: The hand over of the argument is NOT the problem. The bootstrap works according to the hand over!
Expectation: With a valid command + argument the following would be executed:
- bootstrap behaviour;
- test execution;
Current execution shows:
- "npm run test2" -> bootstrap + tests (Result: "OK | 1 passed");
- "npm run test2a" -> bootstrap (Result: "OK | 0 passed") (uses the same DEFAULT in the background as "test2");
- "npm run test1a"/"npm run test1b" ->
bootstrap (Result: "OK | 0 passed"); - "npm run test1c" ->
error: unknown option `--flagToDoSomething';
So we isolated the problem and all indicates that only the existence of this argument at the command triggers this unexpected behaviour. It's not the code after that, because it uses in all cases the same.
Has anybody a clue?