Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # HOW TO CREATE A WEB PROJECT
- ## BABEL + JEST
- Guide working at Mac OS with npm 6.4.1.
- #### Installation
- ```shell
- npm init -y
- ```
- Install JEST.
- ```shell
- npm init -y
- npm install --save-dev jest
- npx jest --init
- ```
- Install Babel.
- ```shell
- npm install --save-dev @babel/core @babel/cli @babel/preset-env
- npm install --save @babel/polyfill
- npm install --save-dev babel-jest
- ```
- **IMPORTANT**
- if u have problems with babel/core version...Do this and be happy. π
- ```shell
- npx babel-upgrade --write --install
- ```
- #### Configuration
- In your `package.json` file make the following changes:
- ```json
- {
- "scripts": {
- "test": "jest --watch"
- },
- "jest": {
- "transform": {
- "^.+\\.jsx?$": "babel-jest"
- }
- }
- }
- ```
- Creating a config file named `.babelrc` in the root of your project with this content:
- ```shell
- {
- "presets": ["@babel/preset-env"]
- }
- ```
- Create the following structure:
- - Node_modules
- - src
- - index.js
- - test
- - index.test.js
- - .babelrc
- - .gitignore
- - Jest.config.js
- - Package-lock.json
- - Package.json
- NOW YOU CAN DANCE
- πΊπΊπΊπΊπΊπΊπΊπΊ
Add Comment
Please, Sign In to add comment