diff --git a/packages/google-cloud-language/samples/README.md b/packages/google-cloud-language/samples/README.md index 78a9983f6f4..86860a53c82 100644 --- a/packages/google-cloud-language/samples/README.md +++ b/packages/google-cloud-language/samples/README.md @@ -15,14 +15,21 @@ Learning API. * [Samples](#samples) * [Analyze](#analyze) * [Slackbot](#slackbot) +* [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 @@ -67,3 +74,18 @@ The example in the [slackbot](./slackbot) subdirectory shows a Slack bot built u It runs on a Google Container Engine (Kubernetes) cluster, and uses one of the Google Cloud Platform's ML APIs, the Natural Language (NL) API, to interact in a Slack channel. See its [README](./slackbot/README.md) for more information. + +## 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-language/samples/package.json b/packages/google-cloud-language/samples/package.json index fcabdb4d2eb..34c789e34f9 100644 --- a/packages/google-cloud-language/samples/package.json +++ b/packages/google-cloud-language/samples/package.json @@ -2,17 +2,34 @@ "name": "nodejs-docs-samples-language", "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 st -- --verbose language/system-test/*.test.js" + "lint": "samples lint \"*.js\" \"system-test/*.js\" \"slackbot/*.js\" \"slackbot/system-test/*.js\"", + "pretest": "npm run lint", + "system-test": "ava -T 20s --verbose system-test/*.test.js", + "test": "npm run system-test" }, "dependencies": { "@google-cloud/language": "0.10.3", "@google-cloud/storage": "1.1.0", "yargs": "7.1.0" }, - "engines": { - "node": ">=4.3.2" + "devDependencies": { + "@google-cloud/nodejs-repo-tools": "1.3.1", + "ava": "0.19.1", + "proxyquire": "1.7.11", + "sinon": "2.1.0" } } diff --git a/packages/google-cloud-language/samples/quickstart.js b/packages/google-cloud-language/samples/quickstart.js index e3b9ed78eee..cadb7c4d3db 100644 --- a/packages/google-cloud-language/samples/quickstart.js +++ b/packages/google-cloud-language/samples/quickstart.js @@ -1,5 +1,5 @@ /** - * Copyright 2016, Google, Inc. + * Copyright 2017, Google, Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at