/jestTest

Primary LanguageJavaScriptMIT LicenseMIT

jestTest

Steps to get everything working:

  • npm init -y to setup a new project
  • npm i --save-dev jest babel-jest @babel/preset-env to install all required packages
  • Create jest.config.js with the content shown below
  • Create babel.config.jsonwith the content shown below

With this setup, we can create JavaScript files and test them in separate test files. To run the tests, use npm run test

jest.config.js

module.exports = {
    verbose: true,
    transform: {
        "^.+\\.jsx?$": "babel-jest"
    }
};

babel.config.json

{
  "presets": ["@babel/preset-env"]
}