node: rename from io.js to node
[platform/upstream/nodejs.git] / tools / test-npm.sh
1 #!/bin/bash
2
3 set -e
4
5 # always change the working directory to the project's root directory
6 cd $(dirname $0)/..
7
8 # pass a $NODE environment variable from something like Makefile
9 # it should point to either ./node or ./node.exe, depending on the platform
10 if [ -z $NODE ]; then
11   echo "No node executable provided. Bailing." >&2
12   exit 0
13 fi
14
15 rm -rf test-npm
16
17 # make a copy of deps/npm to run the tests on
18 cp -r deps/npm test-npm
19
20 cd test-npm
21
22 # do a rm first just in case deps/npm contained these
23 rm -rf npm-cache npm-tmp npm-prefix
24 mkdir npm-cache npm-tmp npm-prefix
25
26 # set some npm env varibles to point to our new temporary folders
27 export npm_config_cache="npm-cache"
28 export npm_config_prefix="npm-prefix"
29 export npm_config_tmp="npm-tmp"
30
31 # install npm devDependencies and run npm's tests
32
33 ../$NODE cli.js install --ignore-scripts
34 ../$NODE cli.js run-script test-legacy
35 ../$NODE cli.js run-script test
36
37 # clean up everything one single shot
38 cd .. && rm -rf test-npm