Skip to content

Revert "Umutuzgur/sc 23256/pwt native code package simple" #1064

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

Merged

Conversation

umutuzgur
Copy link
Member

Reverts #1042

Copy link

coderabbitai bot commented May 15, 2025

Walkthrough

This change removes all Playwright-specific code, constructs, configuration handling, bundling utilities, and related test fixtures from the CLI project. It eliminates PlaywrightCheck, PlaywrightConfig, related dependencies, and all associated logic from commands, services, utilities, and tests. The parser and config loader are refactored to remove Playwright awareness, simplifying their interfaces and implementations.

Changes

Files/Groups Change Summary
.github/workflows/release-canary.yml Refactored canary tag extraction and npm publish conditions to use simpler shell and GitHub Actions variable syntax.
packages/cli/package.json Removed dependencies: @types/archiver, archiver, and minimatch.
packages/cli/src/commands/deploy.ts, packages/cli/src/commands/test.ts Removed all PlaywrightCheck-related logic, imports, and config handling from deploy and test commands.
packages/cli/src/constructs/index.ts, packages/cli/src/constructs/playwright-check.ts Removed export and deleted file for PlaywrightCheck construct and its interface.
packages/cli/src/reporters/list.ts Adjusted URL formatting for test/video links in ListReporter.
packages/cli/src/rest/checkly-storage.ts Removed uploadCodeBundle method from ChecklyStorage.
packages/cli/src/services/__tests__/fixtures/playwright-configs/simple-config-no-browsers.ts,
packages/cli/src/services/__tests__/fixtures/playwright-configs/simple-config.ts,
packages/cli/src/services/check-parser/__tests__/check-parser-fixtures/playwright-project-snapshots/playwright.config.ts,
packages/cli/src/services/check-parser/__tests__/check-parser-fixtures/playwright-project-snapshots/tests/example.spec.ts,
packages/cli/src/services/check-parser/__tests__/check-parser-fixtures/playwright-project/playwright.config.ts,
packages/cli/src/services/check-parser/__tests__/check-parser-fixtures/playwright-project/tests/example.spec.ts
Deleted Playwright config and test fixture files.
packages/cli/src/services/__tests__/playwright-config.spec.ts Deleted PlaywrightConfig test suite.
packages/cli/src/services/check-parser/__tests__/parse-files.spec.ts Refactored and expanded tests to remove PlaywrightConfig dependency and add comprehensive parser tests for various file/dependency scenarios.
packages/cli/src/services/check-parser/package-files/resolver.ts Disabled ESLint no-labels rule at top of file.
packages/cli/src/services/check-parser/parser.ts Refactored Parser to remove PlaywrightConfig dependency; now accepts array of paths, simplifies file/dependency discovery, and removes related helper methods.
packages/cli/src/services/checkly-config-loader.ts Simplified config loader by inlining logic, removing Playwright config handling, auxiliary helpers, and unused utilities.
packages/cli/src/services/playwright-config.ts Deleted file containing PlaywrightConfig and PlaywrightProject classes and utilities.
packages/cli/src/services/project-parser.ts Removed all Playwright check handling, related types, and helper functions from project parsing.
packages/cli/src/services/util.ts Removed Playwright-related utilities: bundling, file loading, regex file finding, cleanup, and default config helpers.

Possibly related PRs

  • checkly/checkly-cli#1050: Refactored the Parser class's getFilesAndDependencies method to accept arrays of file or directory paths, which is directly expanded upon in this PR's parser refactor.
  • checkly/checkly-cli#1055: Modified the GitHub Actions canary release workflow, which is further streamlined in this PR.
  • checkly/checkly-cli#1042: Introduced Playwright support and constructs, which this PR now removes, making them directly and inversely related.

Note

⚡️ AI Code Reviews for VS Code, Cursor, Windsurf

CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
Learn more here.


Note

⚡️ Faster reviews with caching

CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.
Enjoy the performance boost—your workflow just got faster.

✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@umutuzgur umutuzgur enabled auto-merge (squash) May 15, 2025 14:26
@umutuzgur umutuzgur requested a review from ferrandiaz May 15, 2025 14:27
coderabbitai[bot]
coderabbitai bot previously requested changes May 15, 2025
Copy link

@coderabbitai coderabbitai bot left a 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

🔭 Outside diff range comments (3)
packages/cli/src/services/checkly-config-loader.ts (2)

10-10: ⚠️ Potential issue

Remove orphaned PlaywrightConfig import – the module was deleted

playwright-config.ts and the PlaywrightConfig type were removed in this PR, yet the import statement is still present.
This will produce a hard-failure at compile time:

Cannot find module '../constructs/playwright-config'

Please delete the stale import.

-import { PlaywrightConfig } from '../constructs/playwright-config'

42-60: ⚠️ Potential issue

Delete obsolete playwrightConfig field from ChecklyConfig

The ChecklyConfig interface still exposes an optional playwrightConfig?: PlaywrightConfig property and accompanying JSDoc, but PlaywrightConfig no longer exists.
Keeping this reference also breaks the type-checker once the dangling import above is removed.

-    playwrightConfig?: PlaywrightConfig,

Make sure to prune the surrounding JSDoc block as well.
If you plan to re-introduce Playwright support later, re-add the field then.

packages/cli/src/commands/test.ts (1)

345-347: ⚠️ Potential issue

Broken template-literal concatenation results in incorrect error message & potential runtime crash

The three concatenated literals mix single quotes and back-ticks.

  1. The back-ticked fragment on L346 is never closed, so the code will not compile.
  2. Even if it did, the two single-quoted fragments would not interpolate ${…} placeholders, printing them verbatim.
-throw new Error('Both runLocation and privateRunLocation fields were set in your Checkly config file.' +
-  ` Please only specify one run location. The configured locations were' +
-  ' "${configOptions.runLocation}" and "${configOptions.privateRunLocation}"`)
+throw new Error(
+  `Both runLocation and privateRunLocation fields were set in your Checkly config file. ` +
+  `Please only specify one run location. The configured locations were ` +
+  `"${configOptions.runLocation}" and "${configOptions.privateRunLocation}".`,
+)
🧹 Nitpick comments (11)
packages/cli/src/services/check-parser/package-files/resolver.ts (1)

1-1: Avoid disabling the no-labels rule globally
The file‐level /* eslint-disable no-labels */ silences all label warnings, but you only have one labeled statement (resolve:) in this file. It's better to remove the global disable and instead scope it to that single occurrence to minimize lint suppression.

Proposed diff:

-/* eslint-disable no-labels */

   // ... other code ...

-    resolve:
+    // eslint-disable-next-line no-labels
+    resolve:
.github/workflows/release-canary.yml (2)

22-30: Simplify canary tag extraction with step-level if and GitHub context
You can eliminate the shell workaround and directly use Actions expressions to check for the canary: prefix and strip it in one go.

-      - name: Extract dynamic value from canary label
-        id: extract-canary
-        run: |
-          if [[ "${GITHUB_EVENT_LABEL_NAME}" == canary:* ]]; then
-            CANARY_TAG="${GITHUB_EVENT_LABEL_NAME#canary:}"
-            echo "CANARY_TAG=${CANARY_TAG}" >> $GITHUB_ENV
-          fi
-        env:
-          GITHUB_EVENT_LABEL_NAME: ${{ github.event.label.name }}
+      - name: Extract canary tag
+        if: ${{ startsWith(github.event.label.name, 'canary:') }}
+        run: echo "CANARY_TAG=${{ github.event.label.name | replace('canary:', '') }}" >> $GITHUB_ENV

This reduces complexity and leverages built-in expression functions.


39-41: Decouple dist-tag addition into its own step using step-level if
Splitting the npm dist-tag add into a separate step with its own if condition improves readability and makes the intent clearer:

-      - run: |
-          npm publish --workspace packages/cli --tag experimental
-           if [[ -n "${{ env.CANARY_TAG }}" ]]; then
-             npm dist-tag add checkly@${{ env.PR_VERSION }} ${{ env.CANARY_TAG }}
-           fi
+      - run: npm publish --workspace packages/cli --tag experimental
+
+      - name: Add canary dist-tag
+        if: ${{ env.CANARY_TAG != '' }}
+        run: npm dist-tag add checkly@${{ env.PR_VERSION }} ${{ env.CANARY_TAG }}

This isolates the conditional logic and leverages Actions’ built-in if.

packages/cli/src/reporters/list.ts (2)

45-53: Consider colouring each URL individually to preserve readability

The new implementation applies chalk.underline.cyan to the whole comma-separated string:

chalk.underline.cyan(links.testTraceLinks.join(', '))

When several links are printed this turns the entire line blue, which can be hard to scan and makes it impossible to ⌘-click a single URL in some terminals.
The previous map(link => chalk.underline.cyan(link)).join(', ') approach kept the benefits of colour & underline while preserving distinct URLs.

-printLn(indentString('View trace : ' + chalk.underline.cyan(links.testTraceLinks.join(', ')), 4))
+printLn(
+  indentString(
+    'View trace : ' + links.testTraceLinks.map(l => chalk.underline.cyan(l)).join(', '),
+    4,
+  ),
+)

Same applies to videoLinks below.
If you decide to keep the current style, please remove the superfluous template literal wrappers (\${links.testResultLink}`` etc.) as they do not add value.


79-87: Duplication – extract helper to avoid divergence

The three print blocks for result, trace, and video are duplicated in both onCheckAttemptResult and onCheckEnd. Any future tweak will have to be done in two places and risks drifting.

A tiny helper would remove the repetition and guarantee identical formatting:

function printLinks (links: TestResultsShortLinks) {
  printLn(indentString(`View result: ${chalk.underline.cyan(links.testResultLink)}`, 4))
  if (links.testTraceLinks?.length)
    printLn(indentString(`View trace : ${links.testTraceLinks.map(l => chalk.underline.cyan(l)).join(', ')}`, 4))
  if (links.videoLinks?.length)
    printLn(indentString(`View video : ${links.videoLinks.map(l => chalk.underline.cyan(l)).join(', ')}`, 4))
  printLn('')
}

This keeps both call-sites lean and guarantees consistency.

packages/cli/src/services/project-parser.ts (2)

121-128: Avoid “unused variable” lint noise when instantiating checks

browserCheck is created only for its side-effects (the constructor registers itself with the current Project).
Assigning it to a constant that is never used will trigger @typescript-eslint/no-unused-vars in many setups.

-const browserCheck = new BrowserCheck(pathToPosix(relPath), {
-  name: path.basename(checkFile),
-  code: { entrypoint: checkFile },
-})
+new BrowserCheck(pathToPosix(relPath), {
+  name: path.basename(checkFile),
+  code: { entrypoint: checkFile },
+})

Do the same for multistepCheck later in the file.


153-158: Same “unused variable” issue as above

Replicate the in-place instantiation pattern for MultiStepCheck to keep the linter quiet.

packages/cli/src/services/check-parser/parser.ts (1)

182-202: Implementation refactored to handle direct file paths.

The refactored implementation effectively handles file paths, directories, and glob patterns without Playwright-specific logic. It's more straightforward and focused.

However, consider adding more explicit error handling for invalid paths that aren't glob patterns.

 private async getFilesFromPaths (paths: string[]): Promise<string[]> {
   const files = paths.map(async (currPath) => {
     const normalizedPath = pathToPosix(currPath)
     try {
       const stats = await fsAsync.lstat(normalizedPath)
       if (stats.isDirectory()) {
         return findFilesWithPattern(normalizedPath, '**/*.{js,ts,mjs}', [])
       }
       return [normalizedPath]
     } catch (err) {
       if (normalizedPath.includes('*') || normalizedPath.includes('?') || normalizedPath.includes('{')) {
         return findFilesWithPattern(process.cwd(), normalizedPath, [])
-      } else {
+      } else {
+        console.warn(`Path not found: ${normalizedPath}`)
         return []
       }
     }
   })

   const filesArray = await Promise.all(files)
   return filesArray.flat()
 }
packages/cli/src/commands/test.ts (2)

200-209: Shadowed variable name hampers readability

Inside the .filter() chain you reuse the identifier tags for the lambda parameter, shadowing the outer tags array you build.
Consider renaming the callback parameter to checkTags (or similar) to avoid confusion and aid debugging.


226-231: Snapshot upload happens serially – consider batching

Uploading snapshots one check at a time can be slow for large projects.
If uploadSnapshots supports bulk input, gather all rawSnapshots first and make a single call, then distribute results to each check.

packages/cli/src/services/check-parser/__tests__/parse-files.spec.ts (1)

35-48: DRY violation – identical toAbsolutePath() helpers

Every test re-declares the same helper. Extract a shared utility (e.g., fixturesPath() in a setup.ts) or declare it once in the outer describe block.

This will shorten tests and avoid accidental divergence when paths change.

Also applies to: 72-85, 91-158

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c4176cb and 417771f.

⛔ Files ignored due to path filters (2)
  • package-lock.json is excluded by !**/package-lock.json
  • packages/cli/src/services/check-parser/__tests__/check-parser-fixtures/playwright-project-snapshots/tests/example.spec.ts-snapshots/Google-test-1-Mobile-Chrome-linux.png is excluded by !**/*.png
📒 Files selected for processing (22)
  • .github/workflows/release-canary.yml (2 hunks)
  • packages/cli/package.json (0 hunks)
  • packages/cli/src/commands/deploy.ts (1 hunks)
  • packages/cli/src/commands/test.ts (1 hunks)
  • packages/cli/src/constructs/index.ts (0 hunks)
  • packages/cli/src/constructs/playwright-check.ts (0 hunks)
  • packages/cli/src/reporters/list.ts (2 hunks)
  • packages/cli/src/rest/checkly-storage.ts (0 hunks)
  • packages/cli/src/services/__tests__/fixtures/playwright-configs/simple-config-no-browsers.ts (0 hunks)
  • packages/cli/src/services/__tests__/fixtures/playwright-configs/simple-config.ts (0 hunks)
  • packages/cli/src/services/__tests__/playwright-config.spec.ts (0 hunks)
  • packages/cli/src/services/check-parser/__tests__/check-parser-fixtures/playwright-project-snapshots/playwright.config.ts (0 hunks)
  • packages/cli/src/services/check-parser/__tests__/check-parser-fixtures/playwright-project-snapshots/tests/example.spec.ts (0 hunks)
  • packages/cli/src/services/check-parser/__tests__/check-parser-fixtures/playwright-project/playwright.config.ts (0 hunks)
  • packages/cli/src/services/check-parser/__tests__/check-parser-fixtures/playwright-project/tests/example.spec.ts (0 hunks)
  • packages/cli/src/services/check-parser/__tests__/parse-files.spec.ts (1 hunks)
  • packages/cli/src/services/check-parser/package-files/resolver.ts (1 hunks)
  • packages/cli/src/services/check-parser/parser.ts (5 hunks)
  • packages/cli/src/services/checkly-config-loader.ts (2 hunks)
  • packages/cli/src/services/playwright-config.ts (0 hunks)
  • packages/cli/src/services/project-parser.ts (2 hunks)
  • packages/cli/src/services/util.ts (1 hunks)
💤 Files with no reviewable changes (12)
  • packages/cli/src/rest/checkly-storage.ts
  • packages/cli/src/services/check-parser/tests/check-parser-fixtures/playwright-project-snapshots/tests/example.spec.ts
  • packages/cli/src/services/tests/playwright-config.spec.ts
  • packages/cli/package.json
  • packages/cli/src/services/check-parser/tests/check-parser-fixtures/playwright-project/playwright.config.ts
  • packages/cli/src/services/check-parser/tests/check-parser-fixtures/playwright-project-snapshots/playwright.config.ts
  • packages/cli/src/services/tests/fixtures/playwright-configs/simple-config-no-browsers.ts
  • packages/cli/src/services/tests/fixtures/playwright-configs/simple-config.ts
  • packages/cli/src/services/check-parser/tests/check-parser-fixtures/playwright-project/tests/example.spec.ts
  • packages/cli/src/constructs/index.ts
  • packages/cli/src/constructs/playwright-check.ts
  • packages/cli/src/services/playwright-config.ts
🧰 Additional context used
🧬 Code Graph Analysis (3)
packages/cli/src/reporters/list.ts (1)
packages/cli/src/reporters/util.ts (1)
  • printLn (459-461)
packages/cli/src/services/checkly-config-loader.ts (4)
packages/cli/src/services/__tests__/fixtures/configs/no-export-config.js (1)
  • config (1-4)
packages/cli/src/services/__tests__/fixtures/configs/no-logical-id-config.js (1)
  • config (1-3)
packages/cli/src/constructs/project.ts (1)
  • Session (146-221)
packages/cli/src/services/util.ts (1)
  • loadFile (55-71)
packages/cli/src/services/check-parser/parser.ts (2)
packages/cli/src/services/check-parser/errors.ts (1)
  • DependencyParseError (3-50)
packages/cli/src/services/util.ts (2)
  • pathToPosix (158-163)
  • findFilesWithPattern (267-280)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: test - windows-latest
🔇 Additional comments (6)
packages/cli/src/commands/deploy.ts (1)

14-14: Import list looks good – just confirm tree-shaking

BrowserCheck is now the only construct imported from ../constructs. That matches the remaining snapshot-upload logic below, so the change is correct.
No further action required.

packages/cli/src/services/project-parser.ts (1)

2-2: 👍 Cross-platform paths

Adding pathToPosix to the util import set is a solid move; it guarantees POSIX-style slashes in logical IDs regardless of host OS.

packages/cli/src/services/util.ts (1)

267-271: LGTM - Signature consistent with function implementation.

The ignorePattern parameter is properly used in the glob function call, making the signature consistent with its implementation.

packages/cli/src/services/check-parser/parser.ts (3)

132-133: API signature simplified by removing Playwright dependency.

The method now accepts a simple array of file paths instead of a Playwright configuration object, making it more generic and reusable.


141-145: File filtering logic simplified.

The file filtering logic has been simplified to only skip JSON files, removing special handling for Playwright-specific files like snapshots, type declarations, etc.


177-177: Error message updated to match new function signature.

The error message now references the array of paths instead of a Playwright config entrypoint, maintaining consistency with the new function signature.

Comment on lines +61 to +70
it('should parse the cli in less than 400ms', async () => {
const toAbsolutePath = (...filepath: string[]) => path.join(__dirname, '../../../', ...filepath)
const startTimestamp = Date.now().valueOf()
const res = await new Parser({}).getFilesAndDependencies([toAbsolutePath('/index.ts')])
const endTimestamp = Date.now().valueOf()
expect(res.files).not.toHaveLength(0)
expect(res.errors).toHaveLength(0)
const isCI = process.env.CI === 'true'
expect(endTimestamp - startTimestamp).toBeLessThan(isCI ? 2000 : 400)
})
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Hard-coded 400 ms threshold is flaky

Build servers often show higher IO latency. The current fallback of 2 s for CI may still fail on slow runners or when the repo grows.

Recommend either:
• Mocking FS reads and removing the time assertion altogether, or
• Deriving the threshold from file count (e.g., files.length * 5 ms) and adding a generous ceiling.

🤖 Prompt for AI Agents
In packages/cli/src/services/check-parser/__tests__/parse-files.spec.ts around
lines 61 to 70, the test uses a hard-coded 400 ms threshold for parsing time
which is flaky on slower CI environments. To fix this, remove the fixed time
assertion and instead mock the filesystem reads to make the test deterministic,
or calculate the threshold dynamically based on the number of files processed
(e.g., files.length * 5 ms) with an upper limit to allow for variability in
slower environments.

Comment on lines +61 to +66
it('should parse the cli in less than 400ms', async () => {
const toAbsolutePath = (...filepath: string[]) => path.join(__dirname, '../../../', ...filepath)
const startTimestamp = Date.now().valueOf()
const res = await new Parser({}).getFilesAndDependencies([toAbsolutePath('/index.ts')])
const endTimestamp = Date.now().valueOf()
expect(res.files).not.toHaveLength(0)
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Path helper swallows intended base path due to leading “/”

Passing '/index.ts' to path.join() resets the accumulated segments, so the resolved path becomes /<index.ts> instead of the CLI root.
That defeats the purpose of the performance test and may hide regressions.

-const res = await new Parser({}).getFilesAndDependencies([toAbsolutePath('/index.ts')])
+const res = await new Parser({}).getFilesAndDependencies([toAbsolutePath('index.ts')])

Alternatively, use path.resolve(repoRoot, 'index.ts') to be explicit.

📝 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.

Suggested change
it('should parse the cli in less than 400ms', async () => {
const toAbsolutePath = (...filepath: string[]) => path.join(__dirname, '../../../', ...filepath)
const startTimestamp = Date.now().valueOf()
const res = await new Parser({}).getFilesAndDependencies([toAbsolutePath('/index.ts')])
const endTimestamp = Date.now().valueOf()
expect(res.files).not.toHaveLength(0)
it('should parse the cli in less than 400ms', async () => {
const toAbsolutePath = (...filepath: string[]) => path.join(__dirname, '../../../', ...filepath)
const startTimestamp = Date.now().valueOf()
- const res = await new Parser({}).getFilesAndDependencies([toAbsolutePath('/index.ts')])
+ const res = await new Parser({}).getFilesAndDependencies([toAbsolutePath('index.ts')])
const endTimestamp = Date.now().valueOf()
expect(res.files).not.toHaveLength(0)
🤖 Prompt for AI Agents
In packages/cli/src/services/check-parser/__tests__/parse-files.spec.ts around
lines 61 to 66, the path helper function uses a leading slash in '/index.ts'
which causes path.join to ignore the base path and resolve to an absolute path
from root, breaking the intended test setup. Fix this by removing the leading
slash from the file path argument or replace the path.join call with
path.resolve using the repo root and 'index.ts' to correctly resolve the file
path relative to the CLI root.

@umutuzgur umutuzgur merged commit c5a47d6 into main May 15, 2025
4 checks passed
@umutuzgur umutuzgur deleted the revert-1042-umutuzgur/sc-23256/pwt-native-code-package-simple branch May 15, 2025 14:47
ferrandiaz added a commit that referenced this pull request May 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants