Feature Request: Support for intended fail-scenario
Open
Nobody has claimed this yet.
enhancement
PR required
- Dominant language
- SCSS
- Stars
- 685
- Forks
- 45
- Avg merge
- 8h 54m
- Merged PRs (30d)
- 1
Description
I would like a way to verify a fail scenario to insure code properly messages invalid parameters.
For example:
@mixin theme-color($property: 'background-color') {
// Verify an allowed property was passed in
@if not(($property == background-color)) and not(($property == color)) {
@error 'The `theme-color` mixin only accepts `background-color` or `color`';
}
---- do stuff ----
}
Test:
@include test('should fail with invalid property') {
@include assert-fail {
@include output {
@include theme-color(foo);
}
@include expect {
@include fail-message('The `theme-color` mixin only accepts `background-color` or 'color`');
}
}
}
Today when I attempt a test like this, I get the fail-message in the terminal, however, the test itself fails and my other tests don't run.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the assert-fail and fail-message implementations referenced in the issue, then inspect how the current test runner handles the reported error. Confirm the intended behavior with the provided theme-color example: the expected failure should be captured as a passing test, and subsequent tests should continue running.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scss
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100