File tree Expand file tree Collapse file tree
packages/google-cloud-resourcemanager/samples Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,14 +16,21 @@ programmatically manage these container resources.
1616* [ Setup] ( #setup )
1717* [ Samples] ( #samples )
1818 * [ Projects] ( #projects )
19+ * [ Running the tests] ( #running-the-tests )
1920
2021## Setup
2122
22- 1 . Read [ Prerequisites] [ prereq ] and [ How to run a sample] [ run ] first.
23- 1 . Install dependencies:
23+ 1 . Read [ Prerequisites] [ prereq ] and [ How to run a sample] [ run ] first.
24+ 1 . Install dependencies:
25+
26+ With ` npm ` :
2427
2528 npm install
2629
30+ With ` yarn ` :
31+
32+ yarn install
33+
2734[ prereq ] : ../README.md#prerequisities
2835[ run ] : ../README.md#how-to-run-a-sample
2936
@@ -37,16 +44,31 @@ __Usage:__ `node projects --help`
3744
3845```
3946Commands:
40- list List all projects the authenticated user has access to .
47+ list List all current projects .
4148
4249Options:
43- --help Show help [boolean]
50+ --help Show help [boolean]
4451
4552Examples:
46- node projects list List projects.
53+ node projects.js list Lists all current projects.
4754
48- For more information, see https://cloud.google.com/resource-manager/docs/
55+ For more information, see https://cloud.google.com/resource-manager/docs
4956```
5057
5158[ projects_docs ] : https://cloud.google.com/resource-manager/docs/
5259[ projects_code ] : projects.js
60+
61+ ## Running the tests
62+
63+ 1 . Set the ` GCLOUD_PROJECT ` and ` GOOGLE_APPLICATION_CREDENTIALS ` environment
64+ variables.
65+
66+ 1 . Run the tests:
67+
68+ With ` npm ` :
69+
70+ npm test
71+
72+ With ` yarn ` :
73+
74+ yarn test
Original file line number Diff line number Diff line change 22 "name" : " nodejs-docs-samples-resource-manager" ,
33 "version" : " 0.0.1" ,
44 "private" : true ,
5- "license" : " Apache Version 2.0" ,
5+ "license" : " Apache- 2.0" ,
66 "author" : " Google Inc." ,
7- "scripts" : {
8- "test" : " cd ..; npm run st -- --verbose resource/system-test/*.test.js"
7+ "repository" : {
8+ "type" : " git" ,
9+ "url" : " https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git"
910 },
10- "dependencies " : {
11- "@google-cloud/resource " : " 0.6.0 " ,
12- "yargs " : " 6.6.0 "
11+ "cloud " : {
12+ "requiresKeyFile " : true ,
13+ "requiresProjectId " : true
1314 },
1415 "engines" : {
1516 "node" : " >=4.3.2"
17+ },
18+ "scripts" : {
19+ "lint" : " samples lint" ,
20+ "pretest" : " npm run lint" ,
21+ "system-test" : " ava -T 20s --verbose system-test/*.test.js" ,
22+ "test" : " npm run system-test"
23+ },
24+ "dependencies" : {
25+ "@google-cloud/resource" : " 0.7.1" ,
26+ "yargs" : " 7.1.0"
27+ },
28+ "devDependencies" : {
29+ "@google-cloud/nodejs-repo-tools" : " 1.3.1" ,
30+ "ava" : " 0.19.1" ,
31+ "proxyquire" : " 1.7.11" ,
32+ "sinon" : " 2.1.0"
1633 }
1734}
Original file line number Diff line number Diff line change 11/**
2- * Copyright 2016 , Google, Inc.
2+ * Copyright 2017 , Google, Inc.
33 * Licensed under the Apache License, Version 2.0 (the "License");
44 * you may not use this file except in compliance with the License.
55 * You may obtain a copy of the License at
@@ -34,5 +34,8 @@ resourceClient.getProjects()
3434
3535 console . log ( 'Projects:' ) ;
3636 projects . forEach ( ( project ) => console . log ( project . id ) ) ;
37+ } )
38+ . catch ( ( err ) => {
39+ console . error ( 'ERROR:' , err ) ;
3740 } ) ;
3841// [END resource_quickstart]
You can’t perform that action at this time.
0 commit comments