Skip to content

Generic testing framework and Error messages refactor - #32

Open
dcousens wants to merge 2 commits into
masterfrom
testframework
Open

Generic testing framework and Error messages refactor#32
dcousens wants to merge 2 commits into
masterfrom
testframework

Conversation

@dcousens

@dcousens dcousens commented Apr 28, 2017

Copy link
Copy Markdown
Contributor

Related #31 and #22

Rebased on top of #30

If you consider the changing error messages a breaking change, then yes, this is a breaking change.
From my own experience with this module... the error messages are completely inconsistent, and some entirely dependent on the version of Buffer being used anyway.

Therefore, I think, after this PR, we could declare them part of the API proper.

@dcousens dcousens self-assigned this Apr 28, 2017
@dcousens
dcousens requested a review from fanatid April 28, 2017 15:44
Comment thread test/all.js
[Buffer.alloc(3), /^TypeError: Expected Array, got Buffer/],
[['foo', 'bar', 'baz'], /^TypeError: Expected Array(Length: 2), got Array(Length: 3)/],
[['foo'], /^TypeError: Expected Array(Length: 2), got Array(Length: 1)/],
[undefined, /^TypeError: Expected Array, got undefined/]

@dcousens dcousens Apr 28, 2017

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fanatid this PR is still WIP, so any real attention to be paid is that you are OK with these error messages... they use the typeforce format, and I was most likely just going to use it verbatim.
The typeforce module has been extensively tested to be consistent with these error types, and maintains high performance while balancing highly descriptive error messages for debugging.

@fanatid

fanatid commented Apr 28, 2017

Copy link
Copy Markdown
Member

I'm ok with major bump if we will not have any problems with error messages in feature, but in this case we need major version bump and add extra dependency: typeforce. In the same time I think that this is ok, because typeforce is used in bitcoinjs-lib long time.

@jprichardson @dominictarr are you ok with typeforce in varstruct and major version bump?

@dcousens

Copy link
Copy Markdown
Contributor Author

I assume this is OK then?

@fanatid

fanatid commented Nov 28, 2017

Copy link
Copy Markdown
Member

I assume this is OK then?

I think so, but you need fix tests before merge :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants