-
Notifications
You must be signed in to change notification settings - Fork 4
/
integration-test
executable file
·62 lines (45 loc) · 1.18 KB
/
integration-test
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env bash
set -e
git fetch origin
if [ ! -d "./node_modules" ]; then
npm install
fi
clean() {
git checkout test/fixtures/dummy.js
rm -f eslint-result.xml
}
trap clean EXIT
npm run prepack
git apply test/fixtures/dummy.patch
set +e
./node_modules/.bin/eslint --no-ignore test/fixtures/dummy.js -f checkstyle > eslint-result.xml
has_failed=0
function print_error() {
printf "\e[31m\e[1mError: $1 failed\e[0m\n" 1>&2
has_failed=1
}
function print_success() {
printf "\e[32m\e[1m$1 success\e[0m\n"
}
if cat eslint-result.xml | ./lint-filter.js; then
print_error "stdin test"
elif [[ $(cat eslint-result.xml | ./lint-filter.js | grep -oc "no-console") != "1" ]]; then
print_error "stdin output"
else
print_success "args"
fi
if cat eslint-result.xml | ./lint-filter.js; then
print_error "stdin test"
elif [[ $(cat eslint-result.xml | ./lint-filter.js | grep -oc "semi") != "1" ]]; then
print_error "stdin output"
else
print_success "args"
fi
if ./lint-filter.js eslint-result.xml; then
print_error "file test"
elif [[ $(./lint-filter.js eslint-result.xml | grep -oc "semi") != "1" ]]; then
print_error "args output"
else
print_success "args"
fi
exit $has_failed