Skip to content

Commit d40d706

Browse files
Merge pull request #325 from MikeRalphson/patch-1
[WIP] Run prism for tests
2 parents 8f9004a + 8350776 commit d40d706

File tree

4 files changed

+321
-226
lines changed

4 files changed

+321
-226
lines changed

.travis.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
language: node_js
22
node_js:
3+
- "0.11"
4+
- "0.12"
35
- "iojs"
46
- "4"
57
- "6"
8+
- "7"
69
before_install:
710
- npm install -g npm@2
11+
before_script:
12+
- mkdir prism
13+
- mkdir prism/bin
14+
- export PATH=$PATH:$PWD/prism/bin/
15+
- ./test/prism.sh
816
script:
917
- npm test
1018
- npm run test:typescript

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"mocha-sinon": "^1.1.5",
3838
"sinon": "^1.17.5",
3939
"sinon-chai": "^2.8.0",
40+
"system-sleep": "^1.0.0-g",
4041
"typescript": "^2.0.0"
4142
},
4243
"scripts": {

test/prism.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/bash
2+
3+
install () {
4+
5+
set -eu
6+
7+
UNAME=$(uname)
8+
ARCH=$(uname -m)
9+
if [ "$UNAME" != "Linux" ] && [ "$UNAME" != "Darwin" ] && [ "$ARCH" != "x86_64" ] && [ "$ARCH" != "i686" ]; then
10+
echo "Sorry, OS/Architecture not supported: ${UNAME}/${ARCH}. Download binary from https://github.com/stoplightio/prism/releases"
11+
exit 1
12+
fi
13+
14+
if [ "$UNAME" = "Darwin" ] ; then
15+
OSX_ARCH=$(uname -m)
16+
if [ "${OSX_ARCH}" = "x86_64" ] ; then
17+
PLATFORM="darwin_amd64"
18+
fi
19+
elif [ "$UNAME" = "Linux" ] ; then
20+
LINUX_ARCH=$(uname -m)
21+
if [ "${LINUX_ARCH}" = "i686" ] ; then
22+
PLATFORM="linux_386"
23+
elif [ "${LINUX_ARCH}" = "x86_64" ] ; then
24+
PLATFORM="linux_amd64"
25+
fi
26+
fi
27+
28+
#LATEST=$(curl -s https://api.github.com/repos/stoplightio/prism/tags | grep -Eo '"name":.*?[^\\]",' | head -n 1 | sed 's/[," ]//g' | cut -d ':' -f 2)
29+
LATEST="v0.1.5"
30+
URL="https://github.com/stoplightio/prism/releases/download/$LATEST/prism_$PLATFORM"
31+
DEST=./prism/bin/prism
32+
33+
if [ -z $LATEST ] ; then
34+
echo "Error requesting. Download binary from ${URL}"
35+
exit 1
36+
else
37+
curl -L $URL -o $DEST
38+
chmod +x $DEST
39+
fi
40+
}
41+
42+
install

0 commit comments

Comments
 (0)