From 62720777aeddbb62d834636b2524c48f1b2ff1a3 Mon Sep 17 00:00:00 2001 From: Jason Dobry Date: Mon, 24 Apr 2017 14:40:11 -0700 Subject: [PATCH] Cleanup App Engine samples and re-work tests. (#354) --- .../google-cloud-compute/samples/README.md | 26 ++++++++++++-- .../google-cloud-compute/samples/package.json | 35 ++++++++++++++----- 2 files changed, 51 insertions(+), 10 deletions(-) diff --git a/packages/google-cloud-compute/samples/README.md b/packages/google-cloud-compute/samples/README.md index a93ea1b3d2d..3328f78d1ee 100644 --- a/packages/google-cloud-compute/samples/README.md +++ b/packages/google-cloud-compute/samples/README.md @@ -15,14 +15,21 @@ Google infrastructure. * [Sending mail with Mailjet](#sending-mail-with-mailjet) * [Listing instances (recommended)](#listing-instances-recommended) * [Listing instances](#listing-instances) +* [Running the tests](#running-the-tests) ## Setup -1. Read [Prerequisites][prereq] and [How to run a sample][run] first. -1. Install dependencies: +1. Read [Prerequisites][prereq] and [How to run a sample][run] first. +1. Install dependencies: + + With `npm`: npm install + With `yarn`: + + yarn install + [prereq]: ../README.md#prerequisities [run]: ../README.md#how-to-run-a-sample @@ -91,3 +98,18 @@ __Run the sample:__ [vms_api_docs]: https://cloud.google.com/compute/docs/tutorials/nodejs-guide [vms_api_code]: vms_api.js + +## Running the tests + +1. Set the `GCLOUD_PROJECT` and `GOOGLE_APPLICATION_CREDENTIALS` environment + variables. + +1. Run the tests: + + With `npm`: + + npm test + + With `yarn`: + + yarn test diff --git a/packages/google-cloud-compute/samples/package.json b/packages/google-cloud-compute/samples/package.json index cd93a0fcb59..f9d10888535 100644 --- a/packages/google-cloud-compute/samples/package.json +++ b/packages/google-cloud-compute/samples/package.json @@ -2,17 +2,36 @@ "name": "nodejs-docs-samples-computeengine", "version": "0.0.1", "private": true, - "license": "Apache Version 2.0", + "license": "Apache-2.0", "author": "Google Inc.", + "repository": { + "type": "git", + "url": "https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git" + }, + "cloud": { + "requiresKeyFile": true, + "requiresProjectId": true + }, + "engines": { + "node": ">=4.3.2" + }, "scripts": { - "test": "cd ..; npm run t -- computeengine/test/*.test.js", - "system-test": "cd ..; npm run t -- computeengine/system-test/*.test.js" + "lint": "samples lint", + "pretest": "npm run lint", + "unit-test": "ava -T 20s --verbose test/*.test.js", + "system-test": "ava -T 20s --verbose system-test/*.test.js", + "test": "npm run unit-test && npm run system-test" }, "dependencies": { - "@google-cloud/compute": "0.6.0", - "googleapis": "18.0.0", - "nodemailer": "2.7.0", - "nodemailer-smtp-transport": "2.7.2", - "sendgrid": "4.7.1" + "@google-cloud/compute": "0.7.1", + "googleapis": "19.0.0", + "nodemailer": "4.0.1", + "nodemailer-smtp-transport": "2.7.4", + "sendgrid": "5.0.0" + }, + "devDependencies": { + "@google-cloud/nodejs-repo-tools": "1.3.1", + "ava": "0.19.1", + "proxyquire": "1.7.11" } }