-
-
Notifications
You must be signed in to change notification settings - Fork 3
Implement debug step-through mode for test execution #338
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
Draft
Copilot
wants to merge
8
commits into
main
Choose a base branch
from
copilot/fix-205-2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
de42270
Initial plan
Copilot eb035a5
Initial commit: Planning debug step-through mode implementation
Copilot 2a40b4a
Implement debug step-through mode functionality
Copilot 7673ba7
Add documentation and clean up debug implementation
Copilot 28fb5c0
Force concurrent runners to 1 when debug step-through mode is enabled
Copilot b6b2f0d
Add auto-break on step failure functionality to debug mode
Copilot 438669b
Implement variable inspection capabilities for debug mode
Copilot 7db02d6
Update README.md debug documentation with implemented features
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| const { runTests } = require("./src/index"); | ||
|
|
||
| async function testDebugMode() { | ||
| console.log("=== Testing Debug Step-Through Mode ===\n"); | ||
|
|
||
| // Test with step-through mode enabled | ||
| const config = { | ||
| input: "debug-demo.spec.json", | ||
| logLevel: "info", | ||
| debug: "stepThrough" | ||
| }; | ||
|
|
||
| console.log("Running test with debug step-through mode enabled..."); | ||
| console.log("Config:", JSON.stringify(config, null, 2)); | ||
| console.log("\nStarting test execution...\n"); | ||
|
|
||
| try { | ||
| const results = await runTests(config); | ||
| console.log("\n=== Debug Test Complete ==="); | ||
| if (results) { | ||
| console.log("Results summary:", results.summary); | ||
| } | ||
| } catch (error) { | ||
| console.error("Error during test execution:", error); | ||
| } | ||
| } | ||
|
|
||
| testDebugMode(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| { | ||
| "tests": [ | ||
| { | ||
| "steps": [ | ||
| { | ||
| "stepId": "step-1", | ||
| "description": "First test step", | ||
| "runShell": "echo 'Step 1: Hello from debug mode'" | ||
| }, | ||
| { | ||
| "stepId": "step-2", | ||
| "description": "Second test step", | ||
| "runShell": "echo 'Step 2: This is the second step'" | ||
| }, | ||
| { | ||
| "stepId": "step-3", | ||
| "description": "Third test step", | ||
| "runShell": "echo 'Step 3: Final step'" | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| const { executeTestContext } = require("./src/tests"); | ||
|
|
||
| async function testDebugDirectly() { | ||
| console.log("=== Testing Debug Mode Directly ===\n"); | ||
|
|
||
| // Create a mock config with debug enabled internally | ||
| const config = { | ||
| logLevel: "info", | ||
| debug: "stepThrough", | ||
| _debugParsed: { | ||
| stepThrough: true, | ||
| breakOnFail: false, | ||
| breakpoints: [] | ||
| } | ||
| }; | ||
|
|
||
| const context = { | ||
| contextId: "debug-test-context", | ||
| steps: [ | ||
| { | ||
| stepId: "step-1", | ||
| description: "First test step", | ||
| runShell: "echo 'Step 1: Hello from debug mode'" | ||
| }, | ||
| { | ||
| stepId: "step-2", | ||
| description: "Second test step", | ||
| runShell: "echo 'Step 2: This is the second step'" | ||
| }, | ||
| { | ||
| stepId: "step-3", | ||
| description: "Third test step", | ||
| runShell: "echo 'Step 3: Final step'" | ||
| } | ||
| ] | ||
| }; | ||
|
|
||
| const spec = { specId: "debug-test-spec" }; | ||
| const test = { testId: "debug-test-test" }; | ||
| const runnerDetails = { | ||
| environment: { platform: "linux" }, | ||
| availableApps: [], | ||
| allowUnsafeSteps: true | ||
| }; | ||
| const metaValues = { | ||
| specs: { | ||
| "debug-test-spec": { | ||
| tests: { | ||
| "debug-test-test": { | ||
| contexts: { | ||
| "debug-test-context": { steps: {} } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| }; | ||
|
|
||
| console.log("Starting debug test execution..."); | ||
| console.log("This will pause at each step if you're in an interactive terminal.\n"); | ||
|
|
||
| try { | ||
| const result = await executeTestContext({ | ||
| context, | ||
| config, | ||
| spec, | ||
| test, | ||
| runnerDetails, | ||
| availableApps: [], | ||
| platform: "linux", | ||
| metaValues, | ||
| }); | ||
|
|
||
| console.log("\n=== Debug Test Complete ==="); | ||
| console.log("Result:", result.contextReport.result); | ||
| console.log("Steps executed:", result.contextReport.steps.length); | ||
| result.contextReport.steps.forEach((step, index) => { | ||
| console.log(` Step ${index + 1}: ${step.result} - ${step.description}`); | ||
| }); | ||
| } catch (error) { | ||
| console.error("Error during test execution:", error); | ||
| } | ||
| } | ||
|
|
||
| testDebugDirectly(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| const { executeTestContext } = require("./src/tests"); | ||
|
|
||
| async function testDebugNonInteractive() { | ||
| console.log("=== Testing Debug Mode (Non-Interactive) ===\n"); | ||
|
|
||
| // Temporarily disable TTY to simulate non-interactive environment | ||
| const originalIsTTY = process.stdin.isTTY; | ||
| process.stdin.isTTY = false; | ||
|
|
||
| try { | ||
| // Create a mock config with debug enabled internally | ||
| const config = { | ||
| logLevel: "info", | ||
| debug: "stepThrough", | ||
| _debugParsed: { | ||
| stepThrough: true, | ||
| breakOnFail: false, | ||
| breakpoints: [] | ||
| } | ||
| }; | ||
|
|
||
| const context = { | ||
| contextId: "debug-test-context", | ||
| steps: [ | ||
| { | ||
| stepId: "step-1", | ||
| description: "First test step", | ||
| runShell: "echo 'Step 1: Hello from debug mode'" | ||
| }, | ||
| { | ||
| stepId: "step-2", | ||
| description: "Second test step", | ||
| runShell: "echo 'Step 2: This is the second step'" | ||
| }, | ||
| { | ||
| stepId: "step-3", | ||
| description: "Third test step", | ||
| runShell: "echo 'Step 3: Final step'" | ||
| } | ||
| ] | ||
| }; | ||
|
|
||
| const spec = { specId: "debug-test-spec" }; | ||
| const test = { testId: "debug-test-test" }; | ||
| const runnerDetails = { | ||
| environment: { platform: "linux" }, | ||
| availableApps: [], | ||
| allowUnsafeSteps: true | ||
| }; | ||
| const metaValues = { | ||
| specs: { | ||
| "debug-test-spec": { | ||
| tests: { | ||
| "debug-test-test": { | ||
| contexts: { | ||
| "debug-test-context": { steps: {} } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| }; | ||
|
|
||
| console.log("Starting debug test execution (non-interactive)..."); | ||
| console.log("In non-interactive mode, debug pauses will auto-continue.\n"); | ||
|
|
||
| const result = await executeTestContext({ | ||
| context, | ||
| config, | ||
| spec, | ||
| test, | ||
| runnerDetails, | ||
| availableApps: [], | ||
| platform: "linux", | ||
| metaValues, | ||
| }); | ||
|
|
||
| console.log("\n=== Debug Test Complete ==="); | ||
| console.log("Result:", result.contextReport.result); | ||
| console.log("Steps executed:", result.contextReport.steps.length); | ||
| result.contextReport.steps.forEach((step, index) => { | ||
| console.log(` Step ${index + 1}: ${step.result} - ${step.description}`); | ||
| }); | ||
| } catch (error) { | ||
| console.error("Error during test execution:", error); | ||
| } finally { | ||
| // Restore TTY setting | ||
| process.stdin.isTTY = originalIsTTY; | ||
| } | ||
| } | ||
|
|
||
| testDebugNonInteractive(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| const { runTests } = require("./src/index"); | ||
|
|
||
| async function testNormalMode() { | ||
| console.log("=== Testing Normal Mode (No Debug) ===\n"); | ||
|
|
||
| // Test with debug disabled | ||
| const config = { | ||
| input: "debug-demo.spec.json", | ||
| logLevel: "info", | ||
| debug: false | ||
| }; | ||
|
|
||
| console.log("Running test with debug disabled..."); | ||
| console.log("Config:", JSON.stringify(config, null, 2)); | ||
| console.log("\nStarting test execution...\n"); | ||
|
|
||
| try { | ||
| const results = await runTests(config); | ||
| console.log("\n=== Normal Test Complete ==="); | ||
| if (results) { | ||
| console.log("Results summary:", results.summary); | ||
| } | ||
| } catch (error) { | ||
| console.error("Error during test execution:", error); | ||
| } | ||
| } | ||
|
|
||
| testNormalMode(); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@copilot Update this section with the newer functionality.
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.
Updated the README.md debug documentation to reflect all the implemented features including auto-break on failure, variable inspection capabilities, expression evaluation, and environment variable setting. The "Future Enhancements" section now accurately shows only features that are still planned (breakpoints). See commit 7db02d6.