I'm working on an existing project but I am new to Javascript. The project can be found here, it is JsPsych and I've searched the documentation here and cannot find the answer ( http://docs.jspsych.org/ )
I don't understand how they are doing unit tests. I have found the "testing" folder and you can view it below, here.
Here's an example called "load.test.js"
const root = '../';
require(root + 'jspsych.js');
require(root + 'plugins/jspsych-single-stim.js');
test('jsPsych should be in the window object', function(){
expect(typeof window.jsPsych).not.toBe('undefined');
});
Does anyone recognize this type of unit test? Is this supposed to be paired with some software? Can someone explain how I would actually run this?
The tests are run with Jest . You can see that jest
is called as the test command in package.json .
To run the tests, install node and npm on your system. Then run npm install
in the repository's main directory. Then you can run npm test
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.