Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

Add tests for double-star behavior

ScottFreeCode26d337aa1b75
diff --git a/test/integration/fixtures/glob/nested/glob.spec.js b/test/integration/fixtures/glob/nested/glob.spec.js
new file mode 100644
index 00000000..235c2f84
--- /dev/null
+++ b/test/integration/fixtures/glob/nested/glob.spec.js
@@ -0,0 +1,7 @@
+'use strict';
+
+describe('globbing test', function () {
+ it('should find this test', function () {
+ // see test/integration/glob.spec.js for details
+ });
+});
diff --git a/test/integration/glob.spec.js b/test/integration/glob.spec.js
index fb2bbf43..df16d282 100644
--- a/test/integration/glob.spec.js
+++ b/test/integration/glob.spec.js
@@ -47,6 +47,27 @@ describe('globbing', function () {
expect(results.stderr).to.contain('Could not find any test files matching pattern');
}, done);
});
+
+ describe('double-starred', function () {
+ it('should find the tests on multiple levels', function (done) {
+ testGlob.shouldSucceed('"./**/*.js"', function (results) {
+ expect(results.stdout).to.contain('["end",{"suites":2,"tests":2,"passes":2,"pending":0,"failures":0,');
+ }, done);
+ });
+
+ it('should not find a non-matching pattern', function (done) {
+ testGlob.shouldFail('"./**/*-none.js"', function (results) {
+ expect(results.stderr).to.contain('Could not find any test files matching pattern');
+ }, done);
+ });
+
+ it('should handle both matching and non-matching patterns in the same command', function (done) {
+ testGlob.shouldSucceed('"./**/*.js" "./**/*-none.js"', function (results) {
+ expect(results.stdout).to.contain('["end",{"suites":2,"tests":2,"passes":2,"pending":0,"failures":0,');
+ expect(results.stderr).to.contain('Could not find any test files matching pattern');
+ }, done);
+ });
+ });
});
});