TritonDataCenter / node-verror

Rich JavaScript errors
MIT License
1.18k stars 61 forks source link

Add more tests to tst.context.js #56

Closed melloc closed 5 years ago

melloc commented 6 years ago

While looking at tst.context.js, I realized that it could do with some better tests.

melloc commented 6 years ago

CR at https://cr.joyent.us/#/c/4251/

davepacheco commented 6 years ago

I don't think I follow the cases that the new tests are intended to address. Could you maybe add some comments explaining what the test is doing? Also, is there a reason to drop the isError check?

melloc commented 6 years ago

I dropped the isError() check because it wasn't testing anything from verror, but the dependency it's using. The tests I've added indirectly test isError() through the verror functions and constructors.

davepacheco commented 5 years ago

Thanks for the update! I moved the discussion to the CR. In summary, I prefer to keep the isError check but that's not a blocker.

melloc commented 5 years ago

I've run the test suite using several different versions of node:

% for arch in x86 x64; do for version in v0.10.48 v0.12.16 v4.8.1 v6.17.0 v8.15.1; do ( export PATH=$HOME/node-versions/node-$version-sunos-$arch/bin:$PATH; label="$(node -pe '[process.platform, process.arch, process.version].join(" ");')"; echo $label; ( echo $label; git reset --hard HEAD; git clean -fxd; V=1 npm install && make test ) &> "../output-$label.txt" ); done; done
sunos ia32 v0.10.48
sunos ia32 v0.12.16
sunos ia32 v4.8.1
sunos ia32 v6.17.0
sunos ia32 v8.15.1
sunos x64 v0.10.48
sunos x64 v0.12.16
sunos x64 v4.8.1
sunos x64 v6.17.0
sunos x64 v8.15.1

Looking at the results of the runs:

 % tail -n 8 output-sunos*
==> output-sunos ia32 v0.10.48.txt <==
===================================================

Results:
        Tests passed:    8/ 8
        Tests failed:    0/ 8

===================================================
Cleaning up output from successful tests ... done.

==> output-sunos ia32 v0.12.16.txt <==
===================================================

Results:
        Tests passed:    8/ 8
        Tests failed:    0/ 8

===================================================
Cleaning up output from successful tests ... done.

==> output-sunos ia32 v4.8.1.txt <==
===================================================

Results:
        Tests passed:    8/ 8
        Tests failed:    0/ 8

===================================================
Cleaning up output from successful tests ... done.

==> output-sunos ia32 v6.17.0.txt <==
===================================================

Results:
        Tests passed:    8/ 8
        Tests failed:    0/ 8

===================================================
Cleaning up output from successful tests ... done.

==> output-sunos ia32 v8.15.1.txt <==
===================================================

Results:
        Tests passed:    8/ 8
        Tests failed:    0/ 8

===================================================
Cleaning up output from successful tests ... done.

==> output-sunos x64 v0.10.48.txt <==
===================================================

Results:
        Tests passed:    8/ 8
        Tests failed:    0/ 8

===================================================
Cleaning up output from successful tests ... done.

==> output-sunos x64 v0.12.16.txt <==
===================================================

Results:
        Tests passed:    8/ 8
        Tests failed:    0/ 8

===================================================
Cleaning up output from successful tests ... done.

==> output-sunos x64 v4.8.1.txt <==
===================================================

Results:
        Tests passed:    8/ 8
        Tests failed:    0/ 8

===================================================
Cleaning up output from successful tests ... done.

==> output-sunos x64 v6.17.0.txt <==
===================================================

Results:
        Tests passed:    8/ 8
        Tests failed:    0/ 8

===================================================
Cleaning up output from successful tests ... done.

==> output-sunos x64 v8.15.1.txt <==
===================================================

Results:
        Tests passed:    8/ 8
        Tests failed:    0/ 8

===================================================
Cleaning up output from successful tests ... done.