-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tools?: refactor test-npm into shell script
- Loading branch information
1 parent
b97b96d
commit 7dea3b6
Showing
2 changed files
with
37 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
# always change the working directory to the project's root directory | ||
cd $(dirname $0)/.. | ||
|
||
# pass NODE_EXE from something like Makefile | ||
# it should point to either ./node or ./node.exe, depending on the platform | ||
if ! [ -n "$NODE_EXE" ]; then | ||
echo "No node executable provided. Bailing." >&2 | ||
exit 0 | ||
fi | ||
|
||
rm -rf test-npm | ||
mkdir test-npm | ||
|
||
# make a copy of deps/npm to run the tests on | ||
cp -r deps/npm/ test-npm/ | ||
|
||
cd test-npm | ||
|
||
# do a rm first just in case deps/npm contained these | ||
rm -rf npm-cache npm-tmp npm-prefix | ||
mkdir npm-cache npm-tmp npm-prefix | ||
|
||
# these commands all require the same env variables, so run them as one | ||
npm_config_cache="npm-cache" \ | ||
npm_config_prefix="npm-prefix" \ | ||
npm_config_tmp="npm-tmp" \ | ||
../$NODE_EXE cli.js install --ignore-scripts && \ | ||
../$NODE_EXE cli.js run-script test-all && \ | ||
../$NODE_EXE cli.js prune --prod | ||
|
||
# clean up everything one single shot | ||
cd .. && rm -rf test-npm |