Skip to content
Draft
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
2 changes: 1 addition & 1 deletion handwritten/logging-bunyan/cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ steps:
args:
- '-c'
- |
cd ../.. && corepack enable pnpm && pnpm install --filter "...{./handwritten/logging-bunyan}"
cd ../.. && corepack enable pnpm && pnpm install --filter "./core/test-utils" --filter "...{./handwritten/logging-bunyan}" --ignore-scripts && pnpm --dir core/test-utils run compile && node -e "require('./bin/run-test.cjs').ensureWorkspacePackagesLinked()" && pnpm --filter "...{./handwritten/logging-bunyan}" run prepare --if-present
dir: 'handwritten/logging-bunyan'
id: 'install-dependencies'

Expand Down
3 changes: 2 additions & 1 deletion handwritten/logging-bunyan/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"presystem-test": "pnpm run compile",
"samples-test": "cd samples/ && npm link ../ && npm test && cd ../",
"system-test": "node ../../bin/run-test.cjs build/system-test --timeout 600000",
"test": "cross-env NODE_OPTIONS='--no-deprecation' node ../../bin/run-test.cjs --proxyquire-shim build/test",
"test": "cross-env NODE_OPTIONS='--no-deprecation' node ../../bin/run-test.cjs build/test",
"clean": "gts clean",
"compile": "tsc -p .",
"postcompile": "cpy \"src/types/*\" build/src/types",
Expand Down Expand Up @@ -70,6 +70,7 @@
"cross-env": "^7.0.3",
"delay": "^5.0.0",
"express": "^4.16.3",
"google-test-utils": "^0.3.0",
"gts": "^6.0.2",
"jsdoc": "^4.0.0",
"jsdoc-fresh": "^6.0.0",
Expand Down
2 changes: 1 addition & 1 deletion handwritten/logging-bunyan/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.
import * as assert from 'assert';
import {describe, it, beforeEach, afterEach} from 'mocha';
import * as proxyquire from 'proxyquire';
import {proxyquire} from 'google-test-utils';
import {inspect} from 'util';

import {LoggingBunyan} from '../src';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import * as assert from 'assert';
import {describe, it, beforeEach} from 'mocha';
import {GCPEnv} from 'google-auth-library';
import * as proxyquire from 'proxyquire';
import {proxyquire} from 'google-test-utils';

// types-only import. Actual require is done through proxyquire below.
import {MiddlewareOptions} from '../../src/middleware/express';
Expand Down
2 changes: 1 addition & 1 deletion handwritten/logging-winston/cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ steps:
args:
- '-c'
- |
cd ../.. && corepack enable pnpm && pnpm install --filter "...{./handwritten/logging-winston}"
cd ../.. && corepack enable pnpm && pnpm install --filter "./core/test-utils" --filter "...{./handwritten/logging-winston}" --ignore-scripts && pnpm --dir core/test-utils run compile && node -e "require('./bin/run-test.cjs').ensureWorkspacePackagesLinked()" && pnpm --filter "...{./handwritten/logging-winston}" run prepare --if-present
dir: 'handwritten/logging-winston'
id: 'install-dependencies'

Expand Down
3 changes: 2 additions & 1 deletion handwritten/logging-winston/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"samples-test": "cd samples/ && npm link ../ && npm test && cd ../",
"presystem-test": "pnpm run pretest",
"system-test": "node ../../bin/run-test.cjs build/system-test --timeout 600000",
"test": "cross-env NODE_OPTIONS='--no-deprecation' node ../../bin/run-test.cjs --proxyquire-shim build/test",
"test": "cross-env NODE_OPTIONS='--no-deprecation' node ../../bin/run-test.cjs build/test",
"clean": "gts clean",
"compile": "tsc -p .",
"fix": "gts fix",
Expand All @@ -67,6 +67,7 @@
"c8": "^10.1.3",
"codecov": "^3.8.3",
"cross-env": "^7.0.3",
"google-test-utils": "^0.3.0",
"gts": "^6.0.2",
"jsdoc": "^4.0.5",
"jsdoc-fresh": "^6.0.0",
Expand Down
2 changes: 1 addition & 1 deletion handwritten/logging-winston/test/common.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, beforeEach} from 'mocha';
import * as nodeutil from 'util';
import * as proxyquire from 'proxyquire';
import {proxyquire} from 'google-test-utils';
import {Options} from '../src';
import {Entry, Logging, LogSync, Log} from '@google-cloud/logging';
import * as instrumentation from '@google-cloud/logging/build/src/utils/instrumentation';
Expand Down
2 changes: 1 addition & 1 deletion handwritten/logging-winston/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 {describe, it, beforeEach} from 'mocha';
import * as TransportStream from 'winston-transport';
import * as proxyquire from 'proxyquire';
import {proxyquire} from 'google-test-utils';
import {Options} from '../src';

describe('logging-winston', () => {
Expand Down
2 changes: 1 addition & 1 deletion handwritten/logging-winston/test/middleware/express.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {GCPEnv} from 'google-auth-library';
import {LogEntry} from 'winston';
import * as TransportStream from 'winston-transport';
import * as winston from 'winston';
import * as proxyquire from 'proxyquire';
import {proxyquire} from 'google-test-utils';
import {Options} from '../../src';

// types-only import. Actual require is done through proxyquire below.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import * as assert from 'assert';
import {describe, it, before, beforeEach, after} from 'mocha';
import * as proxyquire from 'proxyquire';
import {proxyquire} from 'google-test-utils';
import * as winston from 'winston';
import * as loggingWinstonLibTypes from '../src/index';

Expand Down
2 changes: 1 addition & 1 deletion handwritten/logging/cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ steps:
args:
- '-c'
- |
cd ../.. && corepack enable pnpm && pnpm install --filter "...{./handwritten/logging}"
cd ../.. && corepack enable pnpm && pnpm install --filter "./core/test-utils" --filter "...{./handwritten/logging}" --ignore-scripts && pnpm --dir core/test-utils run compile && node -e "require('./bin/run-test.cjs').ensureWorkspacePackagesLinked()" && pnpm --filter "...{./handwritten/logging}" run prepare --if-present
dir: 'handwritten/logging'
id: 'install-dependencies'

Expand Down
3 changes: 2 additions & 1 deletion handwritten/logging/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"presystem-test": "pnpm run compile",
"system-test": "node ../../bin/run-test.cjs build/system-test --timeout 600000",
"pretest": "pnpm run compile",
"test": "cross-env NODE_OPTIONS='--no-deprecation' node ../../bin/run-test.cjs --proxyquire-shim build/test",
"test": "cross-env NODE_OPTIONS='--no-deprecation' node ../../bin/run-test.cjs build/test",
"precompile": "gts clean",
"postpublish": "./.kokoro/publish-min.sh"
},
Expand Down Expand Up @@ -86,6 +86,7 @@
"codecov": "^3.6.5",
"cross-env": "^7.0.3",
"gapic-tools": "^2.0.0",
"google-test-utils": "^0.3.0",
"gts": "^5.0.0",
"http2spy": "^2.0.0",
"jsdoc": "^4.0.0",
Expand Down
34 changes: 17 additions & 17 deletions handwritten/logging/test/entry.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 extend from 'extend';
import * as proxyquire from 'proxyquire';
import {proxyquire} from 'google-test-utils';
import * as entryTypes from '../src/entry';
import * as common from '../src/utils/common';
import * as http from 'http';
Expand Down Expand Up @@ -222,7 +222,7 @@
it('should pass removeCircular to objToStruct_', done => {
fakeObjToStruct = (
obj: {},
options: common.ObjectToStructConverterConfig,
options: common.ObjectToStructConverterConfig
) => {
assert.strictEqual(options.removeCircular, true);
done();
Expand Down Expand Up @@ -325,7 +325,7 @@
});

after(() => {
sdk.shutdown();
return sdk.shutdown();
});

it('should detect open telemetry trace and span if open telemetry context present', () => {
Expand All @@ -335,12 +335,12 @@
const json = entry.toJSON();
assert.strictEqual(
json.trace,
`projects//traces/${span.spanContext().traceId}`,
`projects//traces/${span.spanContext().traceId}`
);
assert.strictEqual(json.spanId, span.spanContext().spanId);
assert.strictEqual(
json.traceSampled,
(span.spanContext().traceFlags & 1) !== 0,
(span.spanContext().traceFlags & 1) !== 0
);
});
});
Expand All @@ -360,12 +360,12 @@
const json = entry.toJSON();
assert.strictEqual(
json.trace,
`projects//traces/${span.spanContext().traceId}`,
`projects//traces/${span.spanContext().traceId}`
);
assert.strictEqual(json.spanId, span.spanContext().spanId);
assert.strictEqual(
json.traceSampled,
(span.spanContext().traceFlags & 1) !== 0,
(span.spanContext().traceFlags & 1) !== 0
);
});
});
Expand All @@ -373,7 +373,7 @@
it('should not overwrite user defined trace and span when open telemetry context detected', () => {
trace
.getTracer('nodejs-logging-context-test')
.startActiveSpan('foo', span => {

Check warning on line 376 in handwritten/logging/test/entry.ts

View workflow job for this annotation

GitHub Actions / lint

'span' is defined but never used

Check warning on line 376 in handwritten/logging/test/entry.ts

View workflow job for this annotation

GitHub Actions / lint

'span' is defined but never used
entry.metadata.spanId = '1';
entry.metadata.trace = '1';
entry.metadata.traceSampled = false;
Expand Down Expand Up @@ -413,7 +413,7 @@
entry.data = 'this is a log';
const json = entry.toStructuredJSON();
assert(
withinExpectedTimeBoundaries(nanosAndSecondsToDate(json.timestamp!)),
withinExpectedTimeBoundaries(nanosAndSecondsToDate(json.timestamp!))
);
delete json.timestamp;
const expectedJSON = {
Expand Down Expand Up @@ -441,7 +441,7 @@
entry.metadata.timestamp = new Date();
const json = entry.toStructuredJSON();
assert(
withinExpectedTimeBoundaries(nanosAndSecondsToDate(json.timestamp!)),
withinExpectedTimeBoundaries(nanosAndSecondsToDate(json.timestamp!))
);
});

Expand Down Expand Up @@ -503,7 +503,7 @@
});

after(() => {
sdk.shutdown();
return sdk.shutdown();
});

it('should detect open telemetry trace and span if open telemetry context present', () => {
Expand All @@ -513,15 +513,15 @@
const json = entry.toStructuredJSON();
assert.strictEqual(
json[entryTypes.TRACE_KEY],
`projects//traces/${span.spanContext().traceId}`,
`projects//traces/${span.spanContext().traceId}`
);
assert.strictEqual(
json[entryTypes.SPAN_ID_KEY],
span.spanContext().spanId,
span.spanContext().spanId
);
assert.strictEqual(
json[entryTypes.TRACE_SAMPLED_KEY],
(span.spanContext().traceFlags & 1) !== 0,
(span.spanContext().traceFlags & 1) !== 0
);
});
});
Expand All @@ -541,15 +541,15 @@
const json = entry.toStructuredJSON();
assert.strictEqual(
json[entryTypes.TRACE_KEY],
`projects//traces/${span.spanContext().traceId}`,
`projects//traces/${span.spanContext().traceId}`
);
assert.strictEqual(
json[entryTypes.SPAN_ID_KEY],
span.spanContext().spanId,
span.spanContext().spanId
);
assert.strictEqual(
json[entryTypes.TRACE_SAMPLED_KEY],
(span.spanContext().traceFlags & 1) !== 0,
(span.spanContext().traceFlags & 1) !== 0
);
});
});
Expand All @@ -557,7 +557,7 @@
it('should not overwrite user defined trace and span when open telemetry context detected', () => {
trace
.getTracer('nodejs-logging-context-test')
.startActiveSpan('foo', span => {

Check warning on line 560 in handwritten/logging/test/entry.ts

View workflow job for this annotation

GitHub Actions / lint

'span' is defined but never used

Check warning on line 560 in handwritten/logging/test/entry.ts

View workflow job for this annotation

GitHub Actions / lint

'span' is defined but never used
entry.metadata.spanId = '1';
entry.metadata.trace = '1';
entry.metadata.traceSampled = false;
Expand All @@ -571,7 +571,7 @@
assert.strictEqual(json[entryTypes.SPAN_ID_KEY], expected.spanId);
assert.strictEqual(
json[entryTypes.TRACE_SAMPLED_KEY],
expected.traceSampled,
expected.traceSampled
);
});
});
Expand Down
Loading
Loading