From a8a072a2de9d890a1c52139458fde06dce01295b Mon Sep 17 00:00:00 2001 From: Gaurav Vaidya Date: Mon, 14 Jan 2019 19:14:09 -0500 Subject: [PATCH] Fixed indentation, added a check for a regex failure. --- test/test_phyx.js | 66 ++++++++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/test/test_phyx.js b/test/test_phyx.js index 61b7416..3fdcff3 100644 --- a/test/test_phyx.js +++ b/test/test_phyx.js @@ -175,43 +175,45 @@ describe('Test PHYX files in repository', function() { assert.isNotNull(matches, 'Test result line not found in STDOUT'); }); - // Test whether we have any failures. - it('did not report any failures', function() { - const failures = matches[2]; - assert.equal(failures, 0, failures + ' failures occurred during testing'); - }); + if(matches !== null) { + // Test whether we have any failures. + it('did not report any failures', function() { + const failures = matches[2]; + assert.equal(failures, 0, failures + ' failures occurred during testing'); + }); - // Look for TODOs or skipped tests. - const successes = matches[1]; - const todos = matches[3]; - const skipped = matches[4]; + // Look for TODOs or skipped tests. + const successes = matches[1]; + const todos = matches[3]; + const skipped = matches[4]; - if(todos > 0) { - // TODOs are phyloreferences that we didn't expect to resolve. - it.skip(todos + ' phyloreferences were marked as TODO during testing.'); - return; - } + if(todos > 0) { + // TODOs are phyloreferences that we didn't expect to resolve. + it.skip(todos + ' phyloreferences were marked as TODO during testing.'); + return; + } - if(skipped > 0) { - // Skipped phyloreferences are here for historical reasons: JPhyloRef - // won't actually recognize any phyloreferences as skipped. This has - // been reported as https://github.com/phyloref/jphyloref/issues/40 - it.skip(skipped + ' phyloreferences were skipped during testing.'); - return; - } + if(skipped > 0) { + // Skipped phyloreferences are here for historical reasons: JPhyloRef + // won't actually recognize any phyloreferences as skipped. This has + // been reported as https://github.com/phyloref/jphyloref/issues/40 + it.skip(skipped + ' phyloreferences were skipped during testing.'); + return; + } - // We could have zero failures but also zero successes. A Phyx file - // without any failures, TODOs or any successes in the Clade Ontology - // should be reported as a failure. - it('had at least one success', function() { - assert.isAbove(successes, 0, 'No successes occurred during testing'); - }); + // We could have zero failures but also zero successes. A Phyx file + // without any failures, TODOs or any successes in the Clade Ontology + // should be reported as a failure. + it('had at least one success', function() { + assert.isAbove(successes, 0, 'No successes occurred during testing'); + }); - // On the off chance that all of the above made sense but the exit code didn't, - // we'll check that here. - it('passed testing in JPhyloRef', function() { - assert.equal(child.status, 0, 'Exit code from JPhyloRef was not zero'); - }); + // On the off chance that all of the above made sense but the exit code didn't, + // we'll check that here. + it('passed testing in JPhyloRef', function() { + assert.equal(child.status, 0, 'Exit code from JPhyloRef was not zero'); + }); + } }); }); });