Skip to content

Commit

Permalink
Fix Windows Kokoro builds (#1365)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkwlui authored and JustinBeckwith committed Sep 27, 2018
1 parent e9e8c69 commit e6211f3
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 14 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -56,7 +56,7 @@
"prepare": "npm run compile",
"test": "nyc mocha build/test",
"docs": "echo no docs 👻",
"system-test": "echo no system tests 👻",
"system-test": "mocha build/system-test",
"samples-test": "cd samples && npm link ../ && pwd && npm test",
"lint": "gts check && eslint 'samples/**/*.js'",
"compile": "tsc -v && tsc -p . && copyfiles src/apis/**/README.md src/apis/**/package.json build",
Expand Down
5 changes: 3 additions & 2 deletions samples/drive/download.js
Expand Up @@ -19,6 +19,7 @@ const fs = require('fs');
const os = require('os');
const uuid = require('uuid');
const path = require('path');
const readline = require('readline');

const drive = google.drive({
version: 'v3',
Expand Down Expand Up @@ -46,8 +47,8 @@ async function runSample(fileId) {
})
.on('data', d => {
progress += d.length;
process.stdout.clearLine();
process.stdout.cursorTo(0);
readline.clearLine();
readline.cursorTo(0);
process.stdout.write(`Downloaded ${progress} bytes`);
})
.pipe(dest);
Expand Down
8 changes: 5 additions & 3 deletions samples/drive/upload.js
Expand Up @@ -13,8 +13,10 @@

'use strict';

const {google} = require('googleapis');
const fs = require('fs');
const readline = require('readline');

const {google} = require('googleapis');
const sampleClient = require('../sampleclient');

const drive = google.drive({
Expand All @@ -38,8 +40,8 @@ async function runSample(fileName) {
// number of bytes uploaded to this point.
onUploadProgress: evt => {
const progress = (evt.bytesRead / fileSize) * 100;
process.stdout.clearLine();
process.stdout.cursorTo(0);
readline.clearLine();
readline.cursorTo(0);
process.stdout.write(`${Math.round(progress)}% complete`);
},
}
Expand Down
8 changes: 5 additions & 3 deletions samples/youtube/upload.js
Expand Up @@ -17,9 +17,11 @@
* Usage: node upload.js PATH_TO_VIDEO_FILE
*/

const fs = require('fs');
const readline = require('readline');

const {google} = require('googleapis');
const sampleClient = require('../sampleclient');
const fs = require('fs');

// initialize the Youtube API library
const youtube = google.youtube({
Expand Down Expand Up @@ -52,8 +54,8 @@ async function runSample(fileName) {
// number of bytes uploaded to this point.
onUploadProgress: evt => {
const progress = (evt.bytesRead / fileSize) * 100;
process.stdout.clearLine();
process.stdout.cursorTo(0);
readline.clearLine();
readline.cursorTo(0);
process.stdout.write(`${Math.round(progress)}% complete`);
},
}
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions test/test.media.ts
Expand Up @@ -37,7 +37,7 @@ async function testMultpart(drive: drive_v2.Drive) {
res.request.headers['content-type'].indexOf('multipart/related;'), 0);
const boundary =
res.request.headers['content-type'].replace(boundaryPrefix, '');
expectedResp = expectedResp.replace(/\n/g, '\r\n')
expectedResp = expectedResp.replace(/\r?\n/g, '\r\n')
.replace(/\$boundary/g, boundary)
.replace('$media', media.body)
.replace('$resource', JSON.stringify(requestBody))
Expand All @@ -61,7 +61,7 @@ async function testMediaBody(drive: drive_v2.Drive) {
res.request.headers['content-type'].indexOf('multipart/related;'), 0);
const boundary =
res.request.headers['content-type'].replace(boundaryPrefix, '');
expectedResp = expectedResp.replace(/\n/g, '\r\n')
expectedResp = expectedResp.replace(/\r?\n/g, '\r\n')
.replace(/\$boundary/g, boundary)
.replace('$media', media.body)
.replace('$resource', JSON.stringify(requestBody))
Expand Down Expand Up @@ -309,7 +309,7 @@ describe('Media', () => {
{userId: 'me', requestBody, media});
const boundary =
res.request.headers['content-type'].replace(boundaryPrefix, '');
expectedBody = expectedBody.replace(/\n/g, '\r\n')
expectedBody = expectedBody.replace(/\r?\n/g, '\r\n')
.replace(/\$boundary/g, boundary)
.replace('$media', bodyString)
.replace('$resource', JSON.stringify(requestBody))
Expand All @@ -332,7 +332,7 @@ describe('Media', () => {
{userId: 'me', requestBody, media});
const boundary2 =
res2.request.headers['content-type'].replace(boundaryPrefix, '');
expectedBody = expectedBody.replace(/\n/g, '\r\n')
expectedBody = expectedBody.replace(/\r?\n/g, '\r\n')
.replace(/\$boundary/g, boundary2)
.replace('$media', bodyString)
.replace('$resource', JSON.stringify(requestBody))
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Expand Up @@ -8,7 +8,8 @@
"src/*.ts",
"src/**/*.ts",
"test/*.ts",
"test/**/*.ts"
"test/**/*.ts",
"system-test/**/*.ts"
],
"exclude": [
"node_modules",
Expand Down

0 comments on commit e6211f3

Please sign in to comment.