From 37a42e721f8748cde5c1b064f4a1cfa5cec0a873 Mon Sep 17 00:00:00 2001 From: Danny Coates Date: Wed, 8 Apr 2020 15:58:16 -0700 Subject: [PATCH] chore(tests): made root level "npm test" more functional --- _scripts/test-package.sh | 26 ++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100755 _scripts/test-package.sh diff --git a/_scripts/test-package.sh b/_scripts/test-package.sh new file mode 100755 index 0000000000..7620bf1037 --- /dev/null +++ b/_scripts/test-package.sh @@ -0,0 +1,26 @@ +#!/bin/bash -e +PACKAGE=$1 +help=" +Usage: npm test [all|*] + +examples: + +npm test fxa-shared +npm test fxa-auth-db-mysql fxa-auth-server +npm test all +" + +scopes="" +for scope in "$@" +do + scopes="$scopes --scope $scope" +done + +if [[ -z "$PACKAGE" ]]; then + >&2 echo "$help" + exit 1 +elif [[ "$PACKAGE" == "all" ]]; then + lerna run test --stream --no-prefix --loglevel success --concurrency 1 --ignore fxa-amplitude-send +else + echo "$scopes" | xargs lerna run test --stream --no-prefix --loglevel success --concurrency 1 +fi diff --git a/package.json b/package.json index 83d91ffb09..c3c4edc91e 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "firefox": "./packages/fxa-dev-launcher/bin/fxa-dev-launcher", "start-firefox": "npm run firefox", "adb-reverse": "./_scripts/adb-reverse.sh", - "test": "lerna run test", + "test": "_scripts/test-package.sh", "config-fxios": "node _scripts/config-fxios.js", "format": "lerna run format" },