From 7eee56f06119c9588b1e3566667cf7ab885ca68a Mon Sep 17 00:00:00 2001 From: Lufty Wiranda Date: Thu, 18 Jan 2018 02:12:58 +0700 Subject: [PATCH] refactor(scripts): combine `lint` and `test` scripts (#64) --- .travis.yml | 1 - app/templates/_package.json | 3 +-- app/templates/_travis.yml | 3 +-- package.json | 3 +-- test.js | 2 +- 5 files changed, 4 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index bc9dd0f..9c21dfd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,6 @@ node_js: - '8' - '6' script: - - npm run lint - node node_modules/.bin/prettier -l "*.{js,json,md}" - npm test after_success: diff --git a/app/templates/_package.json b/app/templates/_package.json index a6f4bed..4f37e63 100644 --- a/app/templates/_package.json +++ b/app/templates/_package.json @@ -16,9 +16,8 @@ "precommit": "remove-lockfiles<% if (prettier) { %> && xo --fix && lint-staged<% } %>",<% if (esnext) { %> "prebuild": "rimraf dist", "build": "babel src --out-dir dist --copy-files --ignore *.test.js",<% } %> - "lint": "xo", "test:watch": "jest --watch", - "test": "jest<% if (coverage) { %> --coverage<% } %>" + "test": "xo && jest<% if (coverage) { %> --coverage<% } %>" },<% if (esnext) { %> "main": "dist/index.js",<% } %> "files": [ diff --git a/app/templates/_travis.yml b/app/templates/_travis.yml index ccc830d..2548c45 100644 --- a/app/templates/_travis.yml +++ b/app/templates/_travis.yml @@ -4,8 +4,7 @@ notifications: node_js: - '8' - '6' -script: - - npm run lint<% if (prettier) { %> +script:<% if (prettier) { %> - node node_modules/.bin/prettier -l "*.{js,json,md}"<% } %> - npm test<% if (esnext) { %> - npm run build<% } %><% if (coverage) { %> diff --git a/package.json b/package.json index 1c78d98..eeeb657 100644 --- a/package.json +++ b/package.json @@ -14,10 +14,9 @@ "node": ">=6" }, "scripts": { - "lint": "xo", "precommit": "remove-lockfiles && xo --fix && lint-staged", "test:watch": "jest --watch", - "test": "jest --coverage" + "test": "xo && jest --coverage" }, "files": [ "app" diff --git a/test.js b/test.js index 512bcde..0ec46c0 100644 --- a/test.js +++ b/test.js @@ -141,7 +141,7 @@ describe('prompts', () => { .then(() => { assert.jsonFileContent('package.json', { scripts: { - test: 'jest --coverage', + test: 'xo && jest --coverage', }, });