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

docs(samples): updated samples code to use async/await and tests to use mocha #241

Merged
merged 6 commits into from
Nov 18, 2018

Conversation

vijay-qlogic
Copy link
Contributor

Fixes googleapis/google-cloud-node/issues/2869 (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 Oct 24, 2018
@JustinBeckwith JustinBeckwith added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 24, 2018
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 24, 2018
@codecov
Copy link

codecov bot commented Oct 25, 2018

Codecov Report

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

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #241   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           2      2           
  Lines          83     83           
=====================================
  Hits           83     83

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 718116d...1d76f10. Read the comment docs.

.catch(err => {
console.error('ERROR:', err);
});
const [{faceAnnotations: faces}] = await client.faceDetection(fileName);

This comment was marked as spam.

This comment was marked as spam.

});
pngStream.on('error', console.log);
pngStream.on('end', () => {
return;

This comment was marked as spam.

});
}
// [END vision_face_detection_tutorial_process_response]

// Run the example
// [START vision_face_detection_tutorial_run_application]
function main(inputFile, outputFile, Canvas, callback) {
async function main(inputFile, outputFile, Canvas, callback) {

This comment was marked as spam.

.catch(err => {
console.error('ERROR:', err);
});
(async () => {

This comment was marked as spam.

const index = new Index();
index.lookup(words, function(err, hits) {
try {

This comment was marked as spam.

@vijay-qlogic
Copy link
Contributor Author

@JustinBeckwith 'll add fix for samples/faceDetection.js shortly. I may need to change tests as well here.

function main(inputDir, callback) {
const index = new Index();
function main(inputDir) {
return new Promise((resolve, reject) => {

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@JustinBeckwith JustinBeckwith added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 28, 2018
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 28, 2018
@JustinBeckwith JustinBeckwith added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 28, 2018
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 28, 2018
@JustinBeckwith
Copy link
Contributor

@vijay-qlogic as soon as the samples-tests are passing we can merge this :)

@vijay-qlogic vijay-qlogic changed the title docs(samples): updated samples code to use async await docs(samples): updated samples code to use async/await and tests to use mocha Oct 29, 2018
@JustinBeckwith
Copy link
Contributor

Just a reminder/ping to address the failing sample tests

@vijay-qlogic
Copy link
Contributor Author

Yes, I'm looking into it.. Facing some challenges to resolve the issues here.

@JustinBeckwith
Copy link
Contributor

Anything I can do to help? Can you run the sample tests locally on your own?

@vijay-qlogic
Copy link
Contributor Author

With ava, tests run successfully, but asks for redis-server with mocha...
And when I start redis server-locally, it works form me

@JustinBeckwith JustinBeckwith added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Nov 2, 2018
@kokoro-team kokoro-team removed kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Nov 2, 2018
@JustinBeckwith JustinBeckwith added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Nov 5, 2018
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Nov 5, 2018
@JustinBeckwith JustinBeckwith added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Nov 6, 2018
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Nov 6, 2018
@vijay-qlogic vijay-qlogic force-pushed the asyncify-samples branch 2 times, most recently from f9f67ca to be0e660 Compare November 8, 2018 17:47
@JustinBeckwith JustinBeckwith added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Nov 12, 2018
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Nov 12, 2018
@sduskis sduskis added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Nov 16, 2018
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Nov 16, 2018
@JustinBeckwith JustinBeckwith added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Nov 16, 2018
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Nov 16, 2018
@JustinBeckwith
Copy link
Contributor

It looks like the sample tests are still failing:

 1) quickstart
       should detect labels in a remote file:
     Uncaught Error: ENOENT: no such file or directory, open '/tmpfs/src/github/nodejs-vision/vision/out.png'
(node:127) UnhandledPromiseRejectionWarning: TypeError: Cannot set property 'state' of undefined
    at /tmpfs/src/github/nodejs-vision/samples/node_modules/mocha/lib/runner.js:602:20
    at done (/tmpfs/src/github/nodejs-vision/samples/node_modules/mocha/lib/runnable.js:319:5)
    at /tmpfs/src/github/nodejs-vision/samples/node_modules/mocha/lib/runnable.js:377:11
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
(node:127) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:127) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Finished!
npm ERR! Test failed.  See above for more details.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @google-cloud/[email protected] samples-test: `cd samples/ && npm link ../ && npm test && cd ../`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @google-cloud/[email protected] samples-test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     /home/node/.npm/_logs/2018-11-16T23_30_40_897Z-debug.log
+ cleanup
+ chmod +x /tmpfs/src/gfile/trampoline_cleanup.sh
+ /tmpfs/src/gfile/trampoline_cleanup.sh
+ echo cleanup
cleanup

@JustinBeckwith JustinBeckwith added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Nov 17, 2018
@JustinBeckwith JustinBeckwith added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Nov 18, 2018
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Nov 18, 2018
@JustinBeckwith JustinBeckwith merged commit af55904 into googleapis:master Nov 18, 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. do not merge Indicates a pull request not ready for merge, due to either quality or timing.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants