-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
Hi there!
Sorry if this question was asked before, but I didn't find anything about it.
I would like to add some unit tests for the select-dropdown component, for which today my PR was merged; so I just started to explore how you tackle the unit tests flow.
I've read the doc about tests, played a bit, and now I've a couple of questions.
Since I'm new to React component unit testing, the possibility to debug a unit test would be useful in my situation.
Question 1: Does calypso permit this out of the box? How?
I guess the answer might revolve around the possibility to run mocha directly (that is mentioned in the doc); in this regard I would also like to report that running the following command:
$ NODE_ENV=test NODE_PATH=client:test node_modules/.bin/mocha test/run-mocha.js does not behave how I would have expected: it executes 0 tests.
I digged in the code and I noticed that test files never get added.
// in load-suite.js
requireTestFiles( setup.getConfig() );
// setup.addFile is never executedLooking at the history, I found that in the past that line was something like
requireTestFiles( require( 'tests.json' ) );and in fact when I hardcoded the following configuration
requireTestFiles( {
"components/accordion": {
"test": [ "index" ]
}
} );the tests for the accordion component were run.
Question 2: Am I perhaps doing something wrong, or having wrong expectations?