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

jest配置错误 #22

Closed
chenyulun opened this issue Oct 8, 2021 · 1 comment
Closed

jest配置错误 #22

chenyulun opened this issue Oct 8, 2021 · 1 comment

Comments

@chenyulun
Copy link

➜  react-ui-library-tutorial git:(master) yarn jest                  
yarn run v1.22.15
$ /Users/chenyulun390/github/react-ui-library-tutorial/node_modules/.bin/jest
No tests found, exiting with code 1
Run with `--passWithNoTests` to exit with code 0
No files found in /Users/myusername/github/react-ui-library-tutorial.
Make sure Jest's configuration does not exclude this directory.
To set up Jest, make sure a package.json file exists.
Jest Documentation: facebook.github.io/jest/docs/configuration.html

jest.config.js根目录下面没有components目录

module.exports = {
  verbose: true,
-   roots: ['<rootDir>/components'],
+  roots: ['<rootDir>/components', '<rootDir>/src'],
  moduleNameMapper: {
    '\\.(css|less|scss)$': 'identity-obj-proxy',
    '^components$': '<rootDir>/components/index.tsx',
    '^components(.*)$': '<rootDir>/components/$1',
  },
  testRegex: '(/test/.*|\\.(test|spec))\\.(ts|tsx|js)$',
  moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
  testPathIgnorePatterns: ['/node_modules/', '/lib/', '/esm/', '/dist/'],
  preset: 'ts-jest',
  testEnvironment: 'jsdom',
};
@worldzhao
Copy link
Owner

之前把文档站点换成 dumi,源文件的文件夹名称也改了,这里漏掉了,感谢指出,我抽空改一下

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants