From 9bcd7fc18e86af8563692b07dac5ae4f464018f3 Mon Sep 17 00:00:00 2001 From: juergba Date: Thu, 9 Apr 2020 15:51:04 +0200 Subject: [PATCH] adapt existing tests --- test/integration/fixtures/glob/glob.spec.js | 2 +- .../fixtures/glob/nested/glob.spec.js | 2 +- test/integration/glob.spec.js | 70 +++++++++---------- 3 files changed, 35 insertions(+), 39 deletions(-) diff --git a/test/integration/fixtures/glob/glob.spec.js b/test/integration/fixtures/glob/glob.spec.js index c6c3d26a69..e5e5a80f0d 100644 --- a/test/integration/fixtures/glob/glob.spec.js +++ b/test/integration/fixtures/glob/glob.spec.js @@ -1,7 +1,7 @@ 'use strict'; describe('globbing test', function() { - it('should find this test', function() { + it('should find this glob/test', function() { // see test/integration/glob.spec.js for details }); }); diff --git a/test/integration/fixtures/glob/nested/glob.spec.js b/test/integration/fixtures/glob/nested/glob.spec.js index c6c3d26a69..0bdaee1484 100644 --- a/test/integration/fixtures/glob/nested/glob.spec.js +++ b/test/integration/fixtures/glob/nested/glob.spec.js @@ -1,7 +1,7 @@ 'use strict'; describe('globbing test', function() { - it('should find this test', function() { + it('should find this glob/nested/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 4284320aa7..c6ce0077f8 100644 --- a/test/integration/glob.spec.js +++ b/test/integration/glob.spec.js @@ -11,10 +11,9 @@ describe('globbing', function() { testGlob.shouldSucceed( './*.js', function(results) { - expect( - results.stdout, + expect(results.stdout, 'to contain', '["start",{"total":1}]').and( 'to contain', - '["end",{"suites":1,"tests":1,"passes":1,"pending":0,"failures":0,' + '["pass",{"title":"should find this glob/test"' ); }, done @@ -39,8 +38,11 @@ describe('globbing', function() { testGlob.shouldFail( './*-none.js ./*-none-twice.js', function(results) { - expect(results.stderr, 'to contain', 'Error: No test files found'); - expect(results.stderr, 'not to contain', '*-none'); + expect( + results.stderr, + 'to contain', + 'Error: No test files found' + ).and('not to contain', '*-none'); }, done ); @@ -50,10 +52,9 @@ describe('globbing', function() { testGlob.shouldSucceed( './*.js ./*-none.js', function(results) { - expect( - results.stdout, + expect(results.stdout, 'to contain', '["start",{"total":1}]').and( 'to contain', - '["end",{"suites":1,"tests":1,"passes":1,"pending":0,"failures":0,' + '["pass",{"title":"should find this glob/test"' ); expect( results.stderr, @@ -71,10 +72,9 @@ describe('globbing', function() { testGlob.shouldSucceed( '"./*.js"', function(results) { - expect( - results.stdout, + expect(results.stdout, 'to contain', '["start",{"total":1}]').and( 'to contain', - '["end",{"suites":1,"tests":1,"passes":1,"pending":0,"failures":0,' + '["pass",{"title":"should find this glob/test"' ); }, done @@ -109,10 +109,9 @@ describe('globbing', function() { testGlob.shouldSucceed( '"./*.js" "./*-none.js"', function(results) { - expect( - results.stdout, + expect(results.stdout, 'to contain', '["start",{"total":1}]').and( 'to contain', - '["end",{"suites":1,"tests":1,"passes":1,"pending":0,"failures":0,' + '["pass",{"title":"should find this glob/test"' ); expect( results.stderr, @@ -129,11 +128,15 @@ describe('globbing', function() { testGlob.shouldSucceed( '"./**/*.js"', function(results) { - expect( - results.stdout, - 'to contain', - '["end",{"suites":2,"tests":2,"passes":2,"pending":0,"failures":0,' - ); + expect(results.stdout, 'to contain', '["start",{"total":2}]') + .and( + 'to contain', + '["pass",{"title":"should find this glob/test"' + ) + .and( + 'to contain', + '["pass",{"title":"should find this glob/nested/test"' + ); }, done ); @@ -157,11 +160,15 @@ describe('globbing', function() { 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.stdout, 'to contain', '["start",{"total":2}]') + .and( + 'to contain', + '["pass",{"title":"should find this glob/test"' + ) + .and( + 'to contain', + '["pass",{"title":"should find this glob/nested/test"' + ); expect( results.stderr, 'to contain', @@ -187,13 +194,6 @@ var testGlob = { }) }; -var isFlakeyNode = (function() { - var version = process.versions.node.split('.'); - return ( - version[0] === '0' && version[1] === '10' && process.platform === 'win32' - ); -})(); - function execMochaWith(validate) { return function execMocha(glob, assertOn, done) { exec( @@ -206,12 +206,8 @@ function execMochaWith(validate) { function(error, stdout, stderr) { try { validate(error, stderr); - if (isFlakeyNode && error && stderr === '') { - execMocha(glob, assertOn, done); - } else { - assertOn({stdout: stdout, stderr: stderr}); - done(); - } + assertOn({stdout: stdout, stderr: stderr}); + done(); } catch (assertion) { done(assertion); }