npm init -ynpm install --save-dev jest- Add to
package.jsonto call Jest
"scripts": {
"test": "jest"
}npm add --dev babel-jest
Jest will treat any file that ends in
.test.jsor.spec.jsas a test file. So, if you have a file calleddivide.js, you can put adivide.test.jsnext to it in the same directory and Jest will pick it up when it runs.
echo > capitalize.js && echo > capitalize.test.jsnpm run test- Optional:
echo node_modules/ >> .gitignore