forked from taskcluster/taskcluster
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpackage_test.sh
More file actions
27 lines (22 loc) · 763 Bytes
/
package_test.sh
File metadata and controls
27 lines (22 loc) · 763 Bytes
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
#! /bin/sh
set -e -x
# test that the package can be installed without other dependencies in the monorepo,
# by installing it in a temporary directory and checking that it can be require()d
# and call an API method
tmpdir=$(mktemp -d)
trap "cd /; rm -rf $tmpdir" EXIT
yarn pack --filename $tmpdir/client.tgz
cd $tmpdir
yarn add ./client.tgz
node <<'EOF'
const taskcluster = require('taskcluster-client');
const main = async () => {
if (process.env.TASKCLUSTER_ROOT_URL) {
const auth = new taskcluster.Auth(taskcluster.fromEnvVars());
console.log(await auth.ping());
} else {
console.log('No TASKCLUSTER_ROOT_URL; not trying to call an API method');
}
};
main().then(console.log('Test OK!'), err => console.error(err));
EOF