简体   繁体   中英

Jest methods not available in .spec.js files

I started a simple project with npm init, then added jest via

npm install jest

How do I make methods like describe() , test() , etc., available in.spec.js and.test.js files?

The jest methods will be available when you run jest .

Probably your ESLint configuration is not configured for jest and shows that these globals are missing, you can configure them in the eslint configuration :

"env": {
    "jest/globals": true
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM