Skip to content

fix(execution): multi-decorator support with @trace() and handle hidden returned promises#57

Merged
tabkram merged 2 commits into
mainfrom
fix/hidden-promises
Feb 25, 2025
Merged

fix(execution): multi-decorator support with @trace() and handle hidden returned promises#57
tabkram merged 2 commits into
mainfrom
fix/hidden-promises

Conversation

@tabkram
Copy link
Copy Markdown
Owner

@tabkram tabkram commented Feb 25, 2025

PR Summary

Enhancements & Fixes

Added support for multiple decorators, including @trace(), ensuring they work together seamlessly.
Fixed issues with hidden returned promises in async functions, improving execution consistency.
Updated tests to validate new functionality and ensure correctness.
Simplified examples for better readability and ease of understanding.
Refactored the execute() function to improve clarity and maintainability.


Main Fix Example

// Fixed example:
class TestClass {
  @trace()
  @say() // Another external decorator that overrides method but still executes it inside a Promise
  someMethod(a: number, b: number) {
    console.log("Original method execution");
    return a + b;
  }
}

⚠️ Compatibility Notice

🔹 The execute() function now passes two arguments to the callback instead of one.
🔹 The execute() function no longer includes the options argument and does not update the context when bound.
Except for these minor changes, this PR maintains full backward compatibility (NO BREAKING CHANGES).

Let me know if you'd like further refinements! 🚀

@tabkram tabkram added the deploy deploy a canary version to NPM label Feb 25, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 25, 2025

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements
96.04% (+0.02% 🔼)
315/328
🟢 Branches
88.38% (-0.32% 🔻)
213/241
🟢 Functions
94.51% (+0.12% 🔼)
86/91
🟢 Lines
96.78% (+0.01% 🔼)
301/311
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟢
... / traceDecorator.ts
100%
90% (-10% 🔻)
100% 100%
🟢
... / execute.ts
100%
85% (-1.96% 🔻)
100% 100%

Test suite run success

78 tests passing in 9 suites.

Report generated by 🧪jest coverage report action from 9fbf1b5

@tabkram tabkram force-pushed the fix/hidden-promises branch from 135bf15 to 1392be0 Compare February 25, 2025 22:39
…dden returned promises

- Added support for using multiple decorators, including @trace().
- Fixed issues with hidden returned promises in async functions.
- Updated tests to check new features and ensure proper behavior.
- Simplified examples for better understanding.

⚠️ Compatibility Notice:
- The `execute()` function now passes two arguments to the callback instead of one.
- The `execute()` function no longer includes the `options` argument and no longer updates the context when bound.
@github-actions
Copy link
Copy Markdown
Contributor

🚫 Unpublished versions: ∅
Created Version: 3.0.0-canary.57.cedcd40
📦 Published on NPM: View on NPM

⚠️ Note: This version is temporary and will be unpublished on the next PR update or merge.

@tabkram tabkram merged commit 66eab3c into main Feb 25, 2025
@github-actions
Copy link
Copy Markdown
Contributor

🚫 Unpublished versions: 3.0.0-canary.57.cedcd40

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deploy deploy a canary version to NPM

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant