From ac2d4ae8f32071e94fe56e1011fd32569526c344 Mon Sep 17 00:00:00 2001 From: Alexis Svinartchouk Date: Thu, 6 Aug 2020 13:34:43 +0200 Subject: [PATCH] Move linting and testing into package.json Changelog-entry: Move linting and testing into package.json Change-type: patch --- Makefile | 43 ++++--------------------------------------- package.json | 16 ++++++++++++---- 2 files changed, 16 insertions(+), 43 deletions(-) diff --git a/Makefile b/Makefile index fbfc70d6..04f767e4 100644 --- a/Makefile +++ b/Makefile @@ -122,52 +122,20 @@ TARGETS = \ help \ info \ lint \ - lint-ts \ - lint-css \ - lint-spell \ - test-spectron \ - test-gui \ test \ - sanity-checks \ clean \ distclean \ - webpack \ electron-develop \ electron-test \ electron-build -webpack: - npx webpack - .PHONY: $(TARGETS) -lint-ts: - npx balena-lint --fix --typescript typings lib tests scripts/clean-shrinkwrap.ts webpack.config.ts +lint: + npm run lint -lint-css: - npx prettier --write lib/**/*.css - -lint-spell: - codespell \ - --dictionary - \ - --dictionary dictionary.txt \ - --skip *.svg *.gz,*.bz2,*.xz,*.zip,*.img,*.dmg,*.iso,*.rpi-sdcard,*.wic,.DS_Store,*.dtb,*.dtbo,*.dat,*.elf,*.bin,*.foo,xz-without-extension \ - lib tests docs Makefile *.md LICENSE - -lint: lint-ts lint-css lint-spell - -MOCHA_OPTIONS=--recursive --reporter spec --require ts-node/register --require-main "tests/gui/allow-renderer-process-reuse.ts" - -test-spectron: - npx mocha $(MOCHA_OPTIONS) tests/spectron/runner.spec.ts - -test-gui: - npx electron-mocha $(MOCHA_OPTIONS) --full-trace --no-sandbox --renderer tests/gui/**/*.ts - -test-sdk: - npx electron-mocha $(MOCHA_OPTIONS) --full-trace --no-sandbox tests/shared/**/*.ts - -test: test-gui test-sdk test-spectron +test: + npm run test help: @echo "Available targets: $(TARGETS)" @@ -177,9 +145,6 @@ info: @echo "Host arch : $(HOST_ARCH)" @echo "Target arch : $(TARGET_ARCH)" -sanity-checks: - ./scripts/ci/ensure-all-file-extensions-in-gitattributes.sh - clean: rm -rf $(BUILD_DIRECTORY) diff --git a/package.json b/package.json index 62e60249..760ff052 100644 --- a/package.json +++ b/package.json @@ -13,12 +13,20 @@ "url": "git@github.com:balena-io/etcher.git" }, "scripts": { - "test": "make lint test sanity-checks", + "lint-ts": "balena-lint --fix --typescript typings lib tests scripts/clean-shrinkwrap.ts webpack.config.ts", + "lint-css": "prettier --write lib/**/*.css", + "lint-spell": "codespell --dictionary - --dictionary dictionary.txt --skip *.ttf *.svg *.gz,*.bz2,*.xz,*.zip,*.img,*.dmg,*.iso,*.rpi-sdcard,*.wic,.DS_Store,*.dtb,*.dtbo,*.dat,*.elf,*.bin,*.foo,xz-without-extension lib tests docs Makefile *.md LICENSE", + "lint": "npm run lint-ts && npm run lint-css && npm run lint-spell", + "test-spectron": "mocha --recursive --reporter spec --require ts-node/register --require-main tests/gui/allow-renderer-process-reuse.ts tests/spectron/runner.spec.ts", + "test-gui": "electron-mocha --recursive --reporter spec --require ts-node/register --require-main tests/gui/allow-renderer-process-reuse.ts --full-trace --no-sandbox --renderer tests/gui/**/*.ts", + "test-shared": "electron-mocha --recursive --reporter spec --require ts-node/register --require-main tests/gui/allow-renderer-process-reuse.ts --full-trace --no-sandbox tests/shared/**/*.ts", + "test": "npm run lint && npm run test-gui && npm run test-shared && npm run test-spectron && npm run sanity-checks", + "sanity-checks": "./scripts/ci/ensure-all-file-extensions-in-gitattributes.sh", "start": "./node_modules/.bin/electron .", "postshrinkwrap": "ts-node ./scripts/clean-shrinkwrap.ts", "webpack": "webpack", "watch": "webpack --watch", - "concourse-build-electron": "make webpack", + "concourse-build-electron": "npm run webpack", "concourse-test": "npx npm@6.14.5 test", "concourse-test-electron": "npx npm@6.14.5 test" }, @@ -29,10 +37,10 @@ }, "lint-staged": { "./**/*.{ts,tsx}": [ - "make lint-ts" + "npm run lint-ts" ], "./**/*.css": [ - "make lint-css" + "npm run lint-css" ] }, "author": "Balena Inc. ",