Move linting and testing into package.json

Changelog-entry: Move linting and testing into package.json
Change-type: patch
This commit is contained in:
Alexis Svinartchouk 2020-08-06 13:34:43 +02:00
parent a3322e9fd7
commit ac2d4ae8f3
2 changed files with 16 additions and 43 deletions

View File

@ -122,52 +122,20 @@ TARGETS = \
help \ help \
info \ info \
lint \ lint \
lint-ts \
lint-css \
lint-spell \
test-spectron \
test-gui \
test \ test \
sanity-checks \
clean \ clean \
distclean \ distclean \
webpack \
electron-develop \ electron-develop \
electron-test \ electron-test \
electron-build electron-build
webpack:
npx webpack
.PHONY: $(TARGETS) .PHONY: $(TARGETS)
lint-ts: lint:
npx balena-lint --fix --typescript typings lib tests scripts/clean-shrinkwrap.ts webpack.config.ts npm run lint
lint-css: test:
npx prettier --write lib/**/*.css npm run test
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
help: help:
@echo "Available targets: $(TARGETS)" @echo "Available targets: $(TARGETS)"
@ -177,9 +145,6 @@ info:
@echo "Host arch : $(HOST_ARCH)" @echo "Host arch : $(HOST_ARCH)"
@echo "Target arch : $(TARGET_ARCH)" @echo "Target arch : $(TARGET_ARCH)"
sanity-checks:
./scripts/ci/ensure-all-file-extensions-in-gitattributes.sh
clean: clean:
rm -rf $(BUILD_DIRECTORY) rm -rf $(BUILD_DIRECTORY)

View File

@ -13,12 +13,20 @@
"url": "git@github.com:balena-io/etcher.git" "url": "git@github.com:balena-io/etcher.git"
}, },
"scripts": { "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 .", "start": "./node_modules/.bin/electron .",
"postshrinkwrap": "ts-node ./scripts/clean-shrinkwrap.ts", "postshrinkwrap": "ts-node ./scripts/clean-shrinkwrap.ts",
"webpack": "webpack", "webpack": "webpack",
"watch": "webpack --watch", "watch": "webpack --watch",
"concourse-build-electron": "make webpack", "concourse-build-electron": "npm run webpack",
"concourse-test": "npx npm@6.14.5 test", "concourse-test": "npx npm@6.14.5 test",
"concourse-test-electron": "npx npm@6.14.5 test" "concourse-test-electron": "npx npm@6.14.5 test"
}, },
@ -29,10 +37,10 @@
}, },
"lint-staged": { "lint-staged": {
"./**/*.{ts,tsx}": [ "./**/*.{ts,tsx}": [
"make lint-ts" "npm run lint-ts"
], ],
"./**/*.css": [ "./**/*.css": [
"make lint-css" "npm run lint-css"
] ]
}, },
"author": "Balena Inc. <hello@etcher.io>", "author": "Balena Inc. <hello@etcher.io>",