Skip to content

Auto imports for frontend E2E tests#167

Merged
zendern merged 8 commits into
mainfrom
auto-imports-circuit
May 22, 2026
Merged

Auto imports for frontend E2E tests#167
zendern merged 8 commits into
mainfrom
auto-imports-circuit

Conversation

@zendern
Copy link
Copy Markdown
Contributor

@zendern zendern commented May 22, 2026

Link to Issue or Message thread

Part of work figuring out https://github.com/lab-sync/copier-circuit-python-device-driver-frontend/pull/3

Why is this change necessary?

The device e2e test are using useKiotaClient. This works in the context of a nuxt app but not when you are doing an e2e test that is using node. Similar to the comment we have around ~~, @@, ~, and @ aliases we need to do this config so that the auto import of the useKiotaClient will work in that context as well.

How does this change address the issue?

Adds unplugin-auto-import dep and config it for kiota in the context of the e2e tests only.

What side effects does this change have?

E2E tests are now able to run (get to the next error 🤣 )

How is this change tested?

Downstream in driver

Summary by CodeRabbit

  • New Features
    • Added auto-import functionality for development environments, automatically providing required development utilities and composables when circuit python driver is enabled.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 22, 2026

Warning

Rate limit exceeded

@zendern has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 13 minutes and 17 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 783264fb-4203-4353-bb89-3eef72c0094a

📥 Commits

Reviewing files that changed from the base of the PR and between f78415a and bc04f78.

📒 Files selected for processing (1)
  • template/frontend/vitest.config.ts.jinja
📝 Walkthrough

Walkthrough

This PR adds conditional support for unplugin-auto-import to the Nuxt template system. The template context is extended with a version pin, the package.json conditionally includes the dependency, and vitest configuration registers the plugin with specific Nuxt composables for e2e test auto-import resolution.

Changes

unplugin-auto-import support

Layer / File(s) Summary
Context variable and dependency declaration
extensions/context.py, template/frontend/package.json.jinja
The context provides unplugin_auto_import_version as ^21.0.0, and package.json.jinja conditionally adds unplugin-auto-import to devDependencies when is_circuit_python_driver is enabled.
Vitest e2e plugin configuration
template/frontend/vitest.config.ts.jinja
Vitest config conditionally imports and registers AutoImport plugin with Nuxt-common composables (useKiotaClient, _resetKiotaClientForTests) in the e2eProject configuration for test-time auto-import resolution.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested reviewers

  • ejfine
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Auto imports for frontend E2E tests' accurately summarizes the main change: adding auto-import configuration for E2E tests.
Description check ✅ Passed The description follows the template structure with all required sections completed: issue link, motivation, solution approach, side effects, and testing methodology are all provided.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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

Comment @coderabbitai help to get the list of available commands and usage tips.

@@ -1,8 +1,9 @@
import { fileURLToPath } from "node:url";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

usually when we make something jinja, we begin with {% raw %} because there's so many footguns about jinja syntax

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done fc19a03

"@": appDir,
},
},
{% if is_circuit_python_driver %}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

NIT: maybe change this to a "include_lab_sync_nuxt_common_module" copier question? since several other non-circuit-python repos will want to use it too

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I concur but id like to defer this for the moment. Ill create an issue to track it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ejfine
ejfine previously approved these changes May 22, 2026
},
},
});
{% endraw %}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Put endraw at the end of line 130 and leave 131 blank

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

take a look at some of the other jinja files to see the pattern

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

are you sure? if i dont do this wont it still add an extra line and ts will fail b/c it doesn't want the extra endline? e5a4c4c

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok real fix bc04f78

ejfine
ejfine previously approved these changes May 22, 2026
@zendern zendern merged commit 9239f3f into main May 22, 2026
25 checks passed
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