diff options
author | Stefan Giehl <stefan@piwik.org> | 2017-04-18 21:43:51 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-18 21:43:51 +0300 |
commit | 6a97e43ff69795c53c1b8dff63fc6a5cbdba8ca8 (patch) | |
tree | 5d3b8790c025ba8664a9fab1dbecfbb1f2b58dca /tests/lib/mocha-3.1.0/test/integration | |
parent | ac9d6ab9ee5cf80ad2a769d40004c20410dc1053 (diff) |
update mocha to 3.1.2 (#11625)
Diffstat (limited to 'tests/lib/mocha-3.1.0/test/integration')
72 files changed, 0 insertions, 2572 deletions
diff --git a/tests/lib/mocha-3.1.0/test/integration/diffs.spec.js b/tests/lib/mocha-3.1.0/test/integration/diffs.spec.js deleted file mode 100644 index b779b84ada..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/diffs.spec.js +++ /dev/null @@ -1,44 +0,0 @@ -var assert = require('assert'); -var helpers = require('./helpers'); -var run = helpers.runMocha; -var fs = require('fs'); -var getDiffs = helpers.getDiffs; - -function getExpectedOutput() { - var output = fs.readFileSync('test/integration/fixtures/diffs/output', 'UTF8'); - - // Diffs are delimited in file by "// DIFF" - return output.split(/\s*\/\/ DIFF/).slice(1).map(function(diff) { - return diff.split('\n').filter(Boolean).join('\n'); - }); -} - -describe('diffs', function() { - var diffs, expected; - - before(function(done) { - run('diffs/diffs.fixture.js', ['-C'], function(err, res) { - expected = getExpectedOutput(); - diffs = getDiffs(res.output); - done(err); - }); - }); - - [ - 'should display a diff for small strings', - 'should display a diff of canonicalized objects', - 'should display a diff for medium strings', - 'should display a diff for entire object dumps', - 'should display a diff for multi-line strings', - 'should display a diff for entire object dumps', - 'should display a full-comparison with escaped special characters', - 'should display a word diff for large strings', - 'should work with objects', - 'should show value diffs and not be affected by commas', - 'should display diff by data and not like an objects' - ].forEach(function(title, i) { - it(title, function() { - assert.equal(diffs[i], expected[i]); - }); - }); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/cascade.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/cascade.fixture.js deleted file mode 100644 index 10b1c37ffd..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/cascade.fixture.js +++ /dev/null @@ -1,57 +0,0 @@ -describe('one', function() { - before(function() { - console.log('before one'); - }); - - after(function() { - console.log('after one'); - }); - - beforeEach(function() { - console.log(' before each one'); - }); - - afterEach(function() { - console.log(' after each one'); - }); - - describe('two', function() { - before(function() { - console.log(' before two'); - }); - - after(function() { - console.log(' after two'); - }); - - beforeEach(function() { - console.log(' before each two'); - }); - - afterEach(function() { - console.log(' after each two'); - }); - - describe('three', function() { - before(function() { - console.log(' before three'); - }); - - after(function() { - console.log(' after three'); - }); - - beforeEach(function() { - console.log(' before each three'); - }); - - afterEach(function() { - console.log(' after each three'); - }); - - it('should three', function() { - console.log(' TEST three'); - }); - }); - }); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/diffs/diffs.css.in b/tests/lib/mocha-3.1.0/test/integration/fixtures/diffs/diffs.css.in deleted file mode 100644 index 09a3ca5363..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/diffs/diffs.css.in +++ /dev/null @@ -1,9 +0,0 @@ -body { - font: "Helvetica Neue", Helvetica, arial, sans-serif; - background: black; - color: white; -} - -a { - color: blue -} diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/diffs/diffs.css.out b/tests/lib/mocha-3.1.0/test/integration/fixtures/diffs/diffs.css.out deleted file mode 100644 index 53b3ec906e..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/diffs/diffs.css.out +++ /dev/null @@ -1,13 +0,0 @@ -body { - font: "Helvetica Neue", Helvetica, arial, sans-serif; - background: black; - color: #fff; -} - -a { - color: blue; -} - -foo { - bar: 'baz'; -} diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/diffs/diffs.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/diffs/diffs.fixture.js deleted file mode 100644 index cf538fd777..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/diffs/diffs.fixture.js +++ /dev/null @@ -1,84 +0,0 @@ -var fs = require('fs'); -var assert = require('assert'); -var cssin = fs.readFileSync('test/integration/fixtures/diffs/diffs.css.in', 'ascii'); -var cssout = fs.readFileSync('test/integration/fixtures/diffs/diffs.css.out', 'ascii'); - -describe('diffs', function() { - var actual, expected; - - it('should display a diff for small strings', function() { - actual = 'foo rar baz'; - expected = 'foo bar baz'; - actual.should.equal(expected); - }); - - it('should display a diff of canonicalized objects', function() { - actual = { name: 'travis j', age: 23 }; - expected = { age: 23, name: 'travis' }; - actual.should.equal(expected); - }); - - it('should display a diff for medium strings', function() { - actual = 'foo bar baz\nfoo rar baz\nfoo bar raz'; - expected = 'foo bar baz\nfoo bar baz\nfoo bar baz'; - actual.should.equal(expected); - }); - - it('should display a diff for entire object dumps', function() { - actual = { name: 'joel', age: 30, address: {city: 'new york', country: 'usa' }}; - expected = { name: 'joe', age: 30, address: {city: 'new york', country: 'us' }}; - actual.should.equal(expected); - }); - - it('should display a diff for multi-line strings', function() { - actual = 'one two three\nfour zzzz six\nseven eight nine'; - expected = 'one two three\nfour five six\nseven eight nine'; - actual.should.equal(expected); - }); - - it('should display a diff for entire object dumps', function() { - actual = { name: 'joel', age: 30, address: {city: 'new york', country: 'usa' }}; - expected = { name: 'joe', age: 30, address: {city: 'new york', country: 'us' }} - actual.should.equal(expected); - }); - - it('should display a full-comparison with escaped special characters', function() { - actual = 'one\ttab\ntwo\t\t\ttabs'; - expected = 'one\ttab\ntwo\t\ttabs'; - actual.should.equal(expected); - }); - - it('should display a word diff for large strings', function() { - cssin.should.equal(cssout); - }); - - it('should work with objects', function() { - actual = { - name: 'tobi', - species: 'ferret', - color: 'white', - age: 2 - }; - - expected = { - name: 'loki', - species: 'ferret', - color: 'brown', - age: 2 - }; - - actual.should.eql(expected); - }); - - it('should show value diffs and not be affected by commas', function() { - actual = { a: 123 }; - expected = { a: 123, b: 456 }; - actual.should.equal(expected); - }); - - it('should display diff by data and not like an objects', function() { - actual = new Buffer([0x01]); - expected = new Buffer([0x02]); - actual.should.equal(expected); - }); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/diffs/output b/tests/lib/mocha-3.1.0/test/integration/fixtures/diffs/output deleted file mode 100644 index bf56a96397..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/diffs/output +++ /dev/null @@ -1,91 +0,0 @@ -// DIFF - -foo rar baz - +foo bar baz - -// DIFF - { - "age": 23 - - "name": "travis j" - + "name": "travis" - } - -// DIFF - foo bar baz - -foo rar baz - -foo bar raz - +foo bar baz - +foo bar baz - -// DIFF - { - "address": { - "city": "new york" - - "country": "usa" - + "country": "us" - } - "age": 30 - - "name": "joel" - + "name": "joe" - } - -// DIFF - one two three - -four zzzz six - +four five six - seven eight nine - -// DIFF - { - "address": { - "city": "new york" - - "country": "usa" - + "country": "us" - } - "age": 30 - - "name": "joel" - + "name": "joe" - } - -// DIFF - one tab - -two tabs - +two tabs - -// DIFF - body { - font: "Helvetica Neue", Helvetica, arial, sans-serif; - background: black; - - color: white; - + color: #fff; - } - - a { - - color: blue - + color: blue; - } - + - +foo { - + bar: 'baz'; - +} - -// DIFF - { - "age": 2 - - "color": "white" - - "name": "tobi" - + "color": "brown" - + "name": "loki" - "species": "ferret" - } - -// DIFF - { - "a": 123 - + "b": 456 - } - -// DIFF - [ - - 1 - + 2 - ] diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/after-hook-async-error.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/after-hook-async-error.fixture.js deleted file mode 100644 index dc55537a60..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/after-hook-async-error.fixture.js +++ /dev/null @@ -1,19 +0,0 @@ -describe('spec 1', function () { - after(function (done) { - console.log('after'); - process.nextTick(function () { - throw new Error('after hook error'); - }); - }); - it('should be called because error is in after hook', function () { - console.log('test 1'); - }); - it('should be called because error is in after hook', function () { - console.log('test 2'); - }); -}); -describe('spec 2', function () { - it('should be called, because hook error was in a sibling suite', function () { - console.log('test 3'); - }); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/after-hook-error.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/after-hook-error.fixture.js deleted file mode 100644 index e84856e433..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/after-hook-error.fixture.js +++ /dev/null @@ -1,17 +0,0 @@ -describe('spec 1', function () { - after(function () { - console.log('after'); - throw new Error('after hook error'); - }); - it('should be called because error is in after hook', function () { - console.log('test 1'); - }); - it('should be called because error is in after hook', function () { - console.log('test 2'); - }); -}); -describe('spec 2', function () { - it('should be called, because hook error was in a sibling suite', function () { - console.log('test 3'); - }); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/afterEach-hook-async-error.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/afterEach-hook-async-error.fixture.js deleted file mode 100644 index d4f4c9bdd9..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/afterEach-hook-async-error.fixture.js +++ /dev/null @@ -1,19 +0,0 @@ -describe('spec 1', function () { - afterEach(function (done) { - console.log('after'); - process.nextTick(function () { - throw new Error('after each hook error'); - }); - }); - it('should be called because error is in after each hook', function () { - console.log('test 1'); - }); - it('should not be called', function () { - console.log('test 2'); - }); -}); -describe('spec 2', function () { - it('should be called, because hook error was in a sibling suite', function () { - console.log('test 3'); - }); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/afterEach-hook-error.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/afterEach-hook-error.fixture.js deleted file mode 100644 index 9d28632fa3..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/afterEach-hook-error.fixture.js +++ /dev/null @@ -1,17 +0,0 @@ -describe('spec 1', function () { - afterEach(function () { - console.log('after'); - throw new Error('after each hook error'); - }); - it('should be called because error is in after each hook', function () { - console.log('test 1'); - }); - it('should not be called', function () { - console.log('test 2'); - }); -}); -describe('spec 2', function () { - it('should be called, because hook error was in a sibling suite', function () { - console.log('test 3'); - }); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/before-hook-async-error-tip.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/before-hook-async-error-tip.fixture.js deleted file mode 100644 index 14e114e959..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/before-hook-async-error-tip.fixture.js +++ /dev/null @@ -1,11 +0,0 @@ -describe('spec 1', function() { - it('should not blame me', function() { }); -}); -describe('spec 2', function() { - before(function(done) { - process.nextTick(function () { - throw new Error('before hook error'); - }); - }); - it('skipped'); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/before-hook-async-error.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/before-hook-async-error.fixture.js deleted file mode 100644 index 10ea95156b..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/before-hook-async-error.fixture.js +++ /dev/null @@ -1,19 +0,0 @@ -describe('spec 1', function () { - before(function (done) { - console.log('before'); - process.nextTick(function () { - throw new Error('before hook error'); - }); - }); - it('should not be called because of error in before hook', function () { - console.log('test 1'); - }); - it('should not be called because of error in before hook', function () { - console.log('test 2'); - }); -}); -describe('spec 2', function () { - it('should be called, because hook error was in a sibling suite', function () { - console.log('test 3'); - }); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/before-hook-error-tip.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/before-hook-error-tip.fixture.js deleted file mode 100644 index 567dfef26b..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/before-hook-error-tip.fixture.js +++ /dev/null @@ -1,9 +0,0 @@ -describe('spec 1', function() { - it('should not blame me', function() { }); -}); -describe('spec 2', function() { - before(function() { - throw new Error('before hook error'); - }); - it('skipped'); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/before-hook-error.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/before-hook-error.fixture.js deleted file mode 100644 index b3d6ea6640..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/before-hook-error.fixture.js +++ /dev/null @@ -1,17 +0,0 @@ -describe('spec 1', function () { - before(function () { - console.log('before'); - throw new Error('before hook error'); - }); - it('should not be called because of error in before hook', function () { - console.log('test 1'); - }); - it('should not be called because of error in before hook', function () { - console.log('test 2'); - }); -}); -describe('spec 2', function () { - it('should be called, because hook error was in a sibling suite', function () { - console.log('test 3'); - }); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/beforeEach-hook-async-error.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/beforeEach-hook-async-error.fixture.js deleted file mode 100644 index a34ed755e2..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/beforeEach-hook-async-error.fixture.js +++ /dev/null @@ -1,19 +0,0 @@ -describe('spec 1', function () { - beforeEach(function (done) { - console.log('before'); - process.nextTick(function () { - throw new Error('before each hook error'); - }); - }); - it('should not be called because of error in before each hook', function () { - console.log('test 1'); - }); - it('should not be called because of error in before each hook', function () { - console.log('test 2'); - }); -}); -describe('spec 2', function () { - it('should be called, because hook error was in a sibling suite', function () { - console.log('test 3'); - }); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/beforeEach-hook-error.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/beforeEach-hook-error.fixture.js deleted file mode 100644 index bd84e8fe74..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/beforeEach-hook-error.fixture.js +++ /dev/null @@ -1,17 +0,0 @@ -describe('spec 1', function () { - beforeEach(function () { - console.log('before'); - throw new Error('before each hook error'); - }); - it('should not be called because of error in before each hook', function () { - console.log('test 1'); - }); - it('should not be called because of error in before each hook', function () { - console.log('test 2'); - }); -}); -describe('spec 2', function () { - it('should be called, because hook error was in a sibling suite', function () { - console.log('test 3'); - }); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/multiple-hook-async-error.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/multiple-hook-async-error.fixture.js deleted file mode 100644 index 93ace7ff0d..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/multiple-hook-async-error.fixture.js +++ /dev/null @@ -1,139 +0,0 @@ -before(function () { - console.log('root before'); -}); -beforeEach(function () { - console.log('root before each'); -}); -describe('1', function () { - beforeEach(function () { - console.log('1 before each'); - }); - - describe('1-1', function () { - before(function () { - console.log('1-1 before'); - }); - beforeEach(function (done) { - console.log('1-1 before each'); - process.nextTick(function () { - throw new Error('1-1 before each hook failed'); - }); - }); - it('1-1 test 1', function () { - console.log('1-1 test 1'); - }); - it('1-1 test 2', function () { - console.log('1-1 test 2'); - }); - afterEach(function () { - console.log('1-1 after each'); - }); - after(function (done) { - console.log('1-1 after'); - process.nextTick(function () { - throw new Error('1-1 after hook failed'); - }); - }); - }); - - describe('1-2', function () { - before(function () { - console.log('1-2 before'); - }); - beforeEach(function () { - console.log('1-2 before each'); - }); - it('1-2 test 1', function () { - console.log('1-2 test 1'); - }); - it('1-2 test 2', function () { - console.log('1-2 test 2'); - }); - afterEach(function (done) { - console.log('1-2 after each'); - process.nextTick(function () { - throw new Error('1-2 after each hook failed'); - }); - }); - after(function () { - console.log('1-2 after'); - }); - }); - - afterEach(function () { - console.log('1 after each'); - }); - - after(function () { - console.log('1 after'); - }); -}); - -describe('2', function () { - beforeEach(function (done) { - console.log('2 before each'); - process.nextTick(function () { - throw new Error('2 before each hook failed'); - }); - }); - - describe('2-1', function () { - before(function () { - console.log('2-1 before'); - }); - beforeEach(function () { - console.log('2-1 before each'); - }); - it('2-1 test 1', function () { - console.log('2-1 test 1'); - }); - it('2-1 test 2', function () { - console.log('2-1 test 2'); - }); - afterEach(function () { - console.log('2-1 after each'); - }); - after(function () { - console.log('2-1 after'); - }); - }); - - describe('2-2', function () { - before(function () { - console.log('2-2 before'); - }); - beforeEach(function () { - console.log('2-2 before each'); - }); - it('2-2 test 1', function () { - console.log('2-2 test 1'); - }); - it('2-2 test 2', function () { - console.log('2-2 test 2'); - }); - afterEach(function () { - console.log('2-2 after each'); - }); - after(function () { - console.log('2-2 after'); - }); - }); - - afterEach(function (done) { - console.log('2 after each'); - process.nextTick(function () { - throw new Error('2 after each hook failed'); - }); - }); - - after(function () { - console.log('2 after'); - }); -}); - -after(function () { - console.log('root after'); -}); -afterEach(function () { - console.log('root after each'); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/multiple-hook-error.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/multiple-hook-error.fixture.js deleted file mode 100644 index 53d167b1cf..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/hooks/multiple-hook-error.fixture.js +++ /dev/null @@ -1,129 +0,0 @@ -before(function () { - console.log('root before'); -}); -beforeEach(function () { - console.log('root before each'); -}); -describe('1', function () { - beforeEach(function () { - console.log('1 before each'); - }); - - describe('1-1', function () { - before(function () { - console.log('1-1 before'); - }); - beforeEach(function () { - console.log('1-1 before each'); - throw new Error('1-1 before each hook failed'); - }); - it('1-1 test 1', function () { - console.log('1-1 test 1'); - }); - it('1-1 test 2', function () { - console.log('1-1 test 2'); - }); - afterEach(function () { - console.log('1-1 after each'); - }); - after(function () { - console.log('1-1 after'); - throw new Error('1-1 after hook failed'); - }); - }); - - describe('1-2', function () { - before(function () { - console.log('1-2 before'); - }); - beforeEach(function () { - console.log('1-2 before each'); - }); - it('1-2 test 1', function () { - console.log('1-2 test 1'); - }); - it('1-2 test 2', function () { - console.log('1-2 test 2'); - }); - afterEach(function () { - console.log('1-2 after each'); - throw new Error('1-2 after each hook failed'); - }); - after(function () { - console.log('1-2 after'); - }); - }); - - afterEach(function () { - console.log('1 after each'); - }); - - after(function () { - console.log('1 after'); - }); -}); - -describe('2', function () { - beforeEach(function () { - console.log('2 before each'); - throw new Error('2 before each hook failed'); - }); - - describe('2-1', function () { - before(function () { - console.log('2-1 before'); - }); - beforeEach(function () { - console.log('2-1 before each'); - }); - it('2-1 test 1', function () { - console.log('2-1 test 1'); - }); - it('2-1 test 2', function () { - console.log('2-1 test 2'); - }); - afterEach(function () { - console.log('2-1 after each'); - }); - after(function () { - console.log('2-1 after'); - }); - }); - - describe('2-2', function () { - before(function () { - console.log('2-2 before'); - }); - beforeEach(function () { - console.log('2-2 before each'); - }); - it('2-2 test 1', function () { - console.log('2-2 test 1'); - }); - it('2-2 test 2', function () { - console.log('2-2 test 2'); - }); - afterEach(function () { - console.log('2-2 after each'); - }); - after(function () { - console.log('2-2 after'); - }); - }); - - afterEach(function () { - console.log('2 after each'); - throw new Error('2 after each hook failed'); - }); - - after(function () { - console.log('2 after'); - }); -}); - -after(function () { - console.log('root after'); -}); -afterEach(function () { - console.log('root after each'); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/multiple-done-before.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/multiple-done-before.fixture.js deleted file mode 100644 index 80d4adb61a..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/multiple-done-before.fixture.js +++ /dev/null @@ -1,10 +0,0 @@ -describe('suite', function() { - before(function(done) { - setTimeout(done, 10); - setTimeout(done, 30); - }); - - it('test1', function(done) { - setTimeout(done, 50); - }); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/multiple-done-beforeEach.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/multiple-done-beforeEach.fixture.js deleted file mode 100644 index 9b4724dea1..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/multiple-done-beforeEach.fixture.js +++ /dev/null @@ -1,14 +0,0 @@ -describe('suite', function() { - beforeEach(function(done) { - setTimeout(done, 10); - setTimeout(done, 20); - }); - - it('test1', function(done) { - setTimeout(done, 50); - }); - - it('test2', function(done) { - setTimeout(done, 50); - }); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/multiple-done-specs.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/multiple-done-specs.fixture.js deleted file mode 100644 index 82197061f1..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/multiple-done-specs.fixture.js +++ /dev/null @@ -1,10 +0,0 @@ -describe('suite', function() { - it('test1', function(done) { - done(); - setTimeout(done, 10); - }); - - it('test2', function(done) { - setTimeout(done, 20); - }); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/multiple-done.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/multiple-done.fixture.js deleted file mode 100644 index 63a704061c..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/multiple-done.fixture.js +++ /dev/null @@ -1,18 +0,0 @@ -// The suite below should result in an additional error, but does -// not. Uncomment once this bug is resolved. - -// describe('suite', function() { -// beforeEach(function(done) { -// done(); -// done(); -// }); - -// it('test', function() {}); -// }); - -it('should fail in a test-case', function(done) { - process.nextTick(function(){ - done(); - done(); - }); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/options/async-only-async.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/options/async-only-async.fixture.js deleted file mode 100644 index 5387d169b7..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/options/async-only-async.fixture.js +++ /dev/null @@ -1,3 +0,0 @@ -it('should pass', function(done){ - done(); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/options/async-only-sync.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/options/async-only-sync.fixture.js deleted file mode 100644 index d0dd9fa828..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/options/async-only-sync.fixture.js +++ /dev/null @@ -1 +0,0 @@ -it('throws an error', function() {}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/options/bail.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/options/bail.fixture.js deleted file mode 100644 index 32d17e9aa8..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/options/bail.fixture.js +++ /dev/null @@ -1,21 +0,0 @@ -describe('suite1', function() { - it('should display this spec', function() {}); - - it('should only display this error', function(done) { - throw new Error('this should be displayed'); - }); - - it('should not display this error', function(done) { - throw new Error('this should not be displayed'); - }); -}); - -describe('suite2', function() { - before(function(done) { - throw new Error('this hook should not be displayed'); - }); - - it('should not display this error', function(done) { - throw new Error('this should not be displayed'); - }); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/options/delay-fail.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/options/delay-fail.fixture.js deleted file mode 100644 index 1475c918d4..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/options/delay-fail.fixture.js +++ /dev/null @@ -1,5 +0,0 @@ -setTimeout(function() { - throw new Error('oops'); - it('test', function() {}); - run(); -}, 100); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/options/delay.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/options/delay.fixture.js deleted file mode 100644 index a8bf2d4112..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/options/delay.fixture.js +++ /dev/null @@ -1,14 +0,0 @@ -var assert = require('assert'); -var delay = 500; - -setTimeout(function() { - describe('delayed execution', function() { - it('should have no effect if attempted twice in the same suite', function() { - assert(true); - run(); - assert(true); - }); - }); - - run(); -}, delay); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/options/grep.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/options/grep.fixture.js deleted file mode 100644 index 94785dc7db..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/options/grep.fixture.js +++ /dev/null @@ -1,17 +0,0 @@ -describe('grep', function() { - describe('Match', function() { - it('should run', function(){}); - it('should also run', function() {}); - }); - - describe('match', function() { - it('should run', function(){}); - it('should also run', function() {}); - }); - - describe('fail', function() { - it('should not be ran', function() { - throw new Error('Spec should not run'); - }); - }); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/options/only/bdd.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/options/only/bdd.fixture.js deleted file mode 100644 index 783ce19b0b..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/options/only/bdd.fixture.js +++ /dev/null @@ -1,71 +0,0 @@ -describe.only('should run this suite', function() { - it('should run this test', function() {}); - - it('should run this test', function() {}); - - it('should run this test', function() {}); -}); - -describe('should not run this suite', function() { - it('should not run this test', function() { - (true).should.equal(false); - }); - - it('should not run this test', function() { - (true).should.equal(false); - }); - - it('should not run this test', function() { - (true).should.equal(false); - }); -}); - -describe.only('should run this suite too', function() { - describe('should run this nested suite', function () { - it('should run this test', function() {}); - - it('should run this test', function() {}); - - it('should run this test', function() {}); - }); -}); - -describe.only('should run this suite, even', function() { - describe('should run this nested suite, even', function () { - describe('should run this doubly-nested suite!', function () { - it('should run this test', function() {}); - - it('should run this test', function() {}); - - it('should run this test', function() {}); - }); - }); -}); - - -describe('should run this suite with an exclusive test', function() { - it.only('should run this test', function () {}); - - describe('should not run this nested suite', function () { - describe.only('should not run this doubly-nested suite', function () { - it('should not run this test', function() {}); - - it('should not run this test', function() {}); - - it('should not run this test', function() {}); - }); - }); -}); - -describe('should run this suite with an exclusive test (reverse order)', function() { - describe('should not run this nested suite', function () { - describe.only('should not run this doubly-nested suite', function () { - it('should not run this test', function() {}); - - it('should not run this test', function() {}); - - it('should not run this test', function() {}); - }); - }); - it.only('should run this test', function () {}); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/options/only/qunit.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/options/only/qunit.fixture.js deleted file mode 100644 index 9fa95f440b..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/options/only/qunit.fixture.js +++ /dev/null @@ -1,26 +0,0 @@ -suite.only('should run all tests in this suite'); - -test('should run this test #1', function() {}); - -test('should run this test #2', function() {}); - -test('should run this test #3', function() {}); - -test('should run this test #4', function() {}); - -test('should run this test #5', function() {}); - - -suite('should not run any of this suite\'s tests'); - -test('should not run this test', function() { - (false).should.equal(true); -}); - -test('should not run this test', function() { - (false).should.equal(true); -}); - -test('should not run this test', function() { - (false).should.equal(true); -});
\ No newline at end of file diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/options/only/tdd.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/options/only/tdd.fixture.js deleted file mode 100644 index 129a9e5d74..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/options/only/tdd.fixture.js +++ /dev/null @@ -1,35 +0,0 @@ -suite.only('should run all tests in this tdd suite', function() { - test('should run this test #1', function() {}); - - test('should run this test #2', function() {}); - - test('should run this test #3', function() {}); - - test('should run this test #4', function() {}); -}); - -suite('should not run this suite', function() { - test('should not run this test', function() { - (true).should.equal(false); - }); - - test('should not run this test', function() { - (true).should.equal(false); - }); - - test('should not run this test', function() { - (true).should.equal(false); - }); -}); - -suite.only('should run this suite too', function() { - suite('should run this nested suite', function () { - test('should run this test', function() {}); - - test('should run this test', function() {}); - - test('should run this test', function() {}); - - test('should run this test', function() {}); - }); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/options/retries.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/options/retries.fixture.js deleted file mode 100644 index b2f76e12ea..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/options/retries.fixture.js +++ /dev/null @@ -1,5 +0,0 @@ -describe('retries', function() { - it('should fail', function () { - throw new Error('retry failure'); - }); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/options/sort-alpha.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/options/sort-alpha.fixture.js deleted file mode 100644 index 7a5302994f..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/options/sort-alpha.fixture.js +++ /dev/null @@ -1,7 +0,0 @@ -describe('alpha', function(){ - it('should be executed first', function(){ - if (global.beta) { - throw new Error('alpha was not executed first'); - } - }); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/options/sort-beta.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/options/sort-beta.fixture.js deleted file mode 100644 index 0951f49038..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/options/sort-beta.fixture.js +++ /dev/null @@ -1,5 +0,0 @@ -describe('beta', function(){ - it('should be executed second', function(){ - global.beta = 1; - }); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/passing.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/passing.fixture.js deleted file mode 100644 index df91b3e501..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/passing.fixture.js +++ /dev/null @@ -1,11 +0,0 @@ -var assert = require('assert'); - -describe('suite', function() { - it('test1', function() { - assert(true); - }); - - it('test2', function() { - assert(true); - }); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/pending/skip-async-before.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/pending/skip-async-before.fixture.js deleted file mode 100644 index 114db36d88..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/pending/skip-async-before.fixture.js +++ /dev/null @@ -1,16 +0,0 @@ -describe('skip in before', function() { - before(function(done) { - var self = this; - setTimeout(function() { - self.skip(); - }, 50); - }); - - it('should never run this test', function() { - throw new Error('never thrown'); - }); - - it('should never run this test', function() { - throw new Error('never thrown'); - }); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/pending/skip-async-beforeEach.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/pending/skip-async-beforeEach.fixture.js deleted file mode 100644 index b8db22b94a..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/pending/skip-async-beforeEach.fixture.js +++ /dev/null @@ -1,16 +0,0 @@ -describe('skip in beforeEach', function() { - beforeEach(function(done) { - var self = this; - setTimeout(function() { - self.skip(); - }, 50); - }); - - it('should never run this test', function() { - throw new Error('never thrown'); - }); - - it('should never run this test', function() { - throw new Error('never thrown'); - }); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/pending/skip-async-spec.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/pending/skip-async-spec.fixture.js deleted file mode 100644 index 6096c59d2a..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/pending/skip-async-spec.fixture.js +++ /dev/null @@ -1,12 +0,0 @@ -describe('skip in test', function() { - it('should skip async', function(done) { - var self = this; - setTimeout(function() { - self.skip(); - }, 50); - }); - - it('should run other tests in the suite', function() { - // Do nothing - }); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/pending/skip-sync-before.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/pending/skip-sync-before.fixture.js deleted file mode 100644 index 35152e27f4..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/pending/skip-sync-before.fixture.js +++ /dev/null @@ -1,13 +0,0 @@ -describe('skip in before', function() { - before(function() { - this.skip(); - }); - - it('should never run this test', function() { - throw new Error('never thrown'); - }); - - it('should never run this test', function() { - throw new Error('never thrown'); - }); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/pending/skip-sync-beforeEach.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/pending/skip-sync-beforeEach.fixture.js deleted file mode 100644 index 8d1c442ce2..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/pending/skip-sync-beforeEach.fixture.js +++ /dev/null @@ -1,13 +0,0 @@ -describe('skip in beforeEach', function() { - beforeEach(function() { - this.skip(); - }); - - it('should never run this test', function() { - throw new Error('never thrown'); - }); - - it('should never run this test', function() { - throw new Error('never thrown'); - }); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/pending/skip-sync-spec.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/pending/skip-sync-spec.fixture.js deleted file mode 100644 index e2bbb739b3..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/pending/skip-sync-spec.fixture.js +++ /dev/null @@ -1,10 +0,0 @@ -describe('skip in test', function() { - it('should skip immediately', function() { - this.skip(); - throw new Error('never thrown'); - }); - - it('should run other tests in the suite', function() { - // Do nothing - }); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/pending/spec.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/pending/spec.fixture.js deleted file mode 100644 index 084dd33588..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/pending/spec.fixture.js +++ /dev/null @@ -1,3 +0,0 @@ -describe('suite', function() { - it('pending spec'); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/regression/1794/issue-1794.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/regression/1794/issue-1794.fixture.js deleted file mode 100644 index 1a1637f30a..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/regression/1794/issue-1794.fixture.js +++ /dev/null @@ -1,3 +0,0 @@ -test('pass', function() { - // pass -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/regression/1794/simple-ui.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/regression/1794/simple-ui.js deleted file mode 100644 index 1fdf33d665..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/regression/1794/simple-ui.js +++ /dev/null @@ -1,27 +0,0 @@ -var path = '../../../../../lib/', - Mocha = require(path + 'mocha'); - Suite = require(path + 'suite'), - Test = require(path + 'test'); - -/** - * A simple UI that only exposes a single function: test - */ -module.exports = Mocha.interfaces['simple-ui'] = function(suite) { - suite.on('pre-require', function(context, file, mocha) { - var common = require(path + 'interfaces/common')([suite], context); - - context.run = mocha.options.delay && common.runWithSuite(suite); - - /** - * Describes a specification or test-case with the given `title` - * and callback `fn` acting as a thunk. - */ - context.test = function(title, fn) { - var test = new Test(title, fn); - test.file = file; - suite.addTest(test); - - return test; - }; - }); -}; diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/regression/issue-1327.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/regression/issue-1327.fixture.js deleted file mode 100644 index 43d5553762..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/regression/issue-1327.fixture.js +++ /dev/null @@ -1,15 +0,0 @@ -it('test 1', function() { - console.log('testbody1'); - process.nextTick(function() { - throw 'Too bad'; - }); -}); - -it('test 2', function() { - console.log('testbody2'); -}); - -it('test 3', function() { - console.log('testbody3'); - throw new Error('OUCH'); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/regression/issue-1991.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/regression/issue-1991.fixture.js deleted file mode 100644 index 96860332a2..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/regression/issue-1991.fixture.js +++ /dev/null @@ -1,47 +0,0 @@ -function MemoryLeak() { - this.myArr = []; - for (var i = 0; i < 1000000; i++) { - this.myArr.push(i) - } -} - -var numOfTests = 300; -for (var i = 0; i < numOfTests; i += 1) { - /* - * This Test suite will crash V8 due to: - * 'FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory' - * if all the deferred functions references have not been cleared - */ - describe('Memory Leak Suite #' + i, function () { - - // The <closureVar> variable will be accessed by the test below. - // As long as those test's functions are - // referenced in memory, the closure variable may not be garbage collected - // as it is still referenced. - // * In a chrome heap snapshot it will appear under "system / Context" (a scope) - var closureVar; - - before(function () { - var x = closureVar ? 1 : 2 - }); - - after(function () { - var x = closureVar[0] - }); - - beforeEach(function () { - var x = closureVar ? 1 : 2 - }); - - afterEach(function () { - var x = closureVar[0] - }); - - it('access a variable via a closure', function () { - // slow performance on older node.js versions - this.timeout(1000); - closureVar = new MemoryLeak(); - }); - - }); -} diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/regression/issue-2315.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/regression/issue-2315.js deleted file mode 100644 index cdfb201059..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/regression/issue-2315.js +++ /dev/null @@ -1,9 +0,0 @@ -describe('issue-2315: cannot read property currentRetry of undefined', function () { - before(function () { - process.nextTick(function () { - throw new Error(); - }); - }); - - it('something', function () {}); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/regression/issue-2406.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/regression/issue-2406.fixture.js deleted file mode 100644 index c800228f1e..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/regression/issue-2406.fixture.js +++ /dev/null @@ -1,15 +0,0 @@ -describe('outer describe', function() { - it('should not run this test', function() {}); - describe('this suite should not run', function() { - it('should not run this test', function() {}); - }); - describe.only('this .only suite should run', function() { - describe('this suite should run', function() { - it('should run this test in a nested suite', function() {}); - }); - it('should run this test', function() {}); - }); - describe('this suite should not run', function() { - it('should not run this test', function() {}); - }); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/regression/issue-2417.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/regression/issue-2417.fixture.js deleted file mode 100644 index e14aab09db..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/regression/issue-2417.fixture.js +++ /dev/null @@ -1,7 +0,0 @@ -describe('outer describe', function() { - describe.only('outer describe.only', function() { - it.only('inner it.only', function() { - // should run and exit without error - }); - }); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/retries/async.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/retries/async.fixture.js deleted file mode 100644 index 0e917e52f3..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/retries/async.fixture.js +++ /dev/null @@ -1,28 +0,0 @@ -describe('retries', function() { - var times = 0; - before(function () { - console.log('before'); - }); - - after(function () { - console.log('after'); - }); - - beforeEach(function() { - console.log('before each', times); - }); - - afterEach(function () { - console.log('after each', times); - }); - - it('should allow override and run appropriate hooks', function (done) { - this.timeout(200); - this.retries(2); - console.log('TEST', times); - if (++times < 3) { - return setTimeout(done, 300); - } - setTimeout(done, 50); - }); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/retries/early-pass.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/retries/early-pass.fixture.js deleted file mode 100644 index 0010d120fa..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/retries/early-pass.fixture.js +++ /dev/null @@ -1,11 +0,0 @@ -describe('retries', function() { - this.retries(1); - var times = 0; - - it('should pass after 1 retry', function() { - times++; - if (times !== 2) { - throw new Error('retry error ' + times); - } - }); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/retries/hooks.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/retries/hooks.fixture.js deleted file mode 100644 index 47f6c6a1b7..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/retries/hooks.fixture.js +++ /dev/null @@ -1,25 +0,0 @@ -describe('retries', function() { - var times = 0; - before(function () { - console.log('before'); - }); - - after(function () { - console.log('after'); - }); - - beforeEach(function() { - console.log('before each', times); - }); - - afterEach(function () { - console.log('after each', times); - }); - - it('should allow override and run appropriate hooks', function(){ - this.retries(4); - console.log('TEST', times); - times++; - throw new Error('retry error'); - }); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/retries/nested.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/retries/nested.fixture.js deleted file mode 100644 index 43c40cb236..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/retries/nested.fixture.js +++ /dev/null @@ -1,9 +0,0 @@ -describe('retries', function() { - this.retries(3); - describe('nested', function () { - it('should fail after only 1 retry', function(){ - this.retries(1); - throw new Error('retry error'); - }); - }); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/suite/suite-no-callback.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/suite/suite-no-callback.fixture.js deleted file mode 100644 index de55b358a3..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/suite/suite-no-callback.fixture.js +++ /dev/null @@ -1 +0,0 @@ -describe('a suite without a callback'); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/suite/suite-skipped-callback.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/suite/suite-skipped-callback.fixture.js deleted file mode 100644 index b30b67ee2e..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/suite/suite-skipped-callback.fixture.js +++ /dev/null @@ -1 +0,0 @@ -xdescribe('a pending suite with a callback', function () {}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/suite/suite-skipped-no-callback.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/suite/suite-skipped-no-callback.fixture.js deleted file mode 100644 index c5bca84a47..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/suite/suite-skipped-no-callback.fixture.js +++ /dev/null @@ -1 +0,0 @@ -xdescribe('a pending suite without a callback'); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/timeout.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/timeout.fixture.js deleted file mode 100644 index d8c99b2bc3..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/timeout.fixture.js +++ /dev/null @@ -1,17 +0,0 @@ -describe('timeout', function(){ - this.timeout(1); - - it('should be honored with sync suites', function() { - sleep(2); - }); - - it('should be honored with async suites', function(done) { - sleep(2); - done(); - }); - - function sleep(ms) { - var start = Date.now(); - while (start + ms > Date.now()); - } -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/uncaught-hook.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/uncaught-hook.fixture.js deleted file mode 100644 index 9adcb3f726..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/uncaught-hook.fixture.js +++ /dev/null @@ -1,15 +0,0 @@ -describe('uncaught', function() { - beforeEach(function(done) { - process.nextTick(function() { - throw new Error('oh noes'); - done(); - }); - }); - - it('test', function(done) { - process.nextTick(function() { - throw new Error("I'm uncaught!"); - done(); - }); - }); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/fixtures/uncaught.fixture.js b/tests/lib/mocha-3.1.0/test/integration/fixtures/uncaught.fixture.js deleted file mode 100644 index 054d1d857b..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/fixtures/uncaught.fixture.js +++ /dev/null @@ -1,26 +0,0 @@ -'use strict'; - -/** - * This file should only generate one failure per spec despite the fact that - * Mocha is capable of detecting two distinct exceptions during test execution. - */ - -it('fails exactly once when a global error is thrown first', function(done) { - setTimeout(function() { - throw new Error('global error'); - - setTimeout(function() { - done(new Error('test error')); - }, 0); - }, 0); -}); - -it('fails exactly once when a global error is thrown second', function(done) { - setTimeout(function() { - done(new Error('test error')); - }, 0); - - setTimeout(function() { - throw new Error('global error'); - }, 0); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/helpers.js b/tests/lib/mocha-3.1.0/test/integration/helpers.js deleted file mode 100644 index 2720eb3bda..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/helpers.js +++ /dev/null @@ -1,191 +0,0 @@ -var spawn = require('child_process').spawn; -var path = require('path'); -var fs = require('fs'); -var baseReporter = require('../../lib/reporters/base'); - -module.exports = { - /** - * Invokes the mocha binary for the given fixture with color output disabled. - * Accepts an array of additional command line args to pass. The callback is - * invoked with a summary of the run, in addition to its output. The summary - * includes the number of passing, pending, and failing tests, as well as the - * exit code. Useful for testing different reporters. - * - * Example response: - * { - * pending: 0, - * passing: 0, - * failing: 1, - * code: 1, - * output: '...' - * } - * - * @param {string} fixturePath - * @param {array} args - * @param {function} fn - */ - runMocha: function(fixturePath, args, fn) { - var path; - - path = resolveFixturePath(fixturePath); - args = args || []; - - invokeMocha(args.concat(['-C', path]), function(err, res) { - if (err) return fn(err); - - fn(null, getSummary(res)); - }); - }, - - /** - * Invokes the mocha binary on the code of the body of the function. - * Accepts an array of additional command line args to pass. The callback is - * invoked with a summary of the run, in addition to its output. The summary - * includes the number of passing, pending, and failing tests, as well as the - * exit code. Useful for testing different reporters. - * - * Example response: - * { - * pending: 0, - * passing: 0, - * failing: 1, - * code: 1, - * output: '...' - * } - * - * @param {function} fixture - * @param {array} args - * @param {function} fn - */ - runMochaFunction: function(fixture, args, fn) { - var path = resolveFixturePath(fixture.name + '.js' || 'tempfile.js'); - args = args || []; - - var fixtureContent = 'var fn = ' + fixture.toString() + '; fn()'; - fs.writeFileSync(path, fixtureContent, 'utf8'); - - function cleanup() { - fs.unlink(path); - fn.apply(this, arguments); - } - - invokeMocha(args.concat(['-C', path]), function(err, res) { - if (err) { - return cleanup(err); - } - - cleanup(null, getSummary(res)); - }); - }, - - /** - * Invokes the mocha binary for the given fixture using the JSON reporter, - * returning the parsed output, as well as exit code. - * - * @param {string} fixturePath - * @param {array} args - * @param {function} fn - */ - runMochaJSON: function(fixturePath, args, fn) { - var path; - - path = resolveFixturePath(fixturePath); - args = args || []; - - invokeMocha(args.concat(['--reporter', 'json', path]), function(err, res) { - if (err) return fn(err); - - try { - var result = JSON.parse(res.output); - result.code = res.code; - } catch (err) { - return fn(err); - } - - fn(null, result); - }); - }, - - /** - * Returns an array of diffs corresponding to exceptions thrown from specs, - * given the plaintext output (-C) of a mocha run. - * - * @param {string} output - * returns {string[]} - */ - getDiffs: function(output) { - var diffs, i, inDiff, inStackTrace; - - diffs = []; - output.split('\n').forEach(function(line) { - if (line.match(/^ \d+\)/)) { - // New spec, e.g. "1) spec title" - diffs.push([]); - i = diffs.length - 1; - inStackTrace = false; - inDiff = false; - } else if (!diffs.length || inStackTrace) { - // Haven't encountered a spec yet - // or we're in the middle of a stack trace - return; - } else if (line.indexOf('+ expected - actual') !== -1) { - inDiff = true; - } else if (line.match(/at Context/)) { - // At the start of a stack trace - inStackTrace = true; - inDiff = false; - } else if (inDiff) { - diffs[i].push(line); - } - }); - - // Ignore empty lines before/after diff - return diffs.map(function(diff) { - return diff.slice(1, -3).join('\n'); - }); - }, - - /** - * regular expression used for splitting lines based on new line / dot symbol. - */ - splitRegExp: new RegExp('[\\n' + baseReporter.symbols.dot + ']+') -}; - -function invokeMocha(args, fn) { - var output, mocha, listener; - - output = ''; - args = [path.join('bin', 'mocha')].concat(args); - mocha = spawn(process.execPath, args); - - listener = function(data) { - output += data; - }; - - mocha.stdout.on('data', listener); - mocha.stderr.on('data', listener); - mocha.on('error', fn); - - mocha.on('close', function(code) { - fn(null, { - output: output.split('\n').join('\n'), - code: code - }); - }); -} - -function resolveFixturePath(fixture) { - return path.join('./test/integration/fixtures', fixture); -} - -function getSummary(res) { - return ['passing', 'pending', 'failing'].reduce(function(summary, type) { - var pattern, match; - - pattern = new RegExp(' (\\d+) ' + type + '\\s'); - match = pattern.exec(res.output); - summary[type] = (match) ? parseInt(match, 10) : 0; - - return summary; - }, res); -} diff --git a/tests/lib/mocha-3.1.0/test/integration/hook-err.spec.js b/tests/lib/mocha-3.1.0/test/integration/hook-err.spec.js deleted file mode 100644 index be18721f31..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/hook-err.spec.js +++ /dev/null @@ -1,215 +0,0 @@ -var assert = require('assert'); -var runMocha = require('./helpers').runMocha; -var splitRegExp = require('./helpers').splitRegExp; -var bang = require('../../lib/reporters/base').symbols.bang; - -describe('hook error handling', function() { - var lines; - - describe('before hook error', function() { - before(run('hooks/before-hook-error.fixture.js')); - it('should verify results', function() { - assert.deepEqual( - lines, - ['before', bang + 'test 3'] - ); - }); - }); - - describe('before hook error tip', function() { - before(run('hooks/before-hook-error-tip.fixture.js', onlyErrorTitle)); - it('should verify results', function() { - assert.deepEqual( - lines, - ['1) spec 2 "before all" hook:'] - ); - }); - }); - - describe('before each hook error', function() { - before(run('hooks/beforeEach-hook-error.fixture.js')); - it('should verify results', function() { - assert.deepEqual( - lines, - ['before', bang + 'test 3'] - ); - }); - }); - - describe('after hook error', function() { - before(run('hooks/after-hook-error.fixture.js')); - it('should verify results', function() { - assert.deepEqual( - lines, - ['test 1', 'test 2', 'after', bang + 'test 3'] - ); - }); - }); - - describe('after each hook error', function() { - before(run('hooks/afterEach-hook-error.fixture.js')); - it('should verify results', function() { - assert.deepEqual( - lines, - ['test 1', 'after', bang + 'test 3'] - ); - }); - }); - - describe('multiple hook errors', function() { - before(run('hooks/multiple-hook-error.fixture.js')); - it('should verify results', function() { - assert.deepEqual( - lines, - [ - 'root before', - '1-1 before', - 'root before each', - '1 before each', - '1-1 before each', - bang + '1-1 after each', - '1 after each', - 'root after each', - '1-1 after', - bang + '1-2 before', - 'root before each', - '1 before each', - '1-2 before each', - '1-2 test 1', - '1-2 after each', - bang + '1 after each', - 'root after each', - '1-2 after', - '1 after', - '2-1 before', - 'root before each', - '2 before each', - bang + '2 after each', - bang + 'root after each', - '2-1 after', - '2 after', - 'root after' - ] - ); - }); - }); - - describe('async - before hook error', function() { - before(run('hooks/before-hook-async-error.fixture.js')); - it('should verify results', function() { - assert.deepEqual( - lines, - ['before', bang + 'test 3'] - ); - }); - }); - - describe('async - before hook error tip', function() { - before(run('hooks/before-hook-async-error-tip.fixture.js', onlyErrorTitle)); - it('should verify results', function() { - assert.deepEqual( - lines, - ['1) spec 2 "before all" hook:'] - ); - }); - }); - - describe('async - before each hook error', function() { - before(run('hooks/beforeEach-hook-async-error.fixture.js')); - it('should verify results', function() { - assert.deepEqual( - lines, - ['before', bang + 'test 3'] - ); - }); - }); - - describe('async - after hook error', function() { - before(run('hooks/after-hook-async-error.fixture.js')); - it('should verify results', function() { - assert.deepEqual( - lines, - ['test 1', 'test 2', 'after', bang + 'test 3'] - ); - }); - }); - - describe('async - after each hook error', function() { - before(run('hooks/afterEach-hook-async-error.fixture.js')); - it('should verify results', function() { - assert.deepEqual( - lines, - ['test 1', 'after', bang + 'test 3'] - ); - }); - }); - - describe('async - multiple hook errors', function() { - before(run('hooks/multiple-hook-async-error.fixture.js')); - it('should verify results', function() { - assert.deepEqual( - lines, - [ - 'root before', - '1-1 before', - 'root before each', - '1 before each', - '1-1 before each', - bang + '1-1 after each', - '1 after each', - 'root after each', - '1-1 after', - bang + '1-2 before', - 'root before each', - '1 before each', - '1-2 before each', - '1-2 test 1', - '1-2 after each', - bang + '1 after each', - 'root after each', - '1-2 after', - '1 after', - '2-1 before', - 'root before each', - '2 before each', - bang + '2 after each', - bang + 'root after each', - '2-1 after', - '2 after', - 'root after' - ] - ); - }); - }); - - function run(fnPath, outputFilter) { - return function(done) { - runMocha(fnPath, [], function(err, res) { - assert.ifError(err); - - lines = res.output - .split(splitRegExp) - .map(function(line) { - return line.trim(); - }) - .filter(outputFilter || onlyConsoleOutput()); - - done(); - }); - }; - } -}); - -function onlyConsoleOutput() { - var foundSummary = false; - return function(line) { - if (!foundSummary) { - foundSummary = !!(/\(\d+ms\)/).exec(line); - } - return !foundSummary && line.length > 0; - }; -} - -function onlyErrorTitle(line) { - return !!(/^1\)/).exec(line); -} diff --git a/tests/lib/mocha-3.1.0/test/integration/hooks.spec.js b/tests/lib/mocha-3.1.0/test/integration/hooks.spec.js deleted file mode 100644 index 7633cb5630..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/hooks.spec.js +++ /dev/null @@ -1,43 +0,0 @@ -var assert = require('assert'); -var run = require('./helpers').runMocha; -var splitRegExp = require('./helpers').splitRegExp; -var args = []; - -describe('hooks', function() { - it('are ran in correct order', function(done) { - run('cascade.fixture.js', args, function(err, res) { - var lines, expected; - - assert(!err); - - lines = res.output.split(splitRegExp).map(function(line) { - return line.trim(); - }).filter(function(line) { - return line.length; - }).slice(0, -1); - - expected = [ - 'before one', - 'before two', - 'before three', - 'before each one', - 'before each two', - 'before each three', - 'TEST three', - 'after each three', - 'after each two', - 'after each one', - 'after three', - 'after two', - 'after one' - ]; - - expected.forEach(function(line, i) { - assert.equal(lines[i], line); - }); - - assert.equal(res.code, 0); - done(); - }); - }); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/multiple-done.spec.js b/tests/lib/mocha-3.1.0/test/integration/multiple-done.spec.js deleted file mode 100644 index 47e82dbebb..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/multiple-done.spec.js +++ /dev/null @@ -1,96 +0,0 @@ -var assert = require('assert'); -var run = require('./helpers').runMochaJSON; -var args = []; - -describe('multiple calls to done()', function() { - var res; - describe('from a spec', function() { - before(function(done) { - run('multiple-done.fixture.js', args, function(err, result) { - res = result; - done(err); - }); - }); - - it('results in failures', function() { - assert.equal(res.stats.pending, 0); - assert.equal(res.stats.passes, 1); - assert.equal(res.stats.failures, 1); - assert.equal(res.code, 1); - }); - - it('throws a descriptive error', function() { - assert.equal(res.failures[0].err.message, - 'done() called multiple times'); - }); - }); - - describe('with multiple specs', function() { - before(function(done) { - run('multiple-done-specs.fixture.js', args, function(err, result) { - res = result; - done(err); - }); - }); - - it('results in a failure', function() { - assert.equal(res.stats.pending, 0); - assert.equal(res.stats.passes, 2); - assert.equal(res.stats.failures, 1); - assert.equal(res.code, 1); - }); - - it('correctly attributes the error', function() { - assert.equal(res.failures[0].fullTitle, 'suite test1'); - assert.equal(res.failures[0].err.message, - 'done() called multiple times'); - }); - }); - - describe('from a before hook', function() { - before(function(done) { - run('multiple-done-before.fixture.js', args, function(err, result) { - res = result; - done(err); - }); - }); - - it('results in a failure', function() { - assert.equal(res.stats.pending, 0); - assert.equal(res.stats.passes, 1); - assert.equal(res.stats.failures, 1); - assert.equal(res.code, 1); - }); - - it('correctly attributes the error', function() { - assert.equal(res.failures[0].fullTitle, 'suite "before all" hook'); - assert.equal(res.failures[0].err.message, - 'done() called multiple times'); - }); - }); - - describe('from a beforeEach hook', function() { - before(function(done) { - run('multiple-done-beforeEach.fixture.js', args, function(err, result) { - res = result; - done(err); - }); - }); - - it('results in a failure', function() { - assert.equal(res.stats.pending, 0); - assert.equal(res.stats.passes, 2); - assert.equal(res.stats.failures, 2); - assert.equal(res.code, 2); - }); - - it('correctly attributes the errors', function() { - assert.equal(res.failures.length, 2); - res.failures.forEach(function(failure) { - assert.equal(failure.fullTitle, 'suite "before each" hook'); - assert.equal(failure.err.message, - 'done() called multiple times'); - }); - }); - }); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/only.spec.js b/tests/lib/mocha-3.1.0/test/integration/only.spec.js deleted file mode 100644 index 61254ce1d3..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/only.spec.js +++ /dev/null @@ -1,45 +0,0 @@ -var run = require('./helpers').runMochaJSON; -var assert = require('assert'); - -describe('.only()', function() { - describe('bdd', function() { - it('should run only tests that marked as `only`', function(done) { - run('options/only/bdd.fixture.js', ['--ui', 'bdd'], function(err, res) { - assert(!err); - assert.equal(res.stats.pending, 0); - assert.equal(res.stats.passes, 11); - assert.equal(res.stats.failures, 0); - assert.equal(res.code, 0); - done(); - }); - }); - }); - - describe('tdd', function() { - it('should run only tests that marked as `only`', function(done) { - run('options/only/tdd.fixture.js', ['--ui', 'tdd'], function(err, res) { - assert(!err); - assert.equal(res.stats.pending, 0); - assert.equal(res.stats.passes, 8); - assert.equal(res.stats.failures, 0); - assert.equal(res.code, 0); - done(); - }); - }); - }); - - describe('qunit', function() { - it('should run only tests that marked as `only`', function(done) { - run('options/only/qunit.fixture.js', ['--ui', 'qunit'], function(err, res) { - console.log(err); - - assert(!err); - assert.equal(res.stats.pending, 0); - assert.equal(res.stats.passes, 5); - assert.equal(res.stats.failures, 0); - assert.equal(res.code, 0); - done(); - }); - }); - }); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/options.spec.js b/tests/lib/mocha-3.1.0/test/integration/options.spec.js deleted file mode 100644 index 4755647f76..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/options.spec.js +++ /dev/null @@ -1,182 +0,0 @@ -var assert = require('assert'); -var run = require('./helpers').runMochaJSON; -var args = []; - -describe('options', function() { - describe('--async-only', function() { - - before(function() { - args = ['--async-only']; - }); - - it('should fail synchronous specs', function(done) { - run('options/async-only-sync.fixture.js', args, function(err, res) { - assert(!err); - assert.equal(res.stats.pending, 0); - assert.equal(res.stats.passes, 0); - assert.equal(res.stats.failures, 1); - - assert.equal(res.failures[0].title, 'throws an error'); - assert.equal(res.code, 1); - done(); - }); - }); - - it('should allow asynchronous specs', function(done) { - run('options/async-only-async.fixture.js', args, function(err, res) { - assert(!err); - assert.equal(res.stats.pending, 0); - assert.equal(res.stats.passes, 1); - assert.equal(res.stats.failures, 0); - - assert.equal(res.passes[0].title, 'should pass'); - assert.equal(res.code, 0); - done(); - }); - }); - }); - - describe('--bail', function() { - before(function() { - args = ['--bail']; - }); - - it('should stop after the first error', function(done) { - run('options/bail.fixture.js', args, function(err, res) { - assert(!err); - assert.equal(res.stats.pending, 0); - assert.equal(res.stats.passes, 1); - assert.equal(res.stats.failures, 1); - - assert.equal(res.passes[0].title, 'should display this spec'); - assert.equal(res.failures[0].title, 'should only display this error'); - assert.equal(res.code, 1); - done(); - }); - }); - }); - - describe('--sort', function() { - before(function() { - args = ['--sort']; - }); - - it('should sort tests in alphabetical order', function(done) { - run('options/sort*', args, function(err, res) { - assert(!err); - assert.equal(res.stats.pending, 0); - assert.equal(res.stats.passes, 2); - assert.equal(res.stats.failures, 0); - - assert.equal(res.passes[0].fullTitle, - 'alpha should be executed first'); - assert.equal(res.code, 0); - done(); - }); - }); - }); - - describe('--delay', function() { - before(function() { - args = ['--delay']; - }); - - it('should run the generated test suite', function(done) { - run('options/delay.fixture.js', args, function(err, res) { - assert(!err); - assert.equal(res.stats.pending, 0); - assert.equal(res.stats.passes, 1); - assert.equal(res.stats.failures, 0); - - assert.equal(res.passes[0].title, - 'should have no effect if attempted twice in the same suite'); - assert.equal(res.code, 0); - done(); - }); - }); - - it('should throw an error if the test suite failed to run', function(done) { - run('options/delay-fail.fixture.js', args, function(err, res) { - assert(!err); - assert.equal(res.stats.pending, 0); - assert.equal(res.stats.passes, 0); - assert.equal(res.stats.failures, 1); - - assert.equal(res.failures[0].title, - 'Uncaught error outside test suite'); - assert.equal(res.code, 1); - done(); - }); - }); - }); - - describe('--grep', function() { - it('runs specs matching a string', function(done) { - args = ['--grep', 'match']; - run('options/grep.fixture.js', args, function(err, res) { - assert(!err); - assert.equal(res.stats.pending, 0); - assert.equal(res.stats.passes, 2); - assert.equal(res.stats.failures, 0); - assert.equal(res.code, 0); - done(); - }); - }); - - describe('runs specs matching a RegExp', function() { - it('with RegExp like strings(pattern follow by flag)', function(done) { - args = ['--grep', '/match/i']; - run('options/grep.fixture.js', args, function(err, res) { - assert(!err); - assert.equal(res.stats.pending, 0); - assert.equal(res.stats.passes, 4); - assert.equal(res.stats.failures, 0); - assert.equal(res.code, 0); - done(); - }); - }); - - it('string as pattern', function(done) { - args = ['--grep', '.*']; - run('options/grep.fixture.js', args, function(err, res) { - assert(!err); - assert.equal(res.stats.pending, 0); - assert.equal(res.stats.passes, 4); - assert.equal(res.stats.failures, 1); - assert.equal(res.code, 1); - done(); - }); - }); - }); - - describe('with --invert', function() { - it('runs specs that do not match the pattern', function(done) { - args = ['--grep', 'fail', '--invert']; - run('options/grep.fixture.js', args, function(err, res) { - assert(!err); - assert.equal(res.stats.pending, 0); - assert.equal(res.stats.passes, 4); - assert.equal(res.stats.failures, 0); - assert.equal(res.code, 0); - done(); - }); - }); - }); - }); - - describe('--retries', function() { - it('retries after a certain threshold', function (done) { - args = ['--retries', '3']; - run('options/retries.fixture.js', args, function(err, res) { - assert(!err); - assert.equal(res.stats.pending, 0); - assert.equal(res.stats.passes, 0); - assert.equal(res.stats.tests, 1); - assert.equal(res.tests[0].currentRetry, 3); - assert.equal(res.stats.failures, 1); - assert.equal(res.code, 1); - done(); - }); - }) - }); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/pending.spec.js b/tests/lib/mocha-3.1.0/test/integration/pending.spec.js deleted file mode 100644 index 4d4beffc2a..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/pending.spec.js +++ /dev/null @@ -1,100 +0,0 @@ -var assert = require('assert'); -var run = require('./helpers').runMochaJSON; -var args = []; - -describe('pending', function() { - describe('pending specs', function() { - it('should be created by omitting a function', function(done) { - run('pending/spec.fixture.js', args, function(err, res) { - assert(!err); - assert.equal(res.stats.pending, 1); - assert.equal(res.stats.passes, 0); - assert.equal(res.stats.failures, 0); - assert.equal(res.code, 0); - done(); - }); - }); - }); - - describe('synchronous skip()', function() { - describe('in spec', function() { - it('should immediately skip the spec and run all others', function(done) { - run('pending/skip-sync-spec.fixture.js', args, function(err, res) { - assert(!err); - assert.equal(res.stats.pending, 1); - assert.equal(res.stats.passes, 1); - assert.equal(res.stats.failures, 0); - assert.equal(res.code, 0); - done(); - }); - }); - }); - - describe('in before', function() { - it('should skip all suite specs', function(done) { - run('pending/skip-sync-before.fixture.js', args, function(err, res) { - assert(!err); - assert.equal(res.stats.pending, 2); - assert.equal(res.stats.passes, 0); - assert.equal(res.stats.failures, 0); - assert.equal(res.code, 0); - done(); - }); - }); - }); - - describe('in beforeEach', function() { - it('should skip all suite specs', function(done) { - run('pending/skip-sync-beforeEach.fixture.js', args, function(err, res) { - assert(!err); - assert.equal(res.stats.pending, 2); - assert.equal(res.stats.passes, 0); - assert.equal(res.stats.failures, 0); - assert.equal(res.code, 0); - done(); - }); - }); - }); - }); - - describe('asynchronous skip()', function() { - describe('in spec', function() { - it('should immediately skip the spec and run all others', function(done) { - run('pending/skip-async-spec.fixture.js', args, function(err, res) { - assert(!err); - assert.equal(res.stats.pending, 1); - assert.equal(res.stats.passes, 1); - assert.equal(res.stats.failures, 0); - assert.equal(res.code, 0); - done(); - }); - }); - }); - - describe('in before', function() { - it('should skip all suite specs', function(done) { - run('pending/skip-async-before.fixture.js', args, function(err, res) { - assert(!err); - assert.equal(res.stats.pending, 2); - assert.equal(res.stats.passes, 0); - assert.equal(res.stats.failures, 0); - assert.equal(res.code, 0); - done(); - }); - }); - }); - - describe('in beforeEach', function() { - it('should skip all suite specs', function(done) { - run('pending/skip-sync-beforeEach.fixture.js', args, function(err, res) { - assert(!err); - assert.equal(res.stats.pending, 2); - assert.equal(res.stats.passes, 0); - assert.equal(res.stats.failures, 0); - assert.equal(res.code, 0); - done(); - }); - }); - }); - }); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/regression.spec.js b/tests/lib/mocha-3.1.0/test/integration/regression.spec.js deleted file mode 100644 index f2a435a34c..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/regression.spec.js +++ /dev/null @@ -1,97 +0,0 @@ -var assert = require('assert'); -var fs = require('fs'); -var path = require('path'); -var run = require('./helpers').runMocha; -var runJSON = require('./helpers').runMochaJSON; - -describe('regressions', function() { - it('issue-1327: should run all 3 specs exactly once', function(done) { - var args = []; - run('regression/issue-1327.fixture.js', args, function(err, res) { - var occurences = function(str) { - var pattern = new RegExp(str, 'g'); - return (res.output.match(pattern) || []).length; - }; - - assert(!err); - assert.equal(occurences('testbody1'), 1); - assert.equal(occurences('testbody2'), 1); - assert.equal(occurences('testbody3'), 1); - - assert.equal(res.code, 1); - done(); - }); - }); - - it('should not duplicate mocha.opts args in process.argv', function() { - var processArgv = process.argv.join(''); - var mochaOpts = fs.readFileSync(path.join(__dirname, '..', 'mocha.opts'), 'utf-8').split(/[\s]+/).join(''); - assert.notEqual(processArgv.indexOf(mochaOpts), -1, 'process.argv missing mocha.opts'); - assert.equal(processArgv.indexOf(mochaOpts), processArgv.lastIndexOf(mochaOpts), 'process.argv contains duplicated mocha.opts'); - }); - - it('issue-1794: Can\'t --require custom UI and use it', function(done) { - var simpleUiPath = path.join(__dirname, 'fixtures', 'regression', '1794', 'simple-ui.js'); - var args = ['--require', simpleUiPath, '--ui', 'simple-ui']; - run('regression/1794/issue-1794.fixture.js', args, function(err, res) { - assert.equal(res.code, 0, 'Custom UI should be loaded'); - done(); - }); - }); - - it('issue-1991: Declarations do not get cleaned up unless you set them to `null` - Memory Leak', function(done) { - // on a modern MBP takes ±5 seconds on node 4.0, but on older laptops with node 0.12 ±40 seconds. - // Could easily take longer on even weaker machines (Travis-CI containers for example). - this.timeout(120000); - run('regression/issue-1991.fixture.js', [], function(err, res) { - assert.equal(/process out of memory/.test(res.output), false, 'fixture\'s process out of memory!'); - assert.equal(res.code, 0, 'Runnable fn (it/before[Each]/after[Each]) references should be deleted to avoid memory leaks'); - done(); - }); - }) - - describe('issue-2286: after doesn\'t execute if test was skipped in beforeEach', function () { - var afterWasRun = false; - describe('suite with skipped test for meta test', function () { - beforeEach(function () { this.skip(); }); - after(function () { afterWasRun = true; }); - it('should be pending', function () {}); - }) - after('meta test', function () { - afterWasRun.should.be.ok(); - }); - }); - - it('issue-2315: cannot read property currentRetry of undefined', function (done) { - runJSON('regression/issue-2315.js', [], function(err, res) { - assert(!err); - assert.equal(res.stats.pending, 0); - assert.equal(res.stats.passes, 0); - assert.equal(res.stats.failures, 1); - assert.equal(res.code, 1); - done(); - }); - }); - - it('issue-2406: should run nested describe.only suites', function(done) { - this.timeout(2000); - runJSON('regression/issue-2406.fixture.js', [], function(err, res) { - assert(!err); - assert.equal(res.stats.pending, 0); - assert.equal(res.stats.passes, 2); - assert.equal(res.stats.failures, 0); - assert.equal(res.code, 0); - done(); - }); - }); - - it('issue-2417: should not recurse infinitely with .only suites nested within each other', function() { - runJSON('regression/issue-2417.fixture.js', [], function(err, res) { - assert(!err); - assert.equal(res.stats.pending, 0); - assert.equal(res.stats.passes, 1); - assert.equal(res.stats.failures, 0); - assert.equal(res.code, 0); - }); - }); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/reporters.spec.js b/tests/lib/mocha-3.1.0/test/integration/reporters.spec.js deleted file mode 100644 index 9595611829..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/reporters.spec.js +++ /dev/null @@ -1,61 +0,0 @@ -var assert = require('assert'); -var os = require('os'); -var fs = require('fs'); -var crypto = require('crypto'); -var path = require('path'); -var run = require('./helpers').runMocha; - -describe('reporters', function() { - describe('markdown', function() { - var res; - - before(function(done) { - run('passing.fixture.js', ['--reporter', 'markdown'], function(err, result) { - res = result; - done(err); - }); - }); - - it('does not exceed maximum callstack (issue: 1875)', function() { - assert(res.output.indexOf('RangeError') === -1, 'Threw RangeError'); - }); - - it('contains spec src', function() { - var src = [ - '```js', - 'assert(true);', - '```' - ].join('\n'); - - assert(res.output.indexOf(src) !== -1, 'No assert found'); - }); - }); - - describe('xunit', function() { - it('prints test cases with --reporter-options output (issue: 1864)', function(done) { - var randomStr = crypto.randomBytes(8).toString('hex'); - var tmpDir = os.tmpDir().replace(new RegExp(path.sep + '$'), ''); - var tmpFile = tmpDir + path.sep + 'test-issue-1864-' + randomStr + '.xml'; - - var args = ['--reporter=xunit', '--reporter-options', 'output=' + tmpFile]; - var expectedOutput = [ - '<testcase classname="suite" name="test1" time="', - '<testcase classname="suite" name="test2" time="', - '</testsuite>' - ]; - - run('passing.fixture.js', args, function(err, result) { - if (err) return done(err); - - var xml = fs.readFileSync(tmpFile, 'utf8'); - fs.unlinkSync(tmpFile); - - expectedOutput.forEach(function(line) { - assert(xml.indexOf(line) !== -1, 'XML did not contain ' + line); - }); - - done(err); - }); - }); - }); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/retries.spec.js b/tests/lib/mocha-3.1.0/test/integration/retries.spec.js deleted file mode 100644 index ce76545b00..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/retries.spec.js +++ /dev/null @@ -1,106 +0,0 @@ -var assert = require('assert'); -var helpers = require('./helpers'); -var args = []; -var bang = require('../../lib/reporters/base').symbols.bang; - -describe('retries', function() { - it('are ran in correct order', function(done) { - helpers.runMocha('retries/hooks.fixture.js', args, function(err, res) { - var lines, expected; - - assert(!err); - - lines = res.output.split(helpers.splitRegExp).map(function(line) { - return line.trim(); - }).filter(function(line) { - return line.length; - }).slice(0, -1); - - expected = [ - 'before', - 'before each 0', - 'TEST 0', - 'after each 1', - 'before each 1', - 'TEST 1', - 'after each 2', - 'before each 2', - 'TEST 2', - 'after each 3', - 'before each 3', - 'TEST 3', - 'after each 4', - 'before each 4', - 'TEST 4', - bang + 'after each 5', - 'after' - ]; - - expected.forEach(function(line, i) { - assert.equal(lines[i], line); - }); - - assert.equal(res.code, 1); - done(); - }); - }); - - it('should exit early if test passes', function (done) { - helpers.runMochaJSON('retries/early-pass.fixture.js', args, function(err, res) { - assert(!err); - assert.equal(res.stats.passes, 1); - assert.equal(res.stats.failures, 0); - assert.equal(res.tests[0].currentRetry, 1); - assert.equal(res.stats.tests, 1); - assert.equal(res.code, 0); - done(); - }); - }); - - it('should let test override', function (done) { - helpers.runMochaJSON('retries/nested.fixture.js', args, function(err, res) { - assert(!err); - assert.equal(res.stats.passes, 0); - assert.equal(res.stats.failures, 1); - assert.equal(res.stats.tests, 1); - assert.equal(res.tests[0].currentRetry, 1); - assert.equal(res.code, 1); - done(); - }); - }); - - it('should not hang w/ async test', function (done) { - helpers.runMocha('retries/async.fixture.js', args, function(err, res) { - var lines, expected; - - assert(!err); - - lines = res.output.split(helpers.splitRegExp).map(function(line) { - return line.trim(); - }).filter(function(line) { - return line.length; - }).slice(0, -1); - - expected = [ - 'before', - 'before each 0', - 'TEST 0', - 'after each 1', - 'before each 1', - 'TEST 1', - 'after each 2', - 'before each 2', - 'TEST 2', - 'after each 3', - 'after' - ]; - - expected.forEach(function(line, i) { - assert.equal(lines[i], line); - }); - - assert.equal(res.code, 0); - done(); - }); - }); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/suite.spec.js b/tests/lib/mocha-3.1.0/test/integration/suite.spec.js deleted file mode 100644 index 00066a34f4..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/suite.spec.js +++ /dev/null @@ -1,42 +0,0 @@ -var assert = require('assert'); -var run = require('./helpers').runMocha; -var args = []; - -describe('suite w/no callback', function() { - this.timeout(1000); - it('should throw a helpful error message when a callback for suite is not supplied', function(done) { - run('suite/suite-no-callback.fixture.js', args, function(err, res) { - assert(!err); - var result = res.output.match(/no callback was supplied/) || []; - assert.equal(result.length, 1); - done(); - }); - }); -}); - -describe('skipped suite w/no callback', function() { - this.timeout(1000); - it('should not throw an error when a callback for skipped suite is not supplied', function(done) { - run('suite/suite-skipped-no-callback.fixture.js', args, function(err, res) { - assert(!err); - pattern = new RegExp("Error", 'g'); - var result = res.output.match(pattern) || []; - assert.equal(result.length, 0); - done(); - }); - }); -}); - - -describe('skipped suite w/ callback', function() { - this.timeout(1000); - it('should not throw an error when a callback for skipped suite is supplied', function(done) { - run('suite/suite-skipped-callback.fixture.js', args, function(err, res) { - assert(!err); - pattern = new RegExp("Error", 'g'); - var result = res.output.match(pattern) || []; - assert.equal(result.length, 0); - done(); - }); - }); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/timeout.spec.js b/tests/lib/mocha-3.1.0/test/integration/timeout.spec.js deleted file mode 100644 index 33b8e33093..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/timeout.spec.js +++ /dev/null @@ -1,16 +0,0 @@ -var assert = require('assert'); -var run = require('./helpers').runMochaJSON; -var args = []; - -describe('this.timeout()', function() { - it('is respected by sync and async suites', function(done) { - run('timeout.fixture.js', args, function(err, res) { - assert(!err); - assert.equal(res.stats.pending, 0); - assert.equal(res.stats.passes, 0); - assert.equal(res.stats.failures, 2); - assert.equal(res.code, 2); - done(); - }); - }); -}); diff --git a/tests/lib/mocha-3.1.0/test/integration/uncaught.spec.js b/tests/lib/mocha-3.1.0/test/integration/uncaught.spec.js deleted file mode 100644 index 87dde90902..0000000000 --- a/tests/lib/mocha-3.1.0/test/integration/uncaught.spec.js +++ /dev/null @@ -1,35 +0,0 @@ -var assert = require('assert'); -var run = require('./helpers').runMochaJSON; -var args = []; - -describe('uncaught exceptions', function() { - it('handles uncaught exceptions from hooks', function(done) { - run('uncaught-hook.fixture.js', args, function(err, res) { - assert(!err); - assert.equal(res.stats.pending, 0); - assert.equal(res.stats.passes, 0); - assert.equal(res.stats.failures, 1); - - assert.equal(res.failures[0].fullTitle, - 'uncaught "before each" hook'); - assert.equal(res.code, 1); - done(); - }); - }); - - it('handles uncaught exceptions from async specs', function(done) { - run('uncaught.fixture.js', args, function(err, res) { - assert(!err); - assert.equal(res.stats.pending, 0); - assert.equal(res.stats.passes, 0); - assert.equal(res.stats.failures, 2); - - assert.equal(res.failures[0].title, - 'fails exactly once when a global error is thrown first'); - assert.equal(res.failures[1].title, - 'fails exactly once when a global error is thrown second'); - assert.equal(res.code, 2); - done(); - }); - }); -}); |