Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added JS Jasmine tests to Travis CI #9013

Merged
merged 18 commits into from
Mar 31, 2017
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,31 @@ env:
global:
- COMPOSER_BIN_DIR=~/bin
- INTEGRATION_SETS=3
- NODE_JS_VERSION=6
matrix:
- TEST_SUITE=unit
- TEST_SUITE=integration INTEGRATION_INDEX=1
- TEST_SUITE=integration INTEGRATION_INDEX=2
- TEST_SUITE=integration INTEGRATION_INDEX=3
- TEST_SUITE=static
- TEST_SUITE=js
cache:
apt: true
directories: $HOME/.composer/cache
directories:
- $HOME/.composer/cache
- $HOME/.nvm
- $HOME/node_modules
- $HOME/yarn.lock
matrix:
exclude:
- php: 5.6.29
env: TEST_SUITE=static
- php: 5.6.29
env: TEST_SUITE=js
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
- phpunit -c dev/tests/$TEST_SUITE $TEST_FILTER
- if [ $TEST_SUITE != "js" ]; then phpunit -c dev/tests/$TEST_SUITE $TEST_FILTER; fi
- if [ $TEST_SUITE == "js" ]; then grunt spec; fi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at https://travis-ci.org/magento/magento2/jobs/215020317 - is there some less verbose mode? Display only failed tests maybe...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea, for now I just focuses on make this test running, then we can think about some adjustments / improvements.

PS. I really hate Grunt, so if I don't have to modify this, I will be more than happy to leave it as it is 😉

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I didn't use it as well, and didn't google for a solution just in case you know the answer.

It can wait until it become a problem "output is too big" some day (hopefully never).

21 changes: 21 additions & 0 deletions dev/travis/before_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,25 @@ case $TEST_SUITE in

cd ../../..
;;
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
bash -c "nvm install $NODE_JS_VERSION" || true
bash -c "nvm use $NODE_JS_VERSION" || true
node --version

cp package.json.sample package.json
cp Gruntfile.js.sample Gruntfile.js
npm install -g yarn
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it really viable to install yarn just to install grunt-cli?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not only grunt-cli, all dependencies defined in package.json are downloaded using yarn in line 90 (yarn is replacement for npm install).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for clarification.

yarn global add grunt-cli
yarn

echo "Installing Magento"
mysql -uroot -e 'CREATE DATABASE magento2;'
php bin/magento setup:install -q --admin-user="admin" --admin-password="123123q" --admin-email="[email protected]" --admin-firstname="John" --admin-lastname="Doe"

echo "Deploying Static Content"
php bin/magento setup:static-content:deploy -f -q -j=2 --no-css --no-less --no-images --no-fonts --no-misc --no-html-minify
;;
esac
6 changes: 1 addition & 5 deletions package.json.sample
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"name": "Magento2",
"name": "magento2",
"author": "Magento Commerce Inc.",
"description": "Magento2 node modules dependencies for local development",
"version": "2.0.0",
"license": "(OSL-3.0 OR AFL-3.0)",
"repository": {
"type": "git",
Expand Down Expand Up @@ -38,8 +37,5 @@
"time-grunt": "^1.0.0",
"underscore": "^1.7.0",
"squirejs": "0.2.1"
},
"engines": {
"node": ">=0.10.0"
}
}