Fix Issue #200: Generate command fails with workflow.onComplete/onError lifecycle hooks#363
Open
MikeWLloyd wants to merge 2 commits intoaskimed:mainfrom
Open
Fix Issue #200: Generate command fails with workflow.onComplete/onError lifecycle hooks#363MikeWLloyd wants to merge 2 commits intoaskimed:mainfrom
MikeWLloyd wants to merge 2 commits intoaskimed:mainfrom
Conversation
Co-authored-by: Copilot <copilot@github.com>
nvnieuwk
reviewed
Apr 24, 2026
Collaborator
nvnieuwk
left a comment
There was a problem hiding this comment.
Thanks for your contribution! Could you also update the patterns for process (getProcessNames) and function (getFunctionNames) name fetching?
Co-authored-by: Copilot <copilot@github.com>
Author
|
@nvnieuwk sure thing. I just pushed the requested changes, here is a summary:
Test Results:
All three regex patterns (process, function, workflow) now consistently:
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Fixes an issue where
nf-test generatecommand would fail when a workflow contains Nextflow lifecycle hook calls likeworkflow.onComplete,workflow.onError, orworkflow.onSuccess. The command would incorrectly identify these lifecycle hook blocks as separate named workflows, causing the generator to skip test file creation.Root Cause
The regex pattern in
NextflowScript.getWorkflowNames()was too greedy:When parsing a file with lifecycle hooks, it would match both the actual workflow definition and the lifecycle hook blocks, incorrectly counting them as multiple workflows. The generator would then skip generation because it expects exactly one named workflow per file.
Solution
Updated the regex pattern to only match valid workflow identifiers (not dot notation):
This pattern:
Changes
Core Fix:
NextflowScript.java- UpdatedgetWorkflowNames()regex patternTests:
NextflowScriptTest.java- Added 4 unit tests:testGetWorkflowNamesIgnoresOnComplete()testGetWorkflowNamesIgnoresOnError()testGetWorkflowNamesIgnoresOnSuccess()testGetWorkflowNamesIgnoresMultipleLifecycleHooks()Test Data:
lifecycle_hooks.nf- Example workflow with lifecycle hookslifecycle_hooks.nf.test- Test case for the workflowTesting
✅ Unit Tests: All 34 NextflowScriptTest tests pass (including 4 new tests for this fix)
✅ Integration Tests: GenerateTestsCommandTest passes (6/6)
✅ Manual Verification: Confirmed the generate command now successfully handles workflows with lifecycle hooks
Example
Before (would fail):
After (works):
Related Issues
Fixes #200