- 
                Notifications
    
You must be signed in to change notification settings  - Fork 1
 
fix: broken e2e tests #1391
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: broken e2e tests #1391
Conversation
          Summary of ChangesHello @janb87, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request focuses on enhancing the reliability of end-to-end tests. It addresses dependency management by enforcing a hoisted linker strategy for  Highlights
 Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either  
 Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a  Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
  | 
    
| 
          
 To view in Slack, search for: 1761641080.660299  | 
    
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.
Hey there - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `test/create-new-standalone-project.e2e.test.ts:127` </location>
<code_context>
     await updatePackageJsonToUseLinkedDependencies(dAppDir);
     await updatePackageJsonToUseLinkedDependencies(contractsDir);
     await updatePackageJsonToUseLinkedDependencies(subgraphDir);
-    await $`bun install --no-cache`.cwd(projectDir).env(env);
+    await $`bun install --no-cache --linker=hoisted`.cwd(projectDir).env(env);
   });
</code_context>
<issue_to_address>
**suggestion (testing):** Consider adding assertions to verify successful installation after changing the linker.
Please add assertions to confirm that all dependencies are present and correctly installed after using the hoisted linker.
Suggested implementation:
```typescript
    await $`bun install --no-cache --linker=hoisted`.cwd(projectDir).env(env);
    // Assert that node_modules exists and key dependencies are installed
    const fs = require("fs");
    const path = require("path");
    const nodeModulesPath = path.join(projectDir, "node_modules");
    expect(fs.existsSync(nodeModulesPath)).toBe(true);
    // Check for a few expected dependencies (replace with actual dependencies as needed)
    const expectedDeps = ["bun", "typescript"];
    for (const dep of expectedDeps) {
      const depPath = path.join(nodeModulesPath, dep);
      expect(fs.existsSync(depPath)).toBe(true);
    }
  });
```
- You may need to adjust the `expectedDeps` array to match the actual dependencies your project installs.
- If your test environment uses ES modules, replace `require` with `import` statements.
- Ensure that the test runner has access to the `fs` and `path` modules.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
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.
Code Review
This pull request aims to fix broken end-to-end tests. The changes include adding the --linker=hoisted flag to bun install commands, which is a reasonable fix for dependency issues. Another change involves correctly identifying a blockchain node by its unique name instead of a display name in the restart test. While this logic is correct, it introduces a duplicated helper function in test/restart-resources.e2e.test.ts. I've left comments suggesting how to resolve this duplication to improve code maintainability, along with a note on an unused import.
          📦 Packages
  | 
    
| 
          
 Caution Review failedThe pull request is closed. 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. 📝 WalkthroughWalkthroughAdds the Bun installer flag  Possibly related PRs
 Pre-merge checks❌ Failed checks (1 warning)
 ✅ Passed checks (2 passed)
 📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro Disabled knowledge base sources: 
 
 📒 Files selected for processing (1)
 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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
 - Mark a draft as ready
 - Comment "@codex review".
 
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
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
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
 
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (3)
test/create-new-settlemint-project.e2e.test.ts(1 hunks)test/create-new-standalone-project.e2e.test.ts(1 hunks)test/restart-resources.e2e.test.ts(3 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx}: Do not use default exports in TypeScript (except when a framework requires it)
Useimport typefor type-only imports in TypeScript
Prefer interfaces over type aliases for object shapes
Never useany; useunknownor proper types instead
Use discriminated unions for error handling
File names should be kebab-case
Use camelCase for variable and function names
Use PascalCase for types, interfaces, and classes
Use UPPER_SNAKE_CASE for constants
Prefer nullish coalescing (??) over logical OR (||)
Use early returns to reduce nesting
Extract complex logic into well-named functions
Keep functions small and focused
Use structured logging with proper context
**/*.{ts,tsx}: Inside generic functions, using any for concise type narrowing is acceptable; outside of generics, use any extremely sparingly
Avoid default exports unless explicitly required by the framework (e.g., Next.js pages)
Use discriminated unions to model variant data and avoid 'bag of optionals'
Handle discriminated unions with switch statements over the discriminant
Do not introduce new enums; prefer as const objects for enum-like behavior; retain existing enums
Use top-level import type when importing types instead of inline import { type ... }
Prefer interface extends over intersection types (&) for modeling inheritance; use & only when extends is not possible
Use JSDoc comments to annotate functions and types when behavior isn’t obvious; keep comments concise
Use JSDoc inline @link to reference related functions and types within the same file
File names should be kebab-case (e.g., my-component.ts)
Use camelCase for variables and function names
Use UpperCamelCase (PascalCase) for classes, types, and interfaces
Use ALL_CAPS for constants (and enum values where enums already exist)
Prefix generic type parameters with T (e.g., TKey, TValue)
Be mindful of noUncheckedIndexedAccess: treat indexed object/array access as possibly undefined
Use optional properties sparingly; prefer required prop...
Files:
test/create-new-settlemint-project.e2e.test.tstest/create-new-standalone-project.e2e.test.tstest/restart-resources.e2e.test.ts
**/*.{test,spec}.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{test,spec}.{ts,tsx}: Write unit tests using Vitest
Mock external API calls in tests
Test error scenarios explicitly
Files:
test/create-new-settlemint-project.e2e.test.tstest/create-new-standalone-project.e2e.test.tstest/restart-resources.e2e.test.ts
test/**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
Create end-to-end tests for CLI commands
Files:
test/create-new-settlemint-project.e2e.test.tstest/create-new-standalone-project.e2e.test.tstest/restart-resources.e2e.test.ts
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/bun.mdc)
Use
Bun.File()for file reading and writing
Files:
test/create-new-settlemint-project.e2e.test.tstest/create-new-standalone-project.e2e.test.tstest/restart-resources.e2e.test.ts
🧬 Code graph analysis (1)
test/restart-resources.e2e.test.ts (3)
test/utils/test-resources.ts (1)
findBlockchainNodeByName(32-37)sdk/utils/src/validation/dot-env.schema.ts (1)
DotEnv(112-112)sdk/js/src/settlemint.ts (1)
createSettleMintClient(275-426)
🪛 Biome (2.1.2)
test/restart-resources.e2e.test.ts
[error] 8-8: This import is unused.
Unused imports might be the result of an incomplete refactoring.
Unsafe fix: Remove the unused imports.
(lint/correctness/noUnusedImports)
⏰ 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). (5)
- GitHub Check: QA
 - GitHub Check: cubic · AI code reviewer
 - GitHub Check: E2E
 - GitHub Check: Sourcery review
 - GitHub Check: QA
 
🔇 Additional comments (3)
test/create-new-settlemint-project.e2e.test.ts (1)
80-80: LGTM: Hoisted linker flag aligns with local SDK linking.The
--linker=hoistedflag ensures a flat dependency structure, which is appropriate when linking local SDK packages.test/create-new-standalone-project.e2e.test.ts (1)
127-127: LGTM: Consistent hoisted linker flag.This matches the change in
test/create-new-settlemint-project.e2e.test.tsand ensures consistent behavior across test files.test/restart-resources.e2e.test.ts (1)
20-28: Dynamic node lookup improves test reliability.The change from a hardcoded constant to dynamically looking up the node by name and using its
uniqueNamemakes the test more robust. The error handling for missing nodes is appropriate.
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.
1 issue found across 3 files
Prompt for AI agents (all 1 issues)
Understand the root cause of the following 1 issues and fix them.
<file name="test/restart-resources.e2e.test.ts">
<violation number="1" location="test/restart-resources.e2e.test.ts:44">
Use the E2E-specific access token environment variable for authentication in tests to avoid targeting the wrong environment. Prefer reusing the shared client setup helper or switch this line to the E2E token.</violation>
</file>
React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.
| "restart", | ||
| "blockchain-node", | ||
| NODE_NAME_3_WITHOUT_PK, | ||
| blockchainNode.uniqueName, | 
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.
Summary by Sourcery
Use dynamic node lookup and hoisted bun linker in e2e tests to fix broken tests
Bug Fixes:
--linker=hoistedfor correct dependency installationNote
Switches Bun installs to the hoisted linker and resolves the blockchain node dynamically in e2e tests.
bun install --no-cache --linker=hoistedintest/create-new-settlemint-project.e2e.test.tsandtest/create-new-standalone-project.e2e.test.ts.test/restart-resources.e2e.test.ts, resolve blockchain node viafindBlockchainNodeByNameand passblockchainNode.uniqueNametoplatform restart, with a not-found guard.Written by Cursor Bugbot for commit 245d6fc. This will update automatically on new commits. Configure here.