Add automatic formatting tests
This commit is contained in:
Родитель
eaf42c6a8f
Коммит
b21c40b571
|
@ -30,6 +30,7 @@ before_script:
|
|||
- ./lighthouse-core/scripts/download-chrome.sh
|
||||
- yarn build-all
|
||||
script:
|
||||
- yarn test-formatting
|
||||
- yarn lint
|
||||
- yarn unit
|
||||
- yarn closure
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
"build": "tsc",
|
||||
"dev": "tsc -w",
|
||||
"test": "mocha --reporter dot test/**/*-test.js",
|
||||
"test-formatting": "./test/check-formatting.sh",
|
||||
"format": "clang-format -i -style=file *.ts **/*.ts"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
check_formatting ()
|
||||
{
|
||||
diff -u <(cat $1) <(./node_modules/.bin/clang-format -style=file $1) &>/dev/null
|
||||
if [ $? -eq 1 ]
|
||||
then
|
||||
echo "Error: formatting is required for *.ts files:"
|
||||
echo " cd lighthouse-cli"
|
||||
echo " yarn format"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
check_formatting "*.ts"
|
||||
check_formatting "**/*.ts"
|
|
@ -25,11 +25,12 @@
|
|||
"coverage": "node $(yarn bin)/istanbul cover -x \"**/third_party/**\" _mocha -- $(find */test -name '*-test.js') --timeout 10000 --reporter progress",
|
||||
"coveralls": "yarn coverage && cat ./coverage/lcov.info | coveralls",
|
||||
"start": "gulp && node ./lighthouse-cli/index.js",
|
||||
"test": "yarn lint --silent && gulp && yarn unit && yarn closure",
|
||||
"test": "yarn lint --silent && gulp && yarn unit && yarn closure && yarn test-formatting",
|
||||
"unit-core": "bash lighthouse-core/scripts/run-mocha.sh --core",
|
||||
"unit-cli": "bash lighthouse-core/scripts/run-mocha.sh --cli",
|
||||
"unit-viewer": "bash lighthouse-core/scripts/run-mocha.sh --viewer",
|
||||
"unit": "bash lighthouse-core/scripts/run-mocha.sh --default",
|
||||
"test-formatting": "cd lighthouse-cli && ./test/check-formatting.sh && cd ..",
|
||||
"core-unit": "yarn unit-core",
|
||||
"cli-unit": "yarn unit-cli",
|
||||
"viewer-unit": "yarn unit-viewer",
|
||||
|
|
Загрузка…
Ссылка в новой задаче