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处理静态资源 #45

Open
guapi233 opened this issue Jan 6, 2021 · 0 comments
Open

【实践相关】Jest处理静态资源 #45

guapi233 opened this issue Jan 6, 2021 · 0 comments
Labels

Comments

@guapi233
Copy link
Owner

guapi233 commented Jan 6, 2021

一般像图片、CSS、字体这种静态文件我们是不希望Jest帮我们解析测试的,配置如下:

// jest.config.js  
moduleNameMapper: {
    "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$":
      "<rootDir>/__mocks__/fileMock.js",
    "\\.(css|less)$": "identity-obj-proxy",
},

且需要安装identity-obj-proxy

@guapi233 guapi233 added the 笔记 label Jan 6, 2021
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

1 participant