Skip to content

Conversation

skonves
Copy link
Owner

@skonves skonves commented Apr 2, 2025

Resolves #57
Resolves #52
Resolves #51
Resolves #47
Resolves #32
Resolves #26
Resolves #18
Resolves #15
Resolves #13

beeduck and others added 13 commits March 17, 2025 10:27
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@skonves skonves requested a review from Copilot April 2, 2025 00:01
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR upgrades the codebase from using cls-hooked to AsyncLocalStorage, updating corresponding tests and documentation.

  • Refactor of the context implementation in index.js to use AsyncLocalStorage
  • Updated test suites to validate the new return values from httpContext.set and ensure correct middleware behavior
  • Revised README to reflect the new dependency and usage instructions

Reviewed Changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/express-test-harness.js Updated tests to capture return values from httpContext.set and add new middleware usage scenarios
tests/browser.js Removed deprecated test expectations for the legacy ns property
index.js Migrated the context implementation from cls-hooked to AsyncLocalStorage
browser.js Removed the ns property to align with the new context strategy
README.md Revised documentation to reflect the upgrade to AsyncLocalStorage
Files not reviewed (1)
  • package.json: Language not supported

@coveralls
Copy link

coveralls commented Apr 2, 2025

Coverage Status

coverage: 100.0%. remained the same
when pulling 653a712 on rc
into abe9067 on master.

skonves and others added 2 commits April 1, 2025 17:04
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@skonves skonves requested a review from Copilot April 3, 2025 01:54
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR upgrades the project from using cls-hooked to using AsyncLocalStorage and updates tests and documentation accordingly. Key changes include:

  • Replacing cls-hooked with AsyncLocalStorage in index.js.
  • Updating tests to capture and assert the return value from httpContext.set.
  • Revising documentation to reflect the new implementation and usage instructions.

Reviewed Changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/express-test-harness.js Updates to test assertions and added return value handling from set()
tests/browser.js Removal of a test case checking for a null namespace property
index.js Replacement of cls-hooked with AsyncLocalStorage and updated set() behavior
browser.js Removal of the ns property; now a no-op implementation
README.md Documentation updates explaining the AsyncLocalStorage implementation
Files not reviewed (1)
  • package.json: Language not supported

app.use(httpContext.middleware);

app.get('/test', (req, res) => {
const delay = new Number(req.query.delay);
Copy link
Preview

Copilot AI Apr 3, 2025

Choose a reason for hiding this comment

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

Using 'new Number()' creates a Number object instead of a primitive, which may lead to unexpected behavior in numeric operations. Consider using Number(req.query.delay) or parseInt(req.query.delay, 10) for reliable numeric conversion.

Suggested change
const delay = new Number(req.query.delay);
const delay = Number(req.query.delay);

Copilot uses AI. Check for mistakes.

@skonves skonves merged commit 00bf97b into master Apr 3, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment