Skip to content

Commit

Permalink
mro: integration tests setup
Browse files Browse the repository at this point in the history
  • Loading branch information
BenoitZugmeyer committed May 13, 2019
1 parent 080627d commit 877080b
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 7 deletions.
27 changes: 20 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
language: node_js
node_js:
- 6
- 8
- 10

matrix:
include:
- node_js: 6
env: ESLINT_VERSION=latest
- node_js: 8
env: ESLINT_VERSION=latest
- node_js: 10
env: ESLINT_VERSION=latest
- node_js: 12
env: ESLINT_VERSION=latest RUN_LINT=true RUN_INTEGRATION=true
- node_js: 12
env: ESLINT_VERSION=4.7 RUN_INTEGRATION=true
- node_js: 12
env: ESLINT_VERSION=6.0.0-alpha.1 RUN_INTEGRATION=true

script:
- if node --version | grep -q v10; then npm run lint; fi
- npm install eslint@4.7 && npm test
- if ! node --version | grep -q v4; then npm install eslint@latest && npm test; fi
- if [[ $RUN_LINT = true ]]; then npm run lint; fi
- if [[ $RUN_INTEGRATION = true ]]; then ./tools/integration-tests.bash; fi
- npm install eslint@$ESLINT_VERSION
- npm test
43 changes: 43 additions & 0 deletions tools/integration-tests.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash

set -euo pipefail

ROOT=$(mktemp -d)

function finish {
rm -rf "$ROOT"
}

trap finish EXIT

REPO_PATH=$(pwd)
ESLINT_VERSION=${ESLINT_VERSION:-latest}

set -x
cd $ROOT
npm init -y
npm install --save-dev eslint@$ESLINT_VERSION
ln -s $REPO_PATH node_modules/eslint-plugin-html

cat << EOF > index.html
<script>
console.log(1)
</script>
EOF

cat << EOF > .eslintrc.js
module.exports = {
plugins: ["html"],
rules: {
"no-console": "error",
},
}
EOF

cat << EOF | diff -u <(npx eslint --format compact index.html 2>&1) -
$(pwd)/index.html: line 2, col 1, Error - Unexpected console statement. (no-console)
1 problem
EOF

echo "All passed"
File renamed without changes.

0 comments on commit 877080b

Please sign in to comment.