Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: actually run tests for logging, fix any problems #1685

Merged
merged 9 commits into from
Dec 20, 2024
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
62 changes: 62 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,48 @@ jobs:
- run: cd gax; npm test
env:
MOCHA_THROW_DEPRECATION: false
test-logging-utils:
runs-on: ubuntu-latest
strategy:
matrix:
node: [14, 16]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- run: node --version
# The first installation step ensures that all of our production
# dependencies work on the given Node.js version, this helps us find
# dependencies that don't match our engines field:
- run: cd logging-utils; npm install --production --engine-strict --ignore-scripts --no-package-lock
# Clean up the production install, before installing dev/production:
- run: cd logging-utils; rm -rf node_modules
- run: cd logging-utils; npm install
- run: cd logging-utils; npm test
env:
MOCHA_THROW_DEPRECATION: false
test-logging-utils-samples:
runs-on: ubuntu-latest
strategy:
matrix:
node: [14, 16]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- run: node --version
# The first installation step ensures that all of our production
# dependencies work on the given Node.js version, this helps us find
# dependencies that don't match our engines field:
- run: cd logging-utils; npm install --production --engine-strict --ignore-scripts --no-package-lock
# Clean up the production install, before installing dev/production:
- run: cd logging-utils; rm -rf node_modules
- run: cd logging-utils; npm install
- run: cd logging-utils; npm run samples-test
env:
MOCHA_THROW_DEPRECATION: false
test-tools:
runs-on: ubuntu-latest
strategy:
Expand Down Expand Up @@ -69,6 +111,17 @@ jobs:
- run: cd tools; npm test
env:
MOCHA_THROW_DEPRECATION: false
windows-logging-utils:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 14
- run: cd logging-utils; npm install
- run: cd logging-utils; npm test
env:
MOCHA_THROW_DEPRECATION: false
lint-gax:
runs-on: ubuntu-latest
steps:
Expand All @@ -87,6 +140,15 @@ jobs:
node-version: 14
- run: cd tools; npm install
- run: cd tools; npm run lint
lint-logging-utils:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 14
- run: cd logging-utils; npm install
- run: cd logging-utils; npm run lint
docs:
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 2 additions & 0 deletions logging-utils/.eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ build/
docs/
protos/
samples/generated/
samples/typescript/**
samples/system-test/**
6 changes: 3 additions & 3 deletions logging-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
"test": "c8 mocha build/test",
"lint": "gts check test src samples",
"clean": "gts clean",
"compile": "tsc -p . && cp -r test/fixtures build/test",
"compile": "tsc -p .",
"fix": "gts fix",
"prepare": "npm run compile",
"precompile": "gts clean",
"samples-test": "echo no samples 🙀",
"samples-test": "cd samples/ && npm install && npm test && cd ../",
"system-test": "echo no system tests 🙀"
},
"author": "Google API Authors",
Expand All @@ -29,7 +29,7 @@
"@types/mocha": "^10.0.10",
"@types/node": "^22.9.1",
"c8": "^9.0.0",
"gts": "^5.0.0",
"gts": "^5.3.1",
"mocha": "^9.0.0",
"typescript": "^5.1.6"
},
Expand Down
1 change: 1 addition & 0 deletions logging-utils/samples/javascript/quickstart.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
// usage: node quickstart.js <project-id> <topic-name-or-id> <subscription-name-or-id>

// [!START logging_utils_quickstart]
// eslint-disable-next-line n/no-missing-require
const {log} = require('google-logging-utils');

function main() {
Expand Down
2 changes: 1 addition & 1 deletion logging-utils/samples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"node": ">=14"
},
"dependencies": {
"google-logging-utils": "^1.0.0"
"google-logging-utils": "0.0.2"
},
"devDependencies": {
"@google-cloud/typeless-sample-bot": "^2.1.0",
Expand Down
1 change: 1 addition & 0 deletions logging-utils/src/logging-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ export function getNodeBackend(): DebugLogBackend {
//
// Note: using the proper types here introduces an extra dependency
// we don't want, so for the moment, they'll be notational only.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type DebugPackage = any; // debug.Debug
class DebugBackend extends DebugLogBackendBase {
debugPkg: DebugPackage;
Expand Down
Loading