0

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.

JsPsych test folder

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?

  • Judging from the syntax, it could be Ava. Check the package.json of the project and see what test framework is in the dependencies – Patrick Hund Apr 08 '17 at 05:13

1 Answers1

1

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.

Josh
  • 2,105
  • 1
  • 14
  • 14