Skip to content

Commit

Permalink
MAGETWO-69132: JS Static tests added to CI (ESLint + JSCS) #9093
Browse files Browse the repository at this point in the history
  • Loading branch information
ishakhsuvarov authored May 16, 2017
2 parents ec906e4 + f2ca481 commit b458233
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 64 deletions.
5 changes: 1 addition & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,4 @@ cache:
before_install: ./dev/travis/before_install.sh
install: composer install --no-interaction --prefer-dist
before_script: ./dev/travis/before_script.sh
script:
- test $TEST_SUITE = "static" && TEST_FILTER='--filter "Magento\\Test\\Php\\LiveCodeTest"' || true
- if [ $TEST_SUITE != "js" ]; then phpunit -c dev/tests/$TEST_SUITE $TEST_FILTER; fi
- if [ $TEST_SUITE == "js" ]; then grunt spec; fi
script: ./dev/travis/script.sh
27 changes: 0 additions & 27 deletions dev/tools/grunt/configs/eslint.js

This file was deleted.

18 changes: 18 additions & 0 deletions dev/tools/grunt/configs/eslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"file": {
"options": {
"configFile": "dev/tests/static/testsuite/Magento/Test/Js/_files/eslint/.eslintrc",
"reset": true,
"useEslintrc": false
}
},
"test": {
"options": {
"configFile": "dev/tests/static/testsuite/Magento/Test/Js/_files/eslint/.eslintrc",
"reset": true,
"outputFile": "dev/tests/static/eslint-error-report.xml",
"format": "junit",
"quiet": true
}
}
}
23 changes: 0 additions & 23 deletions dev/tools/grunt/configs/jscs.js

This file was deleted.

16 changes: 16 additions & 0 deletions dev/tools/grunt/configs/jscs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"file": {
"options": {
"config": "dev/tests/static/testsuite/Magento/Test/Js/_files/jscs/.jscsrc"
},
"src": ""
},
"test": {
"options": {
"config": "dev/tests/static/testsuite/Magento/Test/Js/_files/jscs/.jscsrc",
"reporterOutput": "dev/tests/static/jscs-error-report.xml",
"reporter": "junit"
},
"src": ""
}
}
2 changes: 1 addition & 1 deletion dev/tools/grunt/tasks/static.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = function (grunt) {
};

grunt.registerTask('static', function (target) {
var currentTarget = target || 'test',
var currentTarget = target || 'file',
file = grunt.option('file'),
tasks = [
'continue:on',
Expand Down
14 changes: 14 additions & 0 deletions dev/travis/before_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,17 @@ phpenv rehash;

# If env var is present, configure support for 3rd party builds which include private dependencies
test -n "$GITHUB_TOKEN" && composer config github-oauth.github.com "$GITHUB_TOKEN" || true

# Node.js setup via NVM
if [ $TEST_SUITE = "static" ] || [ test $TEST_SUITE == "js" ]; then
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm

nvm install $NODE_JS_VERSION
nvm use $NODE_JS_VERSION
node --version

npm install -g yarn
yarn global add grunt-cli
fi
13 changes: 4 additions & 9 deletions dev/travis/before_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,14 @@ case $TEST_SUITE in
cat "$changed_files_ce" | sed 's/^/ + including /'

cd ../../..

cp package.json.sample package.json
cp Gruntfile.js.sample Gruntfile.js
yarn
;;
js)
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
nvm install $NODE_JS_VERSION
nvm use $NODE_JS_VERSION
node --version

cp package.json.sample package.json
cp Gruntfile.js.sample Gruntfile.js
npm install -g yarn
yarn global add grunt-cli
yarn

echo "Installing Magento"
Expand Down
15 changes: 15 additions & 0 deletions dev/travis/script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

# Copyright © Magento, Inc. All rights reserved.
# See COPYING.txt for license details.

case $TEST_SUITE in
static)
TEST_FILTER='--filter "Magento\\Test\\Php\\LiveCodeTest"' || true
phpunit -c dev/tests/$TEST_SUITE $TEST_FILTER
grunt static
;;
js)
grunt spec
;;
esac

0 comments on commit b458233

Please sign in to comment.