-
-
Notifications
You must be signed in to change notification settings - Fork 0
3.0.14 #74
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
3.0.14 #74
Conversation
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. 📝 WalkthroughWalkthroughBumped multiple package/devDependency versions, upgraded CI actions and added a cleanup step, removed Mocha & ESLint TS configs, tightened and rearranged TypeScript configs, made a minor syntactic change in an ESLint build script, and removed Engine/Container runtime usage from the create-plugin code. Changes
Sequence Diagram(s)(omitted — changes do not introduce new multi-component control flow requiring a sequence diagram) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Pull request overview
This PR updates the package version from 3.0.11 to 3.0.14 and upgrades several dependencies including @tsparticles/* packages, typescript-eslint, and prettier-plugin-multiline-arrays. A minor code formatting fix (adding a trailing comma) is also included in the build-eslint.ts file.
Key changes:
- Version bump from 3.0.11 to 3.0.14 in package.json
- Updated @tsparticles/* dependencies (eslint-config, prettier-config, tsconfig, webpack-plugin)
- Upgraded typescript-eslint from ^8.50.0 to ^8.51.0
- Updated prettier-plugin-multiline-arrays from 4.1.1 to ^4.1.3 (also changed from pinned to caret versioning)
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/build/build-eslint.ts | Added trailing comma to improve code formatting consistency |
| pnpm-lock.yaml | Updated lockfile to reflect all dependency version changes |
| package.json | Bumped package version to 3.0.14 and updated multiple dependencies |
| files/empty-project/package.json | Updated @tsparticles/cli reference to ^3.0.14, but missing updates to other @tsparticles/* packages |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)
files/empty-project/package.json:91
- The version in files/empty-project/package.json has inconsistent dependency versions. While @tsparticles/cli is updated to ^3.0.14, the other @tsparticles packages remain at ^3.0.6:
- @tsparticles/eslint-config should be ^3.0.9 (to match package.json line 33)
- @tsparticles/prettier-config should be ^3.0.7 (to match package.json line 34)
- @tsparticles/tsconfig should be ^3.0.9 (to match package.json line 35)
- @tsparticles/webpack-plugin should be ^3.0.6 (to match package.json line 36)
These inconsistencies could lead to version conflicts and unexpected behavior.
"@tsparticles/eslint-config": "^3.0.6",
"@tsparticles/prettier-config": "^3.0.6",
"@tsparticles/tsconfig": "^3.0.6",
"@tsparticles/webpack-plugin": "^3.0.6",
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Actionable comments posted: 0
♻️ Duplicate comments (2)
package.json (2)
3-3: Version mismatch with PR title already flagged.The discrepancy between the PR title ("3.0.13") and the actual version ("3.0.14") was already noted in a previous review. Please address this to ensure consistency.
49-49: Versioning strategy change already flagged.The change from an exact version (4.1.1) to a caret range (^4.1.3) was already noted in a previous review. Please confirm this change in dependency management strategy is intentional.
🧹 Nitpick comments (1)
src/build/build-eslint.ts (1)
30-31: Minor: Trailing comma change appears unrelated to version bump.The trailing comma addition is harmless and often preferred for cleaner git diffs. However, this formatting change seems unrelated to the PR's primary objective (version bump). Consider whether such changes should be handled separately by automated formatting tools or in a dedicated formatting PR.
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (3)
files/empty-project/package.jsonpackage.jsonsrc/build/build-eslint.ts
🔇 Additional comments (4)
files/empty-project/package.json (1)
87-87: LGTM! Dependency version aligned with the root package.The
@tsparticles/clidevDependency update correctly aligns with the version being published in the root package.json.package.json (3)
33-36: LGTM! @tsparticles dependencies updated consistently.The @tsparticles internal dependencies have been updated to newer minor versions, which is appropriate for this release.
53-53: LGTM! TypeScript ESLint updated to latest minor version.The typescript-eslint update from ^8.50.0 to ^8.51.0 is appropriate for incorporating recent fixes and improvements.
58-58: LGTM! Self-referential devDependency updated correctly.The @tsparticles/cli devDependency has been updated to match the version being published.
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.
Actionable comments posted: 2
🧹 Nitpick comments (2)
files/create-plugin/src/PluginInstance.ts (2)
4-12: Consider cleaning up nested comment marker for clarity.The
/*on line 9 inside the block comment (lines 4-12) doesn't serve a functional purpose and may confuse developers using this template. Consider removing it for cleaner commented-out code.🔎 Suggested cleanup
/* private readonly _container; private readonly _engine; constructor(container: Container, engine: Engine) { - /*this._container = container; + this._container = container; this._engine = engine; } */
14-17: Redundantawaiton resolved promise.The
awaitkeyword is redundant sincePromise.resolve()returns an already-resolved promise. Consider simplifying toreturn Promise.resolve();or justreturn;.🔎 Suggested simplification
async init(): Promise<void> { // add your plugin initialization here, replace the empty promise - return await Promise.resolve(); + return Promise.resolve(); }Or even simpler:
async init(): Promise<void> { // add your plugin initialization here, replace the empty promise - return await Promise.resolve(); }
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
.github/workflows/node.js-ci.ymlfiles/create-plugin/src/PluginInstance.tsfiles/create-plugin/src/index.tsfiles/create-plugin/src/plugin.ts
✅ Files skipped from review due to trivial changes (1)
- .github/workflows/node.js-ci.yml
🧰 Additional context used
🧬 Code graph analysis (1)
files/create-plugin/src/index.ts (1)
files/create-plugin/src/plugin.ts (1)
Plugin(6-36)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: pr
🔇 Additional comments (3)
files/create-plugin/src/PluginInstance.ts (1)
1-1: LGTM!Import changes correctly remove Container and Engine type dependencies while preserving IContainerPlugin, which is still needed for the class implementation.
files/create-plugin/src/plugin.ts (2)
1-1: LGTM!Import changes appropriately remove Container and Engine type dependencies while preserving the types still needed for the plugin implementation.
9-15: Constructor changes look consistent.The removal of the engine parameter and related field/assignment is consistent with the broader refactoring across the plugin template files.
| const { Plugin } = await import("./plugin.js"); | ||
|
|
||
| await engine.addPlugin(new Plugin(engine)); | ||
| await engine.addPlugin(new Plugin(/*engine*/)); |
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.
🧩 Analysis chain
🏁 Script executed:
# First, locate the plugin.ts file to verify the constructor signature
find . -name "plugin.ts" -o -name "plugin.js" | head -20Repository: tsparticles/cli
Length of output: 124
🏁 Script executed:
# Search for the Plugin class definition and its constructor
rg "class Plugin" -A 10 --max-count 5Repository: tsparticles/cli
Length of output: 1369
🏁 Script executed:
# Check for changelog, migration docs, or release notes
fd -e md -e txt | xargs rg -l "3\.0\.|breaking|migration|changelog" -i 2>/dev/null | head -20Repository: tsparticles/cli
Length of output: 41
🏁 Script executed:
# Search for references to the Plugin constructor to see the pattern across the codebase
rg "new Plugin\(" -B 2 -A 2Repository: tsparticles/cli
Length of output: 297
Ensure this breaking change is documented in release notes or migration guide.
The Plugin constructor change is correctly implemented in the template code—the engine parameter is removed and the instantiation passes no argument, matching the plugin.ts signature. However, this breaking change appears to lack documentation: no changelog, migration guide, or release notes entry was found in the repository explaining the change or migration path for users upgrading to this version.
🤖 Prompt for AI Agents
In files/create-plugin/src/index.ts around line 9, the change removing the
engine parameter from the Plugin constructor is not documented for users; add a
concise release-notes/changelog and/or migration-guide entry describing the
breaking change, show the old instantiation pattern (new Plugin(engine)) and the
new one (new Plugin()), include any rationale and migration steps (how to obtain
engine now or refactor callers), and update the repository's template/README or
upgrade notes so users upgrading to this version see the required changes.
| async getPlugin(/*container: Container*/): Promise<PluginInstance> { | ||
| const { PluginInstance } = await import("./PluginInstance.js"); | ||
|
|
||
| return new PluginInstance(container, this._engine); | ||
| return new PluginInstance(/*container, this._engine*/); | ||
| } |
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.
🧩 Analysis chain
🏁 Script executed:
# Search for IPlugin interface definition
find . -type f \( -name "*.ts" -o -name "*.d.ts" \) | head -20Repository: tsparticles/cli
Length of output: 684
🏁 Script executed:
# Search for IPlugin interface
rg -A 10 "interface IPlugin" --type ts --type-listRepository: tsparticles/cli
Length of output: 448
🏁 Script executed:
# Look for imports and IPlugin references in the plugin.ts file
cat -n files/create-plugin/src/plugin.tsRepository: tsparticles/cli
Length of output: 1297
🏁 Script executed:
# Search for IPlugin in the entire codebase
rg "interface IPlugin" -A 10Repository: tsparticles/cli
Length of output: 41
🏁 Script executed:
# Search for IPlugin interface in node_modules
find node_modules -path "*/tsparticles/engine*" -name "*.d.ts" -o -name "*.ts" | grep -E "(engine|IPlugin)" | head -20Repository: tsparticles/cli
Length of output: 106
🏁 Script executed:
# Search more broadly in node_modules for IPlugin
rg "interface IPlugin" node_modules --type tsRepository: tsparticles/cli
Length of output: 111
🏁 Script executed:
# Check package.json to understand the dependency
cat package.json | grep -A 2 -B 2 "tsparticles"Repository: tsparticles/cli
Length of output: 812
🏁 Script executed:
# Search for other implementations of IPlugin in the codebase
rg "implements IPlugin"Repository: tsparticles/cli
Length of output: 133
🏁 Script executed:
# Search for other getPlugin implementations
rg "getPlugin" --type ts -B 2 -A 5Repository: tsparticles/cli
Length of output: 554
🌐 Web query:
@tsparticles/engine IPlugin interface getPlugin method signature
💡 Result:
The IPlugin's getPlugin method is synchronous and takes a Container, returning the plugin instance. Example signature from the official type files:
getPlugin(container: Container):
(eg. in EmittersPlugin: getPlugin(container: Container): Emitters). [1][2]
Sources:
- EmittersPlugin d.ts (shows getPlugin(container: Container): Emitters). [1]
- @tsparticles engine type declarations (engine/main d.ts exports IPlugin usage). [2]
References:
[1] https://app.unpkg.com/[email protected]/files/dist/ts4.0/Plugins/Emitters/EmittersPlugin.d.ts
[2] https://app.unpkg.com/[email protected]/files/engine.d.ts
Remove async/Promise wrapper and restore container parameter to match IPlugin interface contract.
The IPlugin interface requires getPlugin(container: Container): PluginInstance (synchronous with container parameter), but the implementation has both removed the container parameter and wrapped the return in an async/Promise, violating the interface contract. The method must be synchronous and accept the container parameter.
🤖 Prompt for AI Agents
In files/create-plugin/src/plugin.ts around lines 17 to 21, the getPlugin
implementation is async and drops the container parameter, violating the IPlugin
contract which expects a synchronous getPlugin(container: Container):
PluginInstance; change the method signature to accept the container parameter
(e.g., getPlugin(container: Container): PluginInstance), remove the
async/Promise wrapper, import PluginInstance synchronously if needed or keep
dynamic import but return the instance directly, and pass the container (and
this._engine if required) into the PluginInstance constructor so the method is
synchronous and matches the interface.
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.
Actionable comments posted: 0
🧹 Nitpick comments (2)
tsconfig.json (2)
15-23: Optional: Remove redundant strict flags.Lines 16-23 are redundant since
"strict": trueon line 15 already enables all of these individual flags:noImplicitAny,strictNullChecks,strictFunctionTypes,strictBindCallApply,strictPropertyInitialization,noImplicitThis,useUnknownInCatchVariables, andalwaysStrict.The flags on lines 24-31 are correctly kept as they are not part of the
strictflag.🔎 Proposed simplification
"compilerOptions": { "rootDir": ".", "outDir": ".", "resolveJsonModule": true, "composite": true, "types": [ "node", "fs-extra", "klaw", "madge", "prompts", "eslint" ], "strict": true, - "noImplicitAny": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "strictBindCallApply": true, - "strictPropertyInitialization": true, - "noImplicitThis": true, - "useUnknownInCatchVariables": true, - "alwaysStrict": true, "noUnusedLocals": true, "noUnusedParameters": true, "exactOptionalPropertyTypes": true, "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, "noUncheckedIndexedAccess": true, "noImplicitOverride": true, "noPropertyAccessFromIndexSignature": true },
3-4: Confirm whether outputting compiled JavaScript alongside source files is intentional.With
rootDir: "."andoutDir: ".", TypeScript will compile source files and place.jsoutput in the same directory structure (e.g.,src/myfile.tsbecomessrc/myfile.js). This pattern is unusual and can clutter source directories.If this is unintentional, consider using
rootDir: "src"andoutDir: "dist"to separate compiled output from source code. If this configuration is deliberate for your monorepo or build setup, confirm and document it.
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
.github/workflows/node.js-ci.yml.mocharc.jsontsconfig.json
💤 Files with no reviewable changes (1)
- .mocharc.json
🚧 Files skipped from review as they are similar to previous changes (1)
- .github/workflows/node.js-ci.yml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: pr
🔇 Additional comments (1)
tsconfig.json (1)
33-37: LGTM! Comprehensive include configuration.The
includeblock appropriately covers all relevant directories (src,tests, andfiles), ensuring TypeScript compilation and type-checking are applied across the entire codebase.
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.
Actionable comments posted: 1
🧹 Nitpick comments (2)
tsconfig.json (2)
10-22: Consider simplifying the lib array.When
"ESNext"is included, it implicitly encompasses all prior ES versions (ES2024, ES2023, etc.). The additional entries are redundant and could be simplified to just["ESNext"].🔎 Suggested simplification
"lib": [ - "ESNext", - "ES2024", - "ES2023", - "ES2022", - "ES2021", - "ES2020", - "ES2019", - "ES2018", - "ES2017", - "ES2016", - "ES2015" + "ESNext" ],
32-48: Redundant strict flags when"strict": trueis set.Setting
"strict": truealready enables all the individual strict-mode flags (noImplicitAny,strictNullChecks,strictFunctionTypes,strictBindCallApply,strictPropertyInitialization,noImplicitThis,useUnknownInCatchVariables,alwaysStrict). The explicit flags on lines 33-40 are redundant.However, I understand keeping them explicit can serve as documentation or guard against future changes to what
strictincludes. This is purely a stylistic choice.
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
src/tsconfig.jsontests/tsconfig.jsontsconfig.eslint.jsontsconfig.json
💤 Files with no reviewable changes (1)
- tsconfig.eslint.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: pr
🔇 Additional comments (3)
tsconfig.json (1)
2-55: Well-structured base configuration with comprehensive strictness.The configuration correctly sets up:
"composite": truefor project references"moduleResolution": "NodeNext"which is appropriate for modern Node.js projects- Strong type-checking with additional flags like
noUncheckedIndexedAccessandexactOptionalPropertyTypessrc/tsconfig.json (1)
2-8: Clean extension pattern for source configuration.The configuration properly extends the root config, overrides only the necessary paths (
rootDir,outDir), and includes all source files. This is a clean and maintainable approach.tests/tsconfig.json (1)
2-12: Well-configured test project setup.The configuration correctly:
- Extends the base config for consistent compiler settings
- Overrides
targettoES2021for test runtime compatibility- Disables
declarationgeneration (unnecessary for tests)- References
../srcestablishing the correct build dependency- Sets
importHelpers: falseto avoid tslib dependency in tests
| "outDir": "../dist" | ||
| }, | ||
| "references": [{ "path": "../" }] | ||
| "references": [{ "path": "../" }], |
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.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check if there are any other tsconfig files at root level that might justify this reference
echo "=== Root-level tsconfig files ==="
fd -d 1 'tsconfig.*\.json$' .
echo -e "\n=== Root tsconfig.json include/exclude/files ==="
cat tsconfig.json | jq '.include, .exclude, .files'
echo -e "\n=== src/tsconfig.json full config ==="
cat src/tsconfig.jsonRepository: tsparticles/cli
Length of output: 410
Remove the project reference to the root directory.
The root tsconfig.json is a base configuration file (indicated by its include: ["src/**/*"] and the src/tsconfig.json extending it), not a separate project. The references field in src/tsconfig.json should not include { "path": "../" } because:
extendsandreferencesserve different purposes:extendsis for config inheritance, whilereferencesdeclares project dependencies- There is no project to build at the root level—it only includes src files which belong to the src project itself
- This creates a confusing and potentially problematic circular-like relationship
Delete the references line from src/tsconfig.json entirely.
🤖 Prompt for AI Agents
In src/tsconfig.json around line 7, remove the project reference entry
{"path":"../"} from the "references" array — the src config extends the root
base config and should not declare the root as a referenced project; delete the
entire "references" line (or the array entry) so src/tsconfig.json no longer
references the root directory.
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.
Actionable comments posted: 6
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
tests/create-plugin.test.tstests/create-preset.test.tstests/create-shape.test.ts
🧰 Additional context used
🧬 Code graph analysis (3)
tests/create-shape.test.ts (1)
src/create/shape/create-shape.ts (1)
createShapeTemplate(167-190)
tests/create-plugin.test.ts (1)
src/create/plugin/create-plugin.ts (1)
createPluginTemplate(162-184)
tests/create-preset.test.ts (1)
src/create/preset/create-preset.ts (1)
createPresetTemplate(180-204)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: pr
| try { | ||
| await createPluginTemplate("foo", "Foo", "", destDir); | ||
| } catch (e) { | ||
| console.error(e); | ||
| } |
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.
Tests should fail when template creation fails.
Wrapping createPluginTemplate in a try/catch that only logs errors will cause the test to continue and potentially pass even when the core functionality fails. This defeats the purpose of the test and can mask real issues.
Remove the try/catch and let failures propagate naturally.
🔎 Proposed fix
- try {
- await createPluginTemplate("foo", "Foo", "", destDir);
- } catch (e) {
- console.error(e);
- }
+ await createPluginTemplate("foo", "Foo", "", destDir);📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| try { | |
| await createPluginTemplate("foo", "Foo", "", destDir); | |
| } catch (e) { | |
| console.error(e); | |
| } | |
| await createPluginTemplate("foo", "Foo", "", destDir); |
🤖 Prompt for AI Agents
In tests/create-plugin.test.ts around lines 11 to 15, the test wraps
createPluginTemplate in a try/catch that only logs errors which suppresses
failures; remove the try/catch so that any error thrown by createPluginTemplate
propagates and fails the test, ensuring the test fails on template creation
errors.
| try { | ||
| await createPluginTemplate("bar", "Bar", "https://github.com/matteobruni/tsparticles", destDir); | ||
| } catch (e) { | ||
| console.error(e); | ||
| } |
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.
Tests should fail when template creation fails.
Same issue: the try/catch prevents test failures when createPluginTemplate throws, allowing the test to pass incorrectly.
🔎 Proposed fix
- try {
- await createPluginTemplate("bar", "Bar", "https://github.com/matteobruni/tsparticles", destDir);
- } catch (e) {
- console.error(e);
- }
+ await createPluginTemplate("bar", "Bar", "https://github.com/matteobruni/tsparticles", destDir);🤖 Prompt for AI Agents
In tests/create-plugin.test.ts around lines 27 to 31, the test wraps
createPluginTemplate in a try/catch and logs errors, which masks failures;
remove the try/catch so exceptions propagate (or replace with an assertion,
e.g., await expect(createPluginTemplate(...)).resolves.toBeUndefined() /
.rejects.toThrow(...) as appropriate) so the test fails when template creation
throws; ensure no console.error swallow is left.
| try { | ||
| await createPresetTemplate("foo", "Foo", "", destDir); | ||
| } catch (e) { | ||
| console.error(e); | ||
| } |
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.
Tests should fail when template creation fails.
Wrapping createPresetTemplate in a try/catch that only logs errors will cause the test to pass even when preset creation fails. The test will continue to run assertions that may pass for the wrong reasons (e.g., stale files from previous runs).
Remove the try/catch to ensure proper test failure propagation.
🔎 Proposed fix
- try {
- await createPresetTemplate("foo", "Foo", "", destDir);
- } catch (e) {
- console.error(e);
- }
+ await createPresetTemplate("foo", "Foo", "", destDir);📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| try { | |
| await createPresetTemplate("foo", "Foo", "", destDir); | |
| } catch (e) { | |
| console.error(e); | |
| } | |
| await createPresetTemplate("foo", "Foo", "", destDir); |
🤖 Prompt for AI Agents
In tests/create-preset.test.ts around lines 10 to 14, the test wraps the
createPresetTemplate call in a try/catch that only logs errors, preventing
failures from bubbling up; remove the try/catch and call await
createPresetTemplate("foo", "Foo", "", destDir) directly so any thrown errors
cause the test to fail (let the test framework propagate the exception).
| try { | ||
| await createPresetTemplate("bar", "Bar", "https://github.com/matteobruni/tsparticles", destDir); | ||
| } catch (e) { | ||
| console.error(e); | ||
| } |
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.
Tests should fail when template creation fails.
Same issue: catching and only logging errors from createPresetTemplate prevents the test from failing when it should, undermining test reliability.
🔎 Proposed fix
- try {
- await createPresetTemplate("bar", "Bar", "https://github.com/matteobruni/tsparticles", destDir);
- } catch (e) {
- console.error(e);
- }
+ await createPresetTemplate("bar", "Bar", "https://github.com/matteobruni/tsparticles", destDir);📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| try { | |
| await createPresetTemplate("bar", "Bar", "https://github.com/matteobruni/tsparticles", destDir); | |
| } catch (e) { | |
| console.error(e); | |
| } | |
| await createPresetTemplate("bar", "Bar", "https://github.com/matteobruni/tsparticles", destDir); |
🤖 Prompt for AI Agents
In tests/create-preset.test.ts around lines 27 to 31, the test is swallowing
errors by catching and only logging them; remove the try/catch (or rethrow the
caught error after logging) so that any failure in createPresetTemplate causes
the test to fail. Update the block to let the promise rejection/error propagate
(or rethrow) instead of just console.error, ensuring test runner detects the
failure.
| try { | ||
| await createShapeTemplate("foo", "Foo", "", destDir); | ||
| } catch (e) { | ||
| console.error(e); | ||
| } |
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.
Tests should fail when template creation fails.
Wrapping createShapeTemplate in a try/catch block that only logs the error will cause the test to pass even if template creation fails. The subsequent assertions will run regardless, potentially passing if the directory exists from a previous run or failing with an unrelated error if it doesn't.
Remove the try/catch and allow failures to propagate, or explicitly fail the test when an error is caught.
🔎 Proposed fix
- try {
- await createShapeTemplate("foo", "Foo", "", destDir);
- } catch (e) {
- console.error(e);
- }
+ await createShapeTemplate("foo", "Foo", "", destDir);📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| try { | |
| await createShapeTemplate("foo", "Foo", "", destDir); | |
| } catch (e) { | |
| console.error(e); | |
| } | |
| await createShapeTemplate("foo", "Foo", "", destDir); |
🤖 Prompt for AI Agents
In tests/create-shape.test.ts around lines 10 to 14, the test swallows errors
from createShapeTemplate by catching and only logging them, which masks
failures; remove the try/catch so exceptions propagate and fail the test, or if
you prefer explicit handling, replace the catch with a rethrow or call to
fail/assert.fail with the caught error so the test fails when template creation
fails.
| try { | ||
| await createShapeTemplate("bar", "Bar", "https://github.com/matteobruni/tsparticles", destDir); | ||
| } catch (e) { | ||
| console.error(e); | ||
| } |
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.
Tests should fail when template creation fails.
Same issue as the first test case: wrapping createShapeTemplate in a try/catch that only logs errors will cause false positives. The test should fail immediately if template creation fails.
🔎 Proposed fix
- try {
- await createShapeTemplate("bar", "Bar", "https://github.com/matteobruni/tsparticles", destDir);
- } catch (e) {
- console.error(e);
- }
+ await createShapeTemplate("bar", "Bar", "https://github.com/matteobruni/tsparticles", destDir);📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| try { | |
| await createShapeTemplate("bar", "Bar", "https://github.com/matteobruni/tsparticles", destDir); | |
| } catch (e) { | |
| console.error(e); | |
| } | |
| await createShapeTemplate("bar", "Bar", "https://github.com/matteobruni/tsparticles", destDir); |
🤖 Prompt for AI Agents
In tests/create-shape.test.ts around lines 27 to 31, the test wraps
createShapeTemplate in a try/catch that only logs errors which hides failures
and yields false positives; remove the try/catch so the thrown error propagates
(or rethrow the caught error / use await
expect(createShapeTemplate(...)).resolves/rejects as appropriate) so the test
will fail when template creation fails.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.