-
-
Notifications
You must be signed in to change notification settings - Fork 306
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
Update to latest version of tap and tap-parser #314
Closed
Closed
Changes from 19 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
7db3bdc
update test/array.js to use concat-stream instead of tap.createConsum…
nelsonic 0e04ba7
remove redundant .map that checks typeof r === 'object' ... rows are …
nelsonic c319f83
update test/default-messages.js to match output of latest version of …
nelsonic fae3c51
add getStackTrace method to extract the error message from tap output…
nelsonic f944fbb
update test/end-as-callback.js using concat-stream instead of tap.cre…
nelsonic c33c0bf
update test/exit.js to use concat-stream instead of tap.createConsume…
nelsonic c68c34c
update test/fail.js to use concat-stream instead of tap.createConsume…
nelsonic 370b6fb
update test/nested-sync-noplan-noend.js to use concat-stream instead …
nelsonic cf6fcb4
update test/nested.js to use concat-stream instead of tap.createConsu…
nelsonic 8afdd1e
update test/require.js to use concat-stream instead of tap.createCons…
nelsonic a0f7d73
update test/only.js to use concat-stream instead of tap.createConsume…
nelsonic 453bd55
update test/timeoutAfter.js to use concat-stream instead of tap.creat…
nelsonic 771e411
update test/too_many.js to use concat-stream instead of tap.createCon…
nelsonic 6633e9a
temporarily comment out 3 tests in test/skip.js makes the other tests…
nelsonic 27ce042
remove redundant tests from test/skip.js - still testing the document…
nelsonic 4b52e9a
remove redundant tests in test/throws.js (assertion unchanged! Passes…
nelsonic ceec1f1
tidy up before requesting pull request code review.
nelsonic 3bdd82f
update tests to match format in test/skip.js (consistency) see: https…
nelsonic ce0b410
split the tap output array before comparing in test/require.js to kee…
nelsonic 82ba4d4
update all instances of spawn to use path.join for windows compatabil…
nelsonic c4025c1
update tests to reflect double-blank-lines in Tap output as discussed…
nelsonic e721508
tidy up test/default-messages.js as discussed in https://github.com/s…
nelsonic d93d3e3
tidy up tests containing spawn discussed in https://github.com/substa…
nelsonic 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,32 @@ | ||
var tap = require('tap'); | ||
var spawn = require('child_process').spawn; | ||
var trim = require('string.prototype.trim'); | ||
var concat = require('concat-stream'); | ||
|
||
tap.test('default messages', function (t) { | ||
t.plan(1); | ||
|
||
var tc = tap.createConsumer(); | ||
var ps = spawn(process.execPath, [ __dirname + '/messages/defaults.js' ]); | ||
|
||
var rows = []; | ||
tc.on('data', function (r) { rows.push(r) }); | ||
tc.on('end', function () { | ||
var rs = rows.map(function (r) { | ||
if (r && typeof r === 'object') { | ||
return { id : r.id, ok : r.ok, name : trim(r.name) }; | ||
} | ||
else return r; | ||
}); | ||
t.same(rs, [ | ||
'TAP version 13', | ||
'default messages', | ||
{ id: 1, ok: true, name: 'should be truthy' }, | ||
{ id: 2, ok: true, name: 'should be falsy' }, | ||
{ id: 3, ok: true, name: 'should be equal' }, | ||
{ id: 4, ok: true, name: 'should not be equal' }, | ||
{ id: 5, ok: true, name: 'should be equivalent' }, | ||
{ id: 6, ok: true, name: 'should be equivalent' }, | ||
{ id: 7, ok: true, name: 'should be equivalent' }, | ||
'tests 7', | ||
'pass 7', | ||
'ok' | ||
]); | ||
}); | ||
ps.stdout.pipe(concat(function (rows) { | ||
|
||
var ps = spawn(process.execPath, [ __dirname + '/messages/defaults.js' ]); | ||
ps.stdout.pipe(tc); | ||
t.same(rows.toString('utf8'), [ | ||
'TAP version 13', | ||
'# default messages', | ||
'ok 1 should be truthy', | ||
'ok 2 should be falsy', | ||
'ok 3 should be equal', | ||
'ok 4 should not be equal', | ||
'ok 5 should be equivalent', | ||
'ok 6 should be equivalent', | ||
'ok 7 should be equivalent', | ||
'', | ||
'1..7', | ||
'# tests 7', | ||
'# pass 7', | ||
'', | ||
'# ok', | ||
'', | ||
'' | ||
].join('\n')); | ||
})); | ||
}); |
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
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.
let's use
path.join
here - ideally the/
is never hardcoded, so things work on Windows (even though that's already the case in master)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.
@ljharb, thanks for the tip on cross-platform compatibility. 👍
do we need to remove all forward slashes?
or is it enough to go from:
To:
From @domenic's Gist: https://gist.github.com/domenic/2790533#paths-and-urls I deduce that this should be enough.
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.
And if we change this one instance, should we change all (Five) occurrences:
https://github.com/substack/tape/search?utf8=%E2%9C%93&q=spawn%28process.execPath ? (just say the word and I'll update them all to be consistently windows-friendly)
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.
That gist uses slashes in
path.relative
(which also won't work, I think), but no, we'd wantpath.join(__dirname, 'messages', 'defaults.js')
(you can verify becausepath.join('a', 'b\\c')
doesn't result ina/b/c
, so you can assume that the reverse wouldn't hold in Windows). Yes, it'd be great to update them all.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.
The reverse does hold in Windows.
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.
Ah, that's fascinating, and good to know. So unix paths get special treatment that windows paths don't?
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.
The Windows OS treats / as \ in cases like this, so Node chooses to normalize since doing so has no effect besides making the string consistent. (POSIX does not act symmetrically.)
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.
@nelsonic in that case,
path.join( __dirname, 'messages/defaults.js')
is fine throughout. Thanks!