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

'No tests found' when directory has a '-' #1567

Closed
faisalil opened this issue Sep 1, 2016 · 9 comments
Closed

'No tests found' when directory has a '-' #1567

faisalil opened this issue Sep 1, 2016 · 9 comments

Comments

@faisalil
Copy link

faisalil commented Sep 1, 2016

I am using [email protected], when my directory that include my git repo has a '-', I see the following behavior:

No tests found
74 files checked.
testPathDirs: <DIRECTORY_PATH> - 0 matches
testRegex: /tests/.*.(ts|tsx|js)$ - 1 match
testPathIgnorePatterns: \node_modules\ - 74 matches

if I rename the repo directory not to have a dash, this will work fine and I can see a test. I am assuming this not an expected behavior.

@cpojer
Copy link
Member

cpojer commented Sep 1, 2016

Can you post your configuration?

@faisalil
Copy link
Author

faisalil commented Sep 1, 2016

"jest": {
"scriptPreprocessor": "./preprocessor.js",
"moduleFileExtensions": [
"ts",
"tsx",
"js"
],
"testRegex": "/tests/.*.(ts|tsx|js)$",
"verbose": true,
"collectCoverage": true
}

@audetpascale
Copy link

Duplicate: 1568 1551

@Pomax
Copy link

Pomax commented Sep 1, 2016

for people finding this issue, would it be possible to close the duplicates, noting which issue they are a duplicate of, so that only the issue where actual work towards fixing it happens stays open?

@faisalil faisalil closed this as completed Sep 1, 2016
@NullVoxPopuli
Copy link

NullVoxPopuli commented Jun 8, 2018

This isn't resolved. :-\

my config:

const {defaults} = require('jest-config');

const wd = process.cwd().replace(/\//g, '\\/');

console.log(wd);

module.exports = {
  // moduleDirectories: ["node_modules", ".", "src", "tests"],
  moduleFileExtensions: [...defaults.moduleFileExtensions, 'ts', 'tsx'],

  projects: [
    {
      displayName: 'End to End',

      preset: "jest-puppeteer",

      globalSetup: "<rootDir>/tests/support/acceptance/setup.js",
      globalTeardown: "<rootDir>/tests/support/acceptance/teardown.js",
      testEnvironment: "<rootDir>/tests/support/acceptance/puppeteer-environment.js",

      testRegex: `${wd}/(.+)\\.e2e\\.ts`,
    },
    {
      displayName: 'Unit and Integration',

      setupTestFrameworkScriptFile: '<rootDir>/tests/support/setup.js',

      testRegex: "(.+)test\\.ts"
    }
  ],
  transform: {
   "^.+\\.(t|j)sx?$": "ts-jest"
  },
  globals: {
    "ts-jest": {
      tsConfigFile: "tsconfig.jest.json"
    }
  },
}

output

$ yarn test --verbose
yarn run v1.6.0
$ ./node_modules/.bin/jest --config ./jest.config.js --no-cache --verbose
\/home\/me\/Development\/NullVoxPopuli\/react-vs-ember\/testing\/react
No tests found
In /home/me/Development/NullVoxPopuli/react-vs-ember/testing/react
  182 files checked.
  testMatch:  - 182 matches
  testPathIgnorePatterns: /node_modules/ - 182 matches
  testRegex: \/home\/me\/Development\/NullVoxPopuli\/react-vs-ember\/testing\/react/(.+)\.e2e\.ts - 0 matches
In /home/me/Development/NullVoxPopuli/react-vs-ember/testing/react
  182 files checked.
  testMatch:  - 182 matches
  testPathIgnorePatterns: /node_modules/ - 182 matches
  testRegex: (.+)test\.ts - 0 matches
Pattern:  - 0 matches
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

@Pomax
Copy link

Pomax commented Jun 8, 2018

given that all three issues are closed, you probably want to file that as a new issue.

@NullVoxPopuli
Copy link

I'm actually giving up on jest. Mocha "just worked" (by following the docs). :-\

@Pomax
Copy link

Pomax commented Jun 8, 2018

That's entirely your call, but I'd still recommend filing your issue as a new issue so that devs are notified of it, and people who aren't you (but also run into this problem) may eventually get the fix they need still anyway.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants