1language: node_js 2sudo: false 3node_js: 4 - 7 5 6addons: 7 jwt: 8 secure: OYhRpW+8A0Iik+9GmHwa45ZwXeBXw/6zh6I+1w2H9g/LqPRp+Nhq3f4FSpvrrfno8lO8W4h+7s6+JOzF8C8NxNda5UUygKjF9pUphgiQdqls3YZMJlC9zXVl7gQXAHi3nG1s8vWSpwpzYD9fqczE1FX9n0+R63qX3eB6C/LbPeI= 9 10cache: 11 directories: 12 - ~/.npm 13 - ~/.yarn-cache 14 - travis_phantomjs 15 16env: 17 global: 18 - BIN=node ISTANBUL=false OPTION="" 19 - SAUCE_LABS=false SAUCE_USERNAME=lodash 20 21 matrix: 22 - 23 - BIN=phantomjs 24 - ISTANBUL=true 25 - SAUCE_LABS=true 26 27matrix: 28 include: 29 - node_js: 6 30 env: 31 32git: 33 depth: 10 34 35branches: 36 only: 37 - master 38 - 4.17.5 39 40notifications: 41 webhooks: 42 urls: 43 - https://webhooks.gitter.im/e/4aab6358b0e9aed0b628 44 on_success: change 45 on_failure: always 46 47before_install: 48 # Upgrade PhantomJS. 49 - | 50 export PHANTOMJS_VERSION=2.1.1 51 export PATH=$PWD/travis_phantomjs/phantomjs-$PHANTOMJS_VERSION-linux-x86_64/bin:$PATH 52 if [ $(phantomjs --version) != $PHANTOMJS_VERSION ]; then 53 rm -rf $PWD/travis_phantomjs 54 mkdir -p $PWD/travis_phantomjs 55 wget https://github.com/Medium/phantomjs/releases/download/v$PHANTOMJS_VERSION/phantomjs-$PHANTOMJS_VERSION-linux-x86_64.tar.bz2 56 tar -xvf phantomjs-$PHANTOMJS_VERSION-linux-x86_64.tar.bz2 -C $PWD/travis_phantomjs 57 fi 58 phantomjs -v 59 60 # Use exact Node version. 61 - nvm use $TRAVIS_NODE_VERSION 62 63 # Setup package managers. 64 - npm set loglevel error 65 - npm set progress false 66 - npm i -g yarn@0.16.1 67 - yarn -V 68 69 # Remove code skipped on the coverage run. 70 - | 71 PATTERN[0]="|\s*while\s*\([^)]+\)\s*\{\s*iteratee\(index\);\s*\}|" 72 PATTERN[1]="|\bindex,\s*iterable\)\s*===\s*false\)[^}]+?(break;)|" 73 PATTERN[2]="|\bcase\s+(?:dataView|promise|set|map|weakMap)CtorString:.+|g" 74 PATTERN[3]="|\s*if\s*\(cache\.size\b[\s\S]+?\}|" 75 PATTERN[4]="|\s*if\s*\(\!lodashFunc\)\s*\{\s*return;\s*\}|" 76 PATTERN[5]="|\s*define\([\s\S]+?\);|" 77 PATTERN[6]="|\s*root\._\s*=\s*_;|" 78 79 if [ $ISTANBUL = true ]; then 80 set -e 81 for PTRN in ${PATTERN[@]}; do 82 node ./test/remove.js $PTRN ./lodash.js 83 done 84 fi 85 86install: 87 # Install packages. 88 - yarn 89 90 # Use lodash-cli from GitHub. 91 - git clone --depth=10 --branch=master git://github.com/lodash/lodash-cli ./node_modules/lodash-cli 92 - mkdir -p ./node_modules/lodash-cli/node_modules/lodash; cd $_; cp ../../../../lodash.js ./lodash.js; cp ../../../../package.json ./package.json 93 - cd ../../; npm i --production; cd ../../ 94 95script: 96 # Detect code coverage. 97 - | 98 if [ $ISTANBUL = true ]; then 99 istanbul cover -x "**/vendor/**" --report lcovonly ./test/test.js -- ./lodash.js 100 if [ $TRAVIS_SECURE_ENV_VARS = true ]; then 101 cat ./coverage/lcov.info | coveralls 102 cat ./coverage/coverage.json | codecov 103 fi 104 fi 105 106 # Test in Node.js and PhantomJS. 107 - | 108 if [ $ISTANBUL = false ]; then 109 node ./node_modules/lodash-cli/bin/lodash -o ./dist/lodash.js 110 node ./node_modules/lodash-cli/bin/lodash modularize exports=node -o ./ 111 node ./node_modules/lodash-cli/bin/lodash -d -o ./lodash.js 112 if [ $SAUCE_LABS = false ]; then 113 cd ./test 114 $BIN $OPTION ./test.js ../lodash.js 115 if [ $TRAVIS_SECURE_ENV_VARS = true ]; then 116 $BIN $OPTION ./test.js ../dist/lodash.min.js 117 fi 118 fi 119 fi 120 121 # Test in Sauce Labs. 122 - | 123 if [ $SAUCE_LABS = true ]; then 124 node ./node_modules/lodash-cli/bin/lodash core -o ./dist/lodash.core.js 125 npm run build 126 $BIN ./test/saucelabs.js name="lodash tests" runner="test/index.html?build=../dist/lodash.js&noglobals=true" tags=development 127 $BIN ./test/saucelabs.js name="lodash tests" runner="test/index.html?build=../dist/lodash.min.js&noglobals=true" tags=production 128 $BIN ./test/saucelabs.js name="lodash-fp tests" runner="test/fp.html?noglobals=true" tags=development 129 $BIN ./test/saucelabs.js name="underscore tests" runner="test/underscore.html?build=../dist/lodash.js" tags=development,underscore 130 $BIN ./test/saucelabs.js name="underscore tests" runner="test/underscore.html?build=../dist/lodash.min.js" tags=production,underscore 131 $BIN ./test/saucelabs.js name="backbone tests" runner="test/backbone.html?build=../dist/lodash.js" tags=development,backbone 132 $BIN ./test/saucelabs.js name="backbone tests" runner="test/backbone.html?build=../dist/lodash.min.js" tags=production,backbone 133 $BIN ./test/saucelabs.js name="backbone tests" runner="test/backbone.html?build=../dist/lodash.core.js" tags=development,backbone 134 $BIN ./test/saucelabs.js name="backbone tests" runner="test/backbone.html?build=../dist/lodash.core.min.js" tags=production,backbone 135 fi 136