Skip to content

Commit 9bcd7fc

Browse files
committed
adapt existing tests
1 parent 63a7d4d commit 9bcd7fc

File tree

3 files changed

+35
-39
lines changed

3 files changed

+35
-39
lines changed
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
describe('globbing test', function() {
4-
it('should find this test', function() {
4+
it('should find this glob/test', function() {
55
// see test/integration/glob.spec.js for details
66
});
77
});
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
describe('globbing test', function() {
4-
it('should find this test', function() {
4+
it('should find this glob/nested/test', function() {
55
// see test/integration/glob.spec.js for details
66
});
77
});

test/integration/glob.spec.js

+33-37
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@ describe('globbing', function() {
1111
testGlob.shouldSucceed(
1212
'./*.js',
1313
function(results) {
14-
expect(
15-
results.stdout,
14+
expect(results.stdout, 'to contain', '["start",{"total":1}]').and(
1615
'to contain',
17-
'["end",{"suites":1,"tests":1,"passes":1,"pending":0,"failures":0,'
16+
'["pass",{"title":"should find this glob/test"'
1817
);
1918
},
2019
done
@@ -39,8 +38,11 @@ describe('globbing', function() {
3938
testGlob.shouldFail(
4039
'./*-none.js ./*-none-twice.js',
4140
function(results) {
42-
expect(results.stderr, 'to contain', 'Error: No test files found');
43-
expect(results.stderr, 'not to contain', '*-none');
41+
expect(
42+
results.stderr,
43+
'to contain',
44+
'Error: No test files found'
45+
).and('not to contain', '*-none');
4446
},
4547
done
4648
);
@@ -50,10 +52,9 @@ describe('globbing', function() {
5052
testGlob.shouldSucceed(
5153
'./*.js ./*-none.js',
5254
function(results) {
53-
expect(
54-
results.stdout,
55+
expect(results.stdout, 'to contain', '["start",{"total":1}]').and(
5556
'to contain',
56-
'["end",{"suites":1,"tests":1,"passes":1,"pending":0,"failures":0,'
57+
'["pass",{"title":"should find this glob/test"'
5758
);
5859
expect(
5960
results.stderr,
@@ -71,10 +72,9 @@ describe('globbing', function() {
7172
testGlob.shouldSucceed(
7273
'"./*.js"',
7374
function(results) {
74-
expect(
75-
results.stdout,
75+
expect(results.stdout, 'to contain', '["start",{"total":1}]').and(
7676
'to contain',
77-
'["end",{"suites":1,"tests":1,"passes":1,"pending":0,"failures":0,'
77+
'["pass",{"title":"should find this glob/test"'
7878
);
7979
},
8080
done
@@ -109,10 +109,9 @@ describe('globbing', function() {
109109
testGlob.shouldSucceed(
110110
'"./*.js" "./*-none.js"',
111111
function(results) {
112-
expect(
113-
results.stdout,
112+
expect(results.stdout, 'to contain', '["start",{"total":1}]').and(
114113
'to contain',
115-
'["end",{"suites":1,"tests":1,"passes":1,"pending":0,"failures":0,'
114+
'["pass",{"title":"should find this glob/test"'
116115
);
117116
expect(
118117
results.stderr,
@@ -129,11 +128,15 @@ describe('globbing', function() {
129128
testGlob.shouldSucceed(
130129
'"./**/*.js"',
131130
function(results) {
132-
expect(
133-
results.stdout,
134-
'to contain',
135-
'["end",{"suites":2,"tests":2,"passes":2,"pending":0,"failures":0,'
136-
);
131+
expect(results.stdout, 'to contain', '["start",{"total":2}]')
132+
.and(
133+
'to contain',
134+
'["pass",{"title":"should find this glob/test"'
135+
)
136+
.and(
137+
'to contain',
138+
'["pass",{"title":"should find this glob/nested/test"'
139+
);
137140
},
138141
done
139142
);
@@ -157,11 +160,15 @@ describe('globbing', function() {
157160
testGlob.shouldSucceed(
158161
'"./**/*.js" "./**/*-none.js"',
159162
function(results) {
160-
expect(
161-
results.stdout,
162-
'to contain',
163-
'["end",{"suites":2,"tests":2,"passes":2,"pending":0,"failures":0,'
164-
);
163+
expect(results.stdout, 'to contain', '["start",{"total":2}]')
164+
.and(
165+
'to contain',
166+
'["pass",{"title":"should find this glob/test"'
167+
)
168+
.and(
169+
'to contain',
170+
'["pass",{"title":"should find this glob/nested/test"'
171+
);
165172
expect(
166173
results.stderr,
167174
'to contain',
@@ -187,13 +194,6 @@ var testGlob = {
187194
})
188195
};
189196

190-
var isFlakeyNode = (function() {
191-
var version = process.versions.node.split('.');
192-
return (
193-
version[0] === '0' && version[1] === '10' && process.platform === 'win32'
194-
);
195-
})();
196-
197197
function execMochaWith(validate) {
198198
return function execMocha(glob, assertOn, done) {
199199
exec(
@@ -206,12 +206,8 @@ function execMochaWith(validate) {
206206
function(error, stdout, stderr) {
207207
try {
208208
validate(error, stderr);
209-
if (isFlakeyNode && error && stderr === '') {
210-
execMocha(glob, assertOn, done);
211-
} else {
212-
assertOn({stdout: stdout, stderr: stderr});
213-
done();
214-
}
209+
assertOn({stdout: stdout, stderr: stderr});
210+
done();
215211
} catch (assertion) {
216212
done(assertion);
217213
}

0 commit comments

Comments
 (0)