Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

docs(samples): add quickstart code for ExportAssets #50

Merged
merged 12 commits into from
Nov 20, 2018
Merged

docs(samples): add quickstart code for ExportAssets #50

merged 12 commits into from
Nov 20, 2018

Conversation

peter-zheng-g
Copy link
Contributor

@peter-zheng-g peter-zheng-g commented Nov 15, 2018

Fixes #<issue_number_goes_here> (it's a good idea to open an issue first for discussion)

  • Tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Nov 15, 2018
package.json Outdated Show resolved Hide resolved
samples/package.json Outdated Show resolved Hide resolved
samples/package.json Outdated Show resolved Hide resolved
samples/package.json Outdated Show resolved Hide resolved
samples/package.json Outdated Show resolved Hide resolved
samples/quickstart.js Outdated Show resolved Hide resolved
samples/quickstart.js Show resolved Hide resolved
samples/quickstart.js Outdated Show resolved Hide resolved
samples/package.json Outdated Show resolved Hide resolved
samples/quickstart.js Outdated Show resolved Hide resolved
samples/system-test/quickstart.test.js Outdated Show resolved Hide resolved
samples/system-test/quickstart.test.js Outdated Show resolved Hide resolved
samples/system-test/quickstart.test.js Outdated Show resolved Hide resolved
samples/system-test/quickstart.test.js Outdated Show resolved Hide resolved
samples/system-test/quickstart.test.js Outdated Show resolved Hide resolved
samples/system-test/quickstart.test.js Outdated Show resolved Hide resolved
samples/system-test/quickstart.test.js Outdated Show resolved Hide resolved
@peter-zheng-g
Copy link
Contributor Author

While the code can pass test with ava, it always timeout when testing with mocha.

@JustinBeckwith JustinBeckwith added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Nov 19, 2018
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Nov 19, 2018
@peter-zheng-g
Copy link
Contributor Author

Thanks for your review.

  1. There're lint errors. Do you know which package I need to install to run lint locally?
  2. Can you please help enable the API for test project(s)? Error message:
    Cloud Asset API has not been used in project 1046198160504 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/cloudasset.googleapis.com/overview?project=1046198160504

@JustinBeckwith
Copy link
Contributor

Sure! To lint, you can just run npm run fix from the cwd. I am guessing you need to add something like this to the .eslintrc.yml in the samples/system-test directory:

---
env:
  mocha: true

See this as an example:
https://github.com/googleapis/nodejs-pubsub/blob/master/samples/system-test/.eslintrc.yml

@JustinBeckwith
Copy link
Contributor

Also, I enabled the API 👍

@peter-zheng-g
Copy link
Contributor Author

I still can't fun lint locally, it complains about missing script:
$ npm run fix
npm ERR! missing script: fix

npm ERR! A complete log of this run can be found in:
npm ERR! /usr/local/google/home/peterzh/.npm/_logs/2018-11-19T23_04_38_650Z-debug.log

@peter-zheng-g
Copy link
Contributor Author

OK, added fix at top level package.json (locally) and now I can run "npm run fix". Thanks.

@JustinBeckwith
Copy link
Contributor

Goodness, apologies. For now you could run npx eslint --fix '**/*.js'

@JustinBeckwith JustinBeckwith changed the title [Asset] Add quickstart code for ExportAssets docs(samples): add quickstart code for ExportAssets Nov 19, 2018
@JustinBeckwith JustinBeckwith added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Nov 19, 2018
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Nov 19, 2018
@peter-zheng-g
Copy link
Contributor Author

peter-zheng-g commented Nov 19, 2018

Now both test and lint pass on my local machine. Thanks!

@JustinBeckwith JustinBeckwith added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Nov 20, 2018
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Nov 20, 2018
@codecov-io
Copy link

Codecov Report

Merging #50 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #50   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           1      1           
  Lines           4      4           
=====================================
  Hits            4      4

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 883543b...03bf4fc. Read the comment docs.


const assert = require('assert');
const path = require('path');
const test = require('mocha');

This comment was marked as spam.

const bucketName = `asset-nodejs-${uuid.v4()}`;
const bucket = storage.bucket(bucketName);

test.describe('quickstart sample tests', () => {

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@JustinBeckwith JustinBeckwith merged commit 91bcc0a into googleapis:master Nov 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants