-
Notifications
You must be signed in to change notification settings - Fork 14
refactor: simplify trace types and helper #1236
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
base: main
Are you sure you want to change the base?
Conversation
|
View your CI Pipeline Execution ↗ for commit 058c9c1
☁️ Nx Cloud last updated this comment at |
|
View your CI Pipeline Execution ↗ for commit ad83c42
☁️ Nx Cloud last updated this comment at |
@code-pushup/ci
@code-pushup/core
@code-pushup/create-cli
@code-pushup/models
@code-pushup/nx-plugin
@code-pushup/cli
@code-pushup/axe-plugin
@code-pushup/coverage-plugin
@code-pushup/eslint-plugin
@code-pushup/js-packages-plugin
@code-pushup/jsdocs-plugin
@code-pushup/lighthouse-plugin
@code-pushup/typescript-plugin
@code-pushup/utils
commit: |
Code PushUp🤨 Code PushUp report has both improvements and regressions – compared current commit 341273e with previous commit 7b6e72c. 🕵️ See full comparison in Code PushUp portal 🔍 🏷️ Categories👍 1 group improved, 👎 2 groups regressed, 👍 5 audits improved, 👎 5 audits regressed, 18 audits changed without impacting score🗃️ Groups
31 other groups are unchanged. 🛡️ Audits
651 other audits are unchanged. |
Code PushUp🤨 Code PushUp report has both improvements and regressions – compared current commit 341273e with previous commit 7b6e72c. 💼 Project
|
| 🏷️ Category | ⭐ Previous score | ⭐ Current score | 🔄 Score change |
|---|---|---|---|
| Documentation | 🟡 61 | 🟡 60 | |
| Code coverage | 🟢 95 | 🟢 95 |
4 other categories are unchanged.
👎 2 groups regressed, 👍 2 audits improved, 👎 4 audits regressed
🗃️ Groups
| 🔌 Plugin | 🗃️ Group | ⭐ Previous score | ⭐ Current score | 🔄 Score change |
|---|---|---|---|---|
| JSDocs coverage | Documentation coverage | 🟡 61 | 🟡 60 | |
| Code coverage | Code coverage metrics | 🟢 95 | 🟢 95 |
13 other groups are unchanged.
🛡️ Audits
| 🔌 Plugin | 🛡️ Audit | 📏 Previous value | 📏 Current value | 🔄 Value change |
|---|---|---|---|---|
| JSDocs coverage | Variables coverage | 🟥 50 undocumented variables | 🟥 49 undocumented variables | |
| JSDocs coverage | Types coverage | 🟨 55 undocumented types | 🟨 55 undocumented types | |
| JSDocs coverage | Functions coverage | 🟥 243 undocumented functions | 🟥 243 undocumented functions | |
| JSDocs coverage | Properties coverage | 🟥 39 undocumented properties | 🟥 40 undocumented properties | |
| Code coverage | Branch coverage | 🟩 91.9 % | 🟩 91.8 % | |
| Code coverage | Line coverage | 🟩 97.8 % | 🟩 97.8 % |
438 other audits are unchanged.
13 other projects are unchanged.
| const result = serializeTraceEvent(event); | ||
|
|
||
| expect(result).toStrictEqual({ | ||
| expect(typeof result).toBe('string'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd recommend using either Vitest's .toBeTypeOf('string') or jest-extended's .toBeString() instead. This also applies in other places in this PR.
| expect(typeof result).toBe('string'); | |
| expect(result).toBeString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, is this check really necessary (here and everywhere else)? If the toStrictEqual below passes, the produced result is correct, isn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are still seven instances of a check similar to expect(typeof result).toBe('string');.
Co-authored-by: Hanna Skryl <80118140+hanna-skryl@users.noreply.github.com>
Co-authored-by: Hanna Skryl <80118140+hanna-skryl@users.noreply.github.com>
Co-authored-by: Hanna Skryl <80118140+hanna-skryl@users.noreply.github.com>
Co-authored-by: Hanna Skryl <80118140+hanna-skryl@users.noreply.github.com>
| metadata?: Partial<TraceMetadata>; | ||
| }): TraceEventContainer => ({ | ||
| traceEvents: opt.traceEvents, | ||
| traceEvents: opt.traceEvents.map(encodeEvent), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
createTraceFile now encodes events internally, but generateTraceContent, where it's used, immediately discards those encoded events by overwriting traceEvents 🤔
| it('should handle zero values', () => { | ||
| const result = getShardId(); | ||
| const counter = { next: () => 1 }; | ||
| const result = getUniqueInstanceId(counter); | ||
| expect(result).toStartWith('20231114-221320-000.'); | ||
| }); | ||
|
|
||
| it('should handle negative timestamps', () => { | ||
| const result = getShardId(); | ||
| const counter = { next: () => 1 }; | ||
| const result = getUniqueInstanceId(counter); | ||
|
|
||
| expect(result).toStartWith('20231114-221320-000.'); | ||
| }); | ||
|
|
||
| it('should handle large timestamps', () => { | ||
| const result = getShardId(); | ||
| const counter = { next: () => 1 }; | ||
| const result = getUniqueInstanceId(counter); | ||
|
|
||
| expect(result).toStartWith('20231114-221320-000.'); | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The content of these tests is identical, but their descriptions differ. Is there something implied I'm missing?
| ); | ||
| }); | ||
|
|
||
| describe('ID_PATTERNS', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are three it.each() test cases in the ID_PATTERNS suite with only one input. Is this necessary?
Related:
This PR includes:
Followup: