-
Notifications
You must be signed in to change notification settings - Fork 118
fix: Run Test action now recognizes singular data tests (#1720) #1722
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: master
Are you sure you want to change the base?
Conversation
When running "Run Test" command on a singular test file (SQL file in tests/ directory), the extension now correctly executes `dbt test` instead of `dbt run`. The fix checks if the file path contains '/tests/' or '\tests\' and redirects to the test execution method instead of the model run method. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
WalkthroughThe method responsible for running a model on the active window was updated to check if the active file is within a "tests" directory. If so, it now runs the file as a test instead of a model by invoking a different internal function and returning early. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant RunModel
participant runDBTModel
participant runDBTModelTest
User->>RunModel: runModelOnActiveWindow(activeFileUri)
alt active file path contains "tests"
RunModel->>runDBTModelTest: (activeFileUri)
runDBTModelTest-->>RunModel: result
RunModel-->>User: result
else
RunModel->>runDBTModel: (activeFileUri)
runDBTModel-->>RunModel: result
RunModel-->>User: result
end
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
npm error Exit handler never called! 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🧰 Additional context used🧠 Learnings (2)📓 Common learnings
src/commands/runModel.ts (4)
✨ 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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Caution
Changes requested ❌
Reviewed everything up to f3f0dc6 in 1 minute and 13 seconds. Click for details.
- Reviewed
20
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
1
draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. src/commands/runModel.ts:20
- Draft comment:
Consider renaming 'relativePath' since it holds the full file path, not a relative one. - Reason this comment was not posted:
Confidence changes required:33%
<= threshold50%
None
Workflow ID: wflow_jX6kZn8c4WiU1ZTK
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
|
||
// Check if the file is in the tests directory (singular test) | ||
const relativePath = fullPath.fsPath; | ||
if (relativePath.includes('/tests/') || relativePath.includes('\\tests\\')) { |
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.
Use path.sep for cross-platform path checks instead of hardcoding '/' and '\'.
if (relativePath.includes('/tests/') || relativePath.includes('\\tests\\')) { | |
if (relativePath.includes(`${path.sep}tests${path.sep}`)) { |
When running "Run Test" command on a singular test file (SQL file in tests/ directory), the extension now correctly executes
dbt test
instead ofdbt run
.fix for #1720
The fix checks if the file path contains '/tests/' or '\tests' and redirects to the test execution method instead of the model run method.
🤖 Generated with Claude Code
Overview
Problem
Describe the problem you are solving. Mention the ticket/issue if applicable.
Solution
Describe the implemented solution. Add external references if needed.
Screenshot/Demo
A picture is worth a thousand words. Please highlight the changes if applicable.
How to test
Checklist
README.md
updated and added information about my changeSummary by CodeRabbit