Skip to content

Commit 67761e8

Browse files
committed
Add testing for eslint and stylelint
1 parent 44fff3e commit 67761e8

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

commands/web/eslint

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88
## ProjectTypes: drupal8,drupal9,drupal10
99
## ExecRaw: true
1010

11-
if not yarn --cwd $DDEV_DOCROOT/core eslint --config .eslintrc.legacy.json >/dev/null; then
11+
if yarn --cwd $DDEV_DOCROOT/core eslint --version >/dev/null ; then
12+
yarn --cwd $DDEV_DOCROOT/core --config .eslintrc.legacy.json eslint ../modules/custom/**/*.js "$@"
13+
else
1214
echo "eslint is not available. You may need to 'ddev yarn --cwd $DDEV_DOCROOT/core install'"
1315
exit 1
1416
fi
15-
yarn --cwd $DDEV_DOCROOT/core --config .eslintrc.legacy.json eslint ../modules/custom/**/*.js "$@"
17+

commands/web/stylelint

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
## ProjectTypes: drupal8,drupal9,drupal10
99
## ExecRaw: true
1010

11-
if yarn --cwd $DDEV_DOCROOT/core stylelint --config ./.stylelintrc.json ../modules/custom/**/*.css >/dev/null ; then
12-
yarn --cwd $DDEV_DOCROOT/core --formatter verbose --config ./.stylelintrc.json ../modules/custom/**/*.css --color "$@"
11+
if yarn --cwd $DDEV_DOCROOT/core stylelint --version >/dev/null ; then
12+
yarn --color --cwd $DDEV_DOCROOT/core --config ./.stylelintrc.json ../modules/custom/**/*.css "$@"
1313
else
1414
echo "stylelint is not available. You may need to 'ddev yarn --cwd $DDEV_DOCROOT/core install'"
1515
exit 1

tests/test.bats

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,8 @@ teardown() {
3030
ddev phpcs --version
3131
ls -al web/modules/custom/${PROJNAME}/tests
3232
ddev phpunit --version
33+
ddev yarn --cwd web/core install
34+
ddev exec touch web/core/.env
35+
ddev stylelint --version
36+
ddev eslint --version
3337
}

0 commit comments

Comments
 (0)