diff options
author | Luke Bennett <lbennett@gitlab.com> | 2019-05-31 17:33:35 +0100 |
---|---|---|
committer | Luke Bennett <lbennett@gitlab.com> | 2019-05-31 20:58:53 +0100 |
commit | 0eb72d5c7dc260b6b4aa006ba3d3787fb03d41d5 (patch) | |
tree | 99c4eb146d8079b94eca5d5ae41a09e39f55833b | |
parent | 12aff0b73cacf533533d584d68307b1b6a030cee (diff) | |
download | gitlab-ce-lint-jest-not-karma-added-specs.tar.gz |
Add linter to report new Karma specslint-jest-not-karma-added-specs
Prefer Jest specs instead.
-rwxr-xr-x | scripts/frontend/lint-new-fe-karma-specs.sh | 15 | ||||
-rwxr-xr-x | scripts/static-analysis | 3 | ||||
-rw-r--r-- | spec/javascripts/new_test_failure_spec.js | 3 |
3 files changed, 20 insertions, 1 deletions
diff --git a/scripts/frontend/lint-new-fe-karma-specs.sh b/scripts/frontend/lint-new-fe-karma-specs.sh new file mode 100755 index 00000000000..74c860231b8 --- /dev/null +++ b/scripts/frontend/lint-new-fe-karma-specs.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +git remote -v + +NEW_KARMA_SPECS_COUNT=`git diff --name-only origin/master --diff-filter A | grep spec/javascripts | wc -l | tr -d '[:space:]'` + +echo "=> Found $NEW_KARMA_SPECS_COUNT new karma spec(s)." + +if [ $NEW_KARMA_SPECS_COUNT -gt 0 ]; then + echo "✖ ERROR: Please use Jest (spec/frontend) for new specs instead of Karma-Jasmine (spec/javascripts)." + exit 1 +fi + +echo "✔︎ No new Karma specs found. Thank you!" +exit 0 diff --git a/scripts/static-analysis b/scripts/static-analysis index 642c50ec0a8..42e01a91327 100755 --- a/scripts/static-analysis +++ b/scripts/static-analysis @@ -33,7 +33,8 @@ tasks = [ %w[yarn run prettier-all], %w[bundle exec rubocop --parallel], %w[scripts/lint-conflicts.sh], - %w[scripts/lint-rugged] + %w[scripts/lint-rugged], + %w[scripts/frontend/lint-new-fe-karma-specs.sh] ] static_analysis = Gitlab::Popen::Runner.new diff --git a/spec/javascripts/new_test_failure_spec.js b/spec/javascripts/new_test_failure_spec.js new file mode 100644 index 00000000000..bc3fffd730c --- /dev/null +++ b/spec/javascripts/new_test_failure_spec.js @@ -0,0 +1,3 @@ +export default { + test: 'test', +}; |