Say there is a directory(Testcases), with.js files, some are test files with it() function and rest aren't when mocha Testcases
is used, does mocha execute only the ones with it()?
How about trying it out? This is a simple experiment you can run in about 2 minutes.
$ mkdir test-mocha
$ cd test-mocha
$ npm init -y
$ npm i mocha chai
Testcases/a.js
console.log('test');
Testcases/b.js
var expect = require("chai").expect;
describe('Test', function() {
it('1 equals 1', function() {
expect(1).to.equal(1);
});
});
And run your mocha command:
$ ./node_modules/.bin/mocha Testcases/
test
Test #1
✓ 1 equals 1
1 passing (4ms)
So the answer is no .
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.