Skip to content
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

CCK: Reconcile hooks #78

Merged
merged 3 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions devkit/samples/hooks/hooks.feature
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
Feature: Hooks
Hooks are special steps that run before or after each scenario's steps.

They can also conditionally target specific scenarios, using tag expressions

Scenario: no tags, passed step
Scenario: No tags and a passed step
When a step passes

Scenario: no tags, failed step
When a step throws an exception
Scenario: No tags and a failed step
When a step fails

Scenario: no tags, undefined step
When a step throws an exception
Scenario: No tags and a undefined step
When a step does not exist

@some-tag
Scenario: with a tag, passed step
Scenario: With a tag, a failure in the hook and a passed step
When a step passes

@with-attachment
Scenario: with an attachment in the hook
When a step passes
Scenario: With an tag, an valid attachment in the hook and a passed step
When a step passes
4 changes: 2 additions & 2 deletions devkit/samples/hooks/hooks.feature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ When('a step passes', function () {
// no-op
})

When('a step throws an exception', function () {
When('a step fails', function () {
throw new Error('Exception in step')
})

After(function () {
throw new Error('Exception in hook')
// no-op
davidjgoss marked this conversation as resolved.
Show resolved Hide resolved
})

After('@some-tag or @some-other-tag', function () {
Expand Down
1 change: 0 additions & 1 deletion devkit/samples/pending/pending.feature
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
Feature: Pending steps

During development, step definitions can signal at runtime that they are
not yet implemented (or "pending") by returning or throwing a particular
value.
Expand Down
8 changes: 4 additions & 4 deletions ruby/features/hooks/hooks.feature.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
# no-op
end

When('a step throws an exception') do
raise StandardError, 'Exception in step'
When('a step fails') do
raise 'Exception in step'
end

After do
raise StandardError, 'Exception in hook'
# no-op
end

After('@some-tag or @some-other-tag') do
raise StandardError, 'Exception in conditional hook'
raise 'Exception in conditional hook'
end

After('@with-attachment') do
Expand Down