Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--grep is case insensitive in the mode "dry-run" whereas case sensitive in the mode "run" #4222

Open
mirao opened this issue Feb 27, 2024 · 5 comments
Labels

Comments

@mirao
Copy link
Contributor

mirao commented Feb 27, 2024

What are you trying to achieve?

I would expect that "run" and "dry-run" modes have the same behavior related to case-sensitivity of tags.
Personally I prefer case-insensitive tags so that I don't want to think if I need to pass the tag @problem or @Problem
https://codecept.io/advanced/#tags doesn't say anything about case sensitivity.

What do you get instead?

run is "case sensitive" when using --grep

$ codeceptjs run --grep @Problem
CodeceptJS v3.5.14 #StandWithUkraine
Using test root "/home/mirao/workspace/tmp"


  OK  | 0 passed   // 0ms

dry-run is "case insensitive" when using --grep

$ codeceptjs dry-run --grep @Problem
Tests from /home/mirao/workspace/tmp:

My @problem -- /home/mirao/workspace/tmp/My_test.ts -- 1 tests
  ☐ test something

  Total: 1 suites | 1 tests  

--- DRY MODE: No tests were executed ---

Provide test source code if related

Feature('My').tag("@problem");

Scenario('test something',  ({ I }) => {
    I.amOnPage('https://www.google.com');
});

Details

  • CodeceptJS version: 3.5.14
  • NodeJS Version: v18.19.1
  • Operating System: Ubuntu 22.04
  • Configuration file:
import { setHeadlessWhen, setCommonPlugins } from '@codeceptjs/configure';
// turn on headless mode when running with HEADLESS=true environment variable
// export HEADLESS=true && npx codeceptjs run
setHeadlessWhen(process.env.HEADLESS);

// enable all common plugins https://github.com/codeceptjs/configure#setcommonplugins
setCommonPlugins();

export const config: CodeceptJS.MainConfig = {
  tests: './*_test.ts',
  output: './output',
  helpers: {
    Playwright: {
      browser: 'chromium',
      url: 'http://localhost',
      show: true
    }
  },
  include: {
    I: './steps_file'
  },
  name: 'tmp'
}
@kobenguyent
Copy link
Collaborator

➜  codeceptjs-rest-demo git:(master) ✗ npx codeceptjs dry-run               
Tests from /Users/t/Desktop/projects/codeceptjs-rest-demo:

DELETE tests -- /Users/t/Desktop/projects/codeceptjs-rest-demo/src/DELETE_test.ts -- 1 tests
  ☐ Verify deleting a user
GET tests -- /Users/t/Desktop/projects/codeceptjs-rest-demo/src/GET_test.ts -- 4 tests
  ☐ Verify a successful call @Jaja
  ☐ Verify a not found call
  ☐ Verify getting a single user @jaja
  ☐ Verify getting list of users @jaja
POST tests -- /Users/t/Desktop/projects/codeceptjs-rest-demo/src/POST_test.ts -- 2 tests
  ☐ Verify creating new user
  ☐ Verify uploading a file
PUT tests -- /Users/t/Desktop/projects/codeceptjs-rest-demo/src/PUT_test.ts -- 1 tests
  ☐ Verify creating new user

  Total: 4 suites | 8 tests  

--- DRY MODE: No tests were executed ---
➜  codeceptjs-rest-demo git:(master) ✗ npx codeceptjs dry-run --grep "@jaja"
Tests from /Users/t/Desktop/projects/codeceptjs-rest-demo:


  Total: 0 suites | 0 tests  

--- DRY MODE: No tests were executed ---
➜  codeceptjs-rest-demo git:(master) ✗ npx codeceptjs dry-run --grep "@Jaja"
Tests from /Users/t/Desktop/projects/codeceptjs-rest-demo:


  Total: 0 suites | 0 tests  

--- DRY MODE: No tests were executed ---

When I'm passing the grep pattern, it doesn't return me anything.

@mirao
Copy link
Contributor Author

mirao commented Feb 28, 2024

I think --grep in the dry-run mode works only for tags at Feature().
Is it your case?

@kobenguyent
Copy link
Collaborator

Oh, really? I thought it is applicable to all. 😅

@mirao
Copy link
Contributor Author

mirao commented Mar 1, 2024

It looks like --grep in the run mode is handled by mocha (RegExp) whereas --grep in the dry-run is handled by CodeceptJS itself.

Copy link

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

@github-actions github-actions bot added the stale label May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants