bgrins / TinyColor

Fast, small color manipulation and conversion for JavaScript
https://bgrins.github.io/TinyColor/
MIT License
5.05k stars 438 forks source link

Method to run test using npm test #202

Closed ossdev07 closed 5 years ago

ossdev07 commented 5 years ago

Have cloned and installed the package in x86_64 platform. While trying to run tests using command npm test it is throwing below error:

tinycolor2@1.4.1 test /TinyColor echo 'Error: no test specified'

Error: no test specified

But there is a test folder in package and method to run tests has not been mentioned in scripts or README file. Please suggest method to run tests. Thanks in advance.

mikaello commented 5 years ago

This project uses the framework QUnit for testing. I expected that you could either run the tests directly with QUnit:

cd tests
node qunit.js

But this gives an error:

/Users/mikaeo/usit/test/TinyColor/test/qunit.js:1506
        elem.attachEvent( "on" + type, fn );
             ^

TypeError: elem.attachEvent is not a function

Secondly I expected to be able to run these tests with the task runner chosen for this project:

npm install
npx grunt qunit

But this also failed:

Running "qunit:all" (qunit) task
Testing test/index.html Fatal error: Callback must be a function

So I am not sure how to run the tests, but this is at least a clue of how to do it :-)

ossdev07 commented 5 years ago

@mikaello Thanks for the help. Will test and update.

ossdev07 commented 5 years ago

@mikaello Thanks for the command. All tests are passing with the command. Below is the output: npx grunt qunit npx: installed 97 in 12.513s Running "qunit:all" (qunit) task Testing test/index.html ............................................OK

44 tests completed with 0 failed, 0 skipped, and 0 todo. 2295 assertions (in 826ms), passed: 2295, failed: 0

Done, without errors.

Below are node versions which has been used to test. Node version - v10.11.0, npm version - v6.8.0, npx version - v10.2.0