-
-
Notifications
You must be signed in to change notification settings - Fork 305
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
Report skipped assertions #486
Open
jfparadis
wants to merge
1
commit into
tape-testing:master
Choose a base branch
from
jfparadis:jfparadis/master/report-skipped-tests
base: master
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.
Open
Changes from all commits
Commits
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 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 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 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 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 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,59 @@ | ||
var test = require('../'); | ||
|
||
var concat = require('concat-stream'); | ||
var tap = require('tap'); | ||
|
||
tap.test('skip output test', function (assert) { | ||
assert.plan(1); | ||
|
||
var verify = function (output) { | ||
assert.equal(output.toString('utf8'), [ | ||
'TAP version 13', | ||
'# SKIP we require more vespene gas', | ||
'# skip assertions', | ||
'ok 1 not enough pylons # SKIP', | ||
'# skip subtests', | ||
'# SKIP we require more ziggurats', | ||
'', | ||
'1..1', | ||
'# tests 1', | ||
'# pass 1', | ||
'# skip 3', | ||
'', | ||
'# ok', | ||
'' | ||
].join('\n')); | ||
}; | ||
|
||
var tapeTest = test.createHarness({ exit: false }); | ||
tapeTest.createStream().pipe(concat(verify)); | ||
|
||
// doesn't look like test.skip is available with createHarness() | ||
// tapeTest.skip('we require more minerals', function (t) { | ||
// t.plan(1); | ||
// t.fail('should not fail test.skip()'); | ||
// }); | ||
|
||
tapeTest('we require more vespene gas', { skip: true }, function (t) { | ||
t.plan(1); | ||
t.fail('should not fail test with { skip: true}'); | ||
}); | ||
|
||
tapeTest('skip assertions', function (t) { | ||
t.plan(1); | ||
t.skip('not enough pylons'); | ||
}); | ||
|
||
tapeTest('skip subtests', function (t) { | ||
// doesn't look like test.skip is available with createHarness() | ||
// test.skip('build more farms', function (t) { | ||
// t.plan(1) | ||
// t.fail('should not run subtest with test.skip()'); | ||
// }); | ||
t.test('we require more ziggurats', { skip: true }, function (tt) { | ||
tt.plan(1); | ||
tt.fail('should not run subtest with { skip: true }'); | ||
}); | ||
t.end(); | ||
}); | ||
}); |
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.
Wouldn't this line count a skipped
test
as a skippedassertion
. Unlike in line 122 which counts skipped asserts, this line seems to include numbers that aren't consistent.There is no equivalent to Line 123 in this
prerun
callback.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.
Yes, this is just an update to an old PR meant to illustrate the problem you are mentioning: tests and assertions are mixed together.
The reason the two are mixed together is that
tape
reports "assertions" as "tests", and doesn't count suites.If we don't count suites, the only way to indicate that some assertions are skipped is to add one to tests because we don't know how many are actually skipped. That create the problem that you are mentioning.
The solution is probably to change the count and the output to be something like
node-tap
:My concern is not to break people with this change, so I will probably do this behind a flag. Once we agree on the output and the necessity of a flag, then the changes will be trivial.
What's your take? If would be great if you could help me by testing the upcoming changes in your environment. :)