From 20e9399a1c0938c5868d87f03663fa8c5300435f Mon Sep 17 00:00:00 2001 From: Richard Tan Date: Mon, 15 Jun 2020 20:11:07 +1000 Subject: [PATCH 1/2] Add format npm script --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 401e9a1d5..270fb0f21 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "scripts": { "build": "rimraf dist && babel src --ignore \"**/__tests__/**/*\" --out-dir dist && copyfiles -u 1 \"src/**/*.{vm,py,rb}\" dist", "lint": "eslint .", + "format": "eslint . --fix", "list-contributors": "echo 'clone https://github.com/mgechev/github-contributors-list.git first, then run npm install' && cd ../github-contributors-list && node bin/githubcontrib --owner dherault --repo serverless-offline --sortBy contributions --showlogin true --sortOrder desc > contributors.md", "prepare": "npm run build", "prepublishOnly": "npm run lint && npm run build", From c8481269dc006ba6e119da9e1081a107e10cc290 Mon Sep 17 00:00:00 2001 From: Richard Tan Date: Mon, 15 Jun 2020 20:18:15 +1000 Subject: [PATCH 2/2] Update CONTRIBUTING.md --- CONTRIBUTING.md | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 57d466e91..8cde88e46 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -86,9 +86,13 @@ you have several options: # Code Style -We're using Prettier, ESlint and the Airbnb preset. +We're using Prettier, ESlint and the Airbnb preset. To fix errors which are automatically fixable, run: -## Verifying linting style +``` +npm run format +``` + +To run the linter, run: ``` npm run lint @@ -96,11 +100,25 @@ npm run lint # Testing +There are a few test scripts, depending on what type of testing you want to run. + +**Unit tests** + +To run unit tests only: + +``` +npm run test:unit +``` + +**Watch mode** + +To run all tests in watch mode (this skips `npm install`): + ``` -npm test +npm run test:watch ``` -# Test coverage +**Test coverage** ``` npm run test:cov