Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion core/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
],
"scripts": {
"docs": "jsdoc -c .jsdoc.js",
"test": "node ../../bin/run-test.cjs --proxyquire-shim build/test",
"test": "node ../../bin/run-test.cjs build/test",
"prepare": "npm run compile",
"pretest": "npm run compile",
"compile": "tsc -p .",
Expand Down Expand Up @@ -57,6 +57,7 @@
"@types/tmp": "^0.2.6",
"c8": "^10.1.3",
"codecov": "^3.8.3",
"google-test-utils": "^0.4.0",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit (non-blocking): Now that all 'proxyquire' imports in core/common, handwritten/bigquery, handwritten/datastore, and handwritten/google-cloud-dns have been migrated to 'google-test-utils', the unused "proxyquire" and "@types/proxyquire" entries in devDependencies across these four package.json files can be removed (either here or in a follow-up cleanup PR).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. I'll follow-up on this in b/579954082.

"gts": "^6.0.2",
"jsdoc": "^4.0.4",
"jsdoc-fresh": "^6.1.0",
Expand Down
3 changes: 2 additions & 1 deletion core/common/test/service-object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
import * as assert from 'assert';
import {describe, it, beforeEach, afterEach} from 'mocha';
import * as extend from 'extend';
import * as proxyquire from 'proxyquire';
import {proxyquire} from 'google-test-utils';
// eslint-disable-next-line import/namespace
import * as r from 'teeny-request';
import * as sinon from 'sinon';

Expand Down Expand Up @@ -298,7 +299,7 @@
);
assert.strictEqual((reqOpts as DecorateRequestOptions).uri, '');
done();
(callback as any)(null, null, {} as r.Response);

Check warning on line 302 in core/common/test/service-object.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
});
serviceObject.delete(assert.ifError);
});
Expand All @@ -313,7 +314,7 @@
options,
);
done();
(callback as any)(null, null, {} as r.Response);

Check warning on line 317 in core/common/test/service-object.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
});
serviceObject.delete(options, assert.ifError);
});
Expand Down Expand Up @@ -344,7 +345,7 @@
'PATCH',
);
done();
(callback as any)(null, null, null!);

Check warning on line 348 in core/common/test/service-object.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
});

const serviceObject = new ServiceObject(CONFIG) as FakeServiceObject;
Expand Down Expand Up @@ -384,7 +385,7 @@
undefined,
);
done();
(callback as any)(null, null, {} as r.Response);

Check warning on line 388 in core/common/test/service-object.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
});
serviceObject.delete(options, assert.ifError);
});
Expand Down Expand Up @@ -414,7 +415,7 @@
thisPropertyWasOverridden: true,
});
done();
(callback as any)(null, null, null!);

Check warning on line 418 in core/common/test/service-object.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
});

const serviceObject = new ServiceObject(CONFIG) as FakeServiceObject;
Expand Down Expand Up @@ -459,7 +460,7 @@
.callsFake((options_, callback) => {
assert.deepStrictEqual(options_, options);
done();
(callback as any)(null, null, {} as r.Response);

Check warning on line 463 in core/common/test/service-object.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
});
serviceObject.exists(options, assert.ifError);
});
Expand Down Expand Up @@ -664,7 +665,7 @@
assert.strictEqual(this, serviceObject);
assert.strictEqual((reqOpts as DecorateRequestOptions).uri, '');
done();
(callback as any)(null, null, {} as r.Response);

Check warning on line 668 in core/common/test/service-object.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
});
void serviceObject.getMetadata(() => {});
});
Expand All @@ -679,7 +680,7 @@
options,
);
done();
(callback as any)(null, null, {} as r.Response);

Check warning on line 683 in core/common/test/service-object.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
});
serviceObject.getMetadata(options, assert.ifError);
});
Expand All @@ -705,7 +706,7 @@
'v2',
);
done();
(callback as any)(null, null, null!);

Check warning on line 709 in core/common/test/service-object.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
});

const serviceObject = new ServiceObject(CONFIG) as FakeServiceObject;
Expand Down
2 changes: 1 addition & 1 deletion core/common/test/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import * as assert from 'assert';
import {describe, it, before, beforeEach, after} from 'mocha';
import * as extend from 'extend';
import * as proxyquire from 'proxyquire';
import {proxyquire} from 'google-test-utils';
import {Request} from 'teeny-request';
import {AuthClient, GoogleAuth, OAuth2Client} from 'google-auth-library';

Expand Down
2 changes: 1 addition & 1 deletion core/common/test/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
OAuth2Client,
} from 'google-auth-library';
import * as nock from 'nock';
import * as proxyquire from 'proxyquire';
import {proxyquire} from 'google-test-utils';
import * as retryRequest from 'retry-request';
import * as sinon from 'sinon';
import * as stream from 'stream';
Expand Down
3 changes: 2 additions & 1 deletion handwritten/bigquery/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"docs": "jsdoc -c .jsdoc.js",
"lint": "gts check",
"samples-test": "cd samples/ && pnpm link ../ && pnpm test && cd ../",
"test": "node ../../bin/run-test.cjs --proxyquire-shim build/test",
"test": "node ../../bin/run-test.cjs build/test",
"system-test": "node ../../bin/run-test.cjs build/system-test --timeout 600000",
"presystem-test": "pnpm run compile",
"clean": "gts clean",
Expand Down Expand Up @@ -91,6 +91,7 @@
"codecov": "^3.8.3",
"discovery-tsd": "^0.3.0",
"eslint-plugin-prettier": "^5.2.6",
"google-test-utils": "^0.4.0",
"gts": "^6.0.2",
"jsdoc": "^4.0.4",
"jsdoc-fresh": "^6.1.0",
Expand Down
3 changes: 2 additions & 1 deletion handwritten/bigquery/system-test/arrow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,8 @@ describe('Arrow Query Results', () => {

it('should raise the same error as query() when a jobs.insert query fails during execution', async () => {
const failingQuery = {
query: 'SELECT 1 / 0',
query:
'DECLARE n INT64 DEFAULT 50; SELECT 1 / (x - 50) FROM UNNEST(GENERATE_ARRAY(1, n)) AS x ORDER BY x;',

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a little unusual, but since it is a test change probably not much of a concern.

jobTimeoutMs: 60000,
useQueryCache: false,
};
Expand Down
2 changes: 1 addition & 1 deletion handwritten/bigquery/test/bigquery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import * as assert from 'assert';
import {describe, it, after, afterEach, before, beforeEach} from 'mocha';
import * as Big from 'big.js';
import * as extend from 'extend';
import * as proxyquire from 'proxyquire';
import {proxyquire} from 'google-test-utils';
import * as sinon from 'sinon';
import * as crypto from 'crypto';

Expand Down
2 changes: 1 addition & 1 deletion handwritten/bigquery/test/dataset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import * as pfy from '@google-cloud/promisify';
import * as assert from 'assert';
import {describe, it, before, beforeEach} from 'mocha';
import * as extend from 'extend';
import * as proxyquire from 'proxyquire';
import {proxyquire} from 'google-test-utils';

import * as _root from '../src';
import {toArray} from '../src/util';
Expand Down
2 changes: 1 addition & 1 deletion handwritten/bigquery/test/job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {DecorateRequestOptions, util} from '@google-cloud/common';
import * as pfy from '@google-cloud/promisify';
import * as assert from 'assert';
import {describe, it, beforeEach, afterEach, before} from 'mocha';
import * as proxyquire from 'proxyquire';
import {proxyquire} from 'google-test-utils';
import * as sinon from 'sinon';

import {BigQuery} from '../src/bigquery';
Expand Down
2 changes: 1 addition & 1 deletion handwritten/bigquery/test/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import * as assert from 'assert';
import {describe, it, before, beforeEach, afterEach} from 'mocha';
import * as sinon from 'sinon';
import * as proxyquire from 'proxyquire';
import {proxyquire} from 'google-test-utils';
import * as pfy from '@google-cloud/promisify';
import {EventEmitter} from 'events';
import {JobOptions} from '../src/job';
Expand Down
2 changes: 1 addition & 1 deletion handwritten/bigquery/test/routine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import * as pfy from '@google-cloud/promisify';
import * as assert from 'assert';
import {describe, it, before, beforeEach} from 'mocha';
import * as extend from 'extend';
import * as proxyquire from 'proxyquire';
import {proxyquire} from 'google-test-utils';

import * as _root from '../src';

Expand Down
2 changes: 1 addition & 1 deletion handwritten/bigquery/test/rowQueue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {util} from '@google-cloud/common';
import * as assert from 'assert';
import {describe, it, before, beforeEach, afterEach} from 'mocha';
import {Duplex, Stream} from 'stream';
import * as proxyquire from 'proxyquire';
import {proxyquire} from 'google-test-utils';
import * as sinon from 'sinon';
import * as q from '../src/rowQueue';
import * as t from '../src/table';
Expand Down
2 changes: 1 addition & 1 deletion handwritten/bigquery/test/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {describe, it, afterEach, beforeEach, before, after} from 'mocha';
import * as Big from 'big.js';
import {EventEmitter} from 'events';
import * as extend from 'extend';
import * as proxyquire from 'proxyquire';
import {proxyquire} from 'google-test-utils';
import * as sinon from 'sinon';
import * as stream from 'stream';
import * as crypto from 'crypto';
Expand Down
3 changes: 2 additions & 1 deletion handwritten/datastore/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"presystem-test": "npm run compile",
"system-test": "node ../../bin/run-test.cjs build/system-test --timeout 600000",
"pretest": "npm run compile",
"test": "node ../../bin/run-test.cjs --proxyquire-shim build/test",
"test": "node ../../bin/run-test.cjs build/test",
"precompile": "gts clean"
},
"dependencies": {
Expand Down Expand Up @@ -68,6 +68,7 @@
"async": "^3.2.6",
"c8": "^10.1.3",
"gapic-tools": "^2.2.0",
"google-test-utils": "^0.4.0",
"gts": "^6.0.2",
"js-yaml": "^4.1.0",
"jsdoc": "^4.0.4",
Expand Down
2 changes: 1 addition & 1 deletion handwritten/datastore/system-test/transaction-spy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import * as proxyquire from 'proxyquire';
import {proxyquire} from 'google-test-utils';
import {DatastoreRequest} from '../src';
import {RequestCallback, RequestConfig} from '../src/request';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
DatastoreOptions,
} from '../../src';
import * as assert from 'assert';
import * as proxyquire from 'proxyquire';
import {proxyquire} from 'google-test-utils';
import {Callback, CallOptions} from 'google-gax';
import * as protos from '../../src/protos';
import * as ds from '../../src';
Expand Down
2 changes: 1 addition & 1 deletion handwritten/datastore/test/index-class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import * as promisify from '@google-cloud/promisify';
import * as assert from 'assert';
import {before, beforeEach, describe, it} from 'mocha';
import * as proxyquire from 'proxyquire';
import {proxyquire} from 'google-test-utils';

import * as ds from '../src';

Expand Down
2 changes: 1 addition & 1 deletion handwritten/datastore/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import * as assert from 'assert';
import {before, beforeEach, after, afterEach, describe, it} from 'mocha';
import * as gax from 'google-gax';
import * as proxyquire from 'proxyquire';
import {proxyquire} from 'google-test-utils';
import {PassThrough, Readable} from 'stream';

import * as ds from '../src';
Expand Down
2 changes: 1 addition & 1 deletion handwritten/datastore/test/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {after, afterEach, before, beforeEach, describe, it} from 'mocha';
import * as extend from 'extend';
import * as gax from 'google-gax';
import * as is from 'is';
import * as proxyquire from 'proxyquire';
import {proxyquire} from 'google-test-utils';
import * as sinon from 'sinon';
import {PassThrough, Transform} from 'stream';

Expand Down
2 changes: 1 addition & 1 deletion handwritten/datastore/test/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import * as pfy from '@google-cloud/promisify';
import arrify = require('arrify');
import * as assert from 'assert';
import {afterEach, beforeEach, before, describe, it} from 'mocha';
import * as proxyquire from 'proxyquire';
import {proxyquire} from 'google-test-utils';
import {
Datastore,
DatastoreOptions,
Expand Down
3 changes: 2 additions & 1 deletion handwritten/google-cloud-dns/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"scripts": {
"docs": "jsdoc -c .jsdoc.js",
"lint": "gts check",
"test": "node ../../bin/run-test.cjs --proxyquire-shim build/test",
"test": "node ../../bin/run-test.cjs build/test",
"samples-test": "pnpm run compile && cd samples/ && pnpm link ../ && pnpm i && pnpm test",
"presystem-test": "pnpm run compile",
"system-test": "pnpm run compile && node ../../bin/run-test.cjs build/system-test",
Expand Down Expand Up @@ -64,6 +64,7 @@
"@types/tmp": "^0.2.6",
"c8": "^10.1.3",
"codecov": "^3.8.3",
"google-test-utils": "^0.4.0",
"gts": "^6.0.2",
"jsdoc": "^4.0.4",
"jsdoc-fresh": "^6.1.0",
Expand Down
6 changes: 3 additions & 3 deletions handwritten/google-cloud-dns/test/change.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
import * as promisify from '@google-cloud/promisify';
import * as assert from 'assert';
import {describe, it, before, beforeEach} from 'mocha';
import * as proxyquire from 'proxyquire';
import {proxyquire} from 'google-test-utils';
import {Change} from '../src/change';

let promisified = false;
Expand Down Expand Up @@ -119,7 +119,7 @@ describe('Change', () => {
assert.strictEqual(change, null);
assert.strictEqual(apiResponse_, apiResponse);
done();
}
},
);
});
});
Expand All @@ -145,7 +145,7 @@ describe('Change', () => {
assert.strictEqual(change_, change);
assert.strictEqual(apiResponse_, apiResponse);
done();
}
},
);
});

Expand Down
18 changes: 9 additions & 9 deletions handwritten/google-cloud-dns/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import * as promisify from '@google-cloud/promisify';
import arrify = require('arrify');
import * as assert from 'assert';
import {describe, it, before, beforeEach} from 'mocha';
import * as proxyquire from 'proxyquire';
import {proxyquire} from 'google-test-utils';
import {CoreOptions, OptionsWithUri, Response} from 'request';

import {Zone} from '../src';
Expand Down Expand Up @@ -135,7 +135,7 @@ describe('DNS', () => {
assert.deepStrictEqual(
calledWith.packageJson,
// eslint-disable-next-line @typescript-eslint/no-var-requires
require('../../package.json')
require('../../package.json'),
);
});

Expand Down Expand Up @@ -226,7 +226,7 @@ describe('DNS', () => {
assert.strictEqual(zone, null);
assert.strictEqual(apiResponse_, apiResponse);
done();
}
},
);
});
});
Expand Down Expand Up @@ -265,7 +265,7 @@ describe('DNS', () => {
assert.strictEqual(apiResponse_, apiResponse);

done();
}
},
);
});

Expand Down Expand Up @@ -318,15 +318,15 @@ describe('DNS', () => {
err: Error,
zones: Zone[],
nextQuery: {},
apiResponse_: Response
apiResponse_: Response,
) => {
assert.strictEqual(err, error);
assert.strictEqual(zones, null);
assert.strictEqual(nextQuery, null);
assert.strictEqual(apiResponse_, apiResponse);

done();
}
},
);
});
});
Expand Down Expand Up @@ -377,7 +377,7 @@ describe('DNS', () => {
nextQuery,
Object.assign({}, query, {
pageToken: apiResponseWithNextPageToken.nextPageToken,
})
}),
);

done();
Expand All @@ -391,15 +391,15 @@ describe('DNS', () => {
err: Error,
zones: Zone[],
nextQuery: {},
apiResponse_: Response
apiResponse_: Response,
) => {
assert.ifError(err);
assert.strictEqual(zones[0], zone);
assert.strictEqual(nextQuery, null);
assert.strictEqual(apiResponse_, apiResponse);

done();
}
},
);
});

Expand Down
2 changes: 1 addition & 1 deletion handwritten/google-cloud-dns/test/record.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import * as promisify from '@google-cloud/promisify';
import * as assert from 'assert';
import {describe, it, before, beforeEach} from 'mocha';
import * as proxyquire from 'proxyquire';
import {proxyquire} from 'google-test-utils';

// eslint-disable-next-line @typescript-eslint/no-unused-vars
import {Record} from '../src';
Expand Down Expand Up @@ -297,7 +297,7 @@
});

describe('delete', () => {
it('should call zone.deleteRecords', (done: any) => {

Check warning on line 300 in handwritten/google-cloud-dns/test/record.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
record.zone_.deleteRecords = (records: Record[], callback: Function) => {
assert.strictEqual(records, record);
callback();
Expand Down
Loading
Loading