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

add unit test for file #6

Closed
wants to merge 1 commit into from
Closed

Conversation

phapdinh
Copy link
Contributor

@phapdinh phapdinh commented Nov 7, 2018

This creates a unit test for the file using mocha

@wesleytodd
Copy link
Owner

Hey @phapdinh, thanks for the contribution!

While I think adding tests to this library is a good thing, I am not sure if this is the correct way to test this. First I think that what you want to test is that the prototype chain was modified, and this does not test that. Secondly, the behavior we really want to test is that it works in all the supported environments, since that is the only reason to use this module.

If you want to move this forward I would look at structuring the tests such that they test these things. I would look at either using docker to test older node versions or a setup with travis for the same.

Also a small nitpick: preferably it would follow the mocha standard of putting the tests in a test directory so you can just run mocha without the *.test.js.

@@ -5,7 +5,7 @@
"main": "index.js",
"typings": "index.d.ts",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "mocha *.test.js"
Copy link

@LinusU LinusU Dec 3, 2018

Choose a reason for hiding this comment

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

If you name the file test.js instead of index.test.js you don't have to explicitly state the name here, and it will be aligned more closely with how the tests files are usually named by following the default settings.

edit: just saw that wesleytodd had already mentioned this ☺️

@LinusU
Copy link

LinusU commented Dec 3, 2018

It would be nice to get some tests in, even if it just tests Node.js, so that we can get this package integrated into the CITGM testing: nodejs/citgm#631

I'd be happy to help out with anything that needs to be done 👍

We could also look at adding tests for the browser using something like Browserling? Still, I think it would be a step in the right direction to get a Node.js-test in ☺️

@wesleytodd
Copy link
Owner

Closed in 6d8bbc4

@wesleytodd wesleytodd closed this Jan 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants