nodejs-docs-samples icon indicating copy to clipboard operation
nodejs-docs-samples copied to clipboard

CONTRIBUTING.md: instructions for running a single sample don't work

Open Shnatsel opened this issue 3 years ago • 0 comments

Following the steps in https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/main/CONTRIBUTING.md#run-the-tests-for-a-single-sample results in the following error:

$ cd datastore/
$ npm test

> test
> echo 'Please run tests in each sample directory.' && exit 1

Please run tests in each sample directory.
npm ERR! code 1
npm ERR! path /home/sdavydov/Code/nodejs-docs-samples
npm ERR! command failed
npm ERR! command sh -c echo 'Please run tests in each sample directory.' && exit 1

Running tests in batch/ results in a different error:

npm test

> test
> c8 mocha --timeout 600000 test/*.js



  Create, list and delete jobs
    1) "before all" hook for "create a job with a script payload"


  0 passing (14s)
  1 failing

  1) Create, list and delete jobs
       "before all" hook for "create a job with a script payload":
     Error: Unable to detect a Project Id in the current environment. 
To learn more about authentication and Google APIs, visit: 
https://cloud.google.com/docs/authentication/getting-started
      at GoogleAuth.findAndCacheProjectId (node_modules/google-auth-library/build/src/auth/googleauth.js:123:19)
      at processTicksAndRejections (internal/process/task_queues.js:97:5)
      at async Context.<anonymous> (test/basics.js:38:17)

Whatever is going on with the datastore/ dir seems special/undocumented; it should not be in the CONTRIBUTING.md example.

Also, an additional step of setting a project ID is apparently needed; the way to do so is not apparent from the documentation or error messages.

Shnatsel avatar Dec 06 '22 16:12 Shnatsel