diff options
Diffstat (limited to 'tests/lib/mocha-3.1.2/test/integration/fixtures')
59 files changed, 1448 insertions, 0 deletions
diff --git a/tests/lib/mocha-3.1.2/test/integration/fixtures/cascade.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/cascade.fixture.js new file mode 100644 index 0000000000..259c81af2d --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/cascade.fixture.js @@ -0,0 +1,59 @@ +'use strict'; + +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.2/test/integration/fixtures/diffs/diffs.css.in b/tests/lib/mocha-3.1.2/test/integration/fixtures/diffs/diffs.css.in new file mode 100644 index 0000000000..09a3ca5363 --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/diffs/diffs.css.in @@ -0,0 +1,9 @@ +body { + font: "Helvetica Neue", Helvetica, arial, sans-serif; + background: black; + color: white; +} + +a { + color: blue +} diff --git a/tests/lib/mocha-3.1.2/test/integration/fixtures/diffs/diffs.css.out b/tests/lib/mocha-3.1.2/test/integration/fixtures/diffs/diffs.css.out new file mode 100644 index 0000000000..53b3ec906e --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/diffs/diffs.css.out @@ -0,0 +1,13 @@ +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.2/test/integration/fixtures/diffs/diffs.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/diffs/diffs.fixture.js new file mode 100644 index 0000000000..50ea00bee0 --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/diffs/diffs.fixture.js @@ -0,0 +1,113 @@ +'use strict'; + +var fs = require('fs'); +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.2/test/integration/fixtures/diffs/output b/tests/lib/mocha-3.1.2/test/integration/fixtures/diffs/output new file mode 100644 index 0000000000..bf56a96397 --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/diffs/output @@ -0,0 +1,91 @@ +// 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.2/test/integration/fixtures/hooks/after-hook-async-error.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/hooks/after-hook-async-error.fixture.js new file mode 100644 index 0000000000..f3dfe7e1ae --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/hooks/after-hook-async-error.fixture.js @@ -0,0 +1,21 @@ +'use strict'; + +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.2/test/integration/fixtures/hooks/after-hook-error.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/hooks/after-hook-error.fixture.js new file mode 100644 index 0000000000..7fc258f46d --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/hooks/after-hook-error.fixture.js @@ -0,0 +1,19 @@ +'use strict'; + +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.2/test/integration/fixtures/hooks/afterEach-hook-async-error.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/hooks/afterEach-hook-async-error.fixture.js new file mode 100644 index 0000000000..442ad9321f --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/hooks/afterEach-hook-async-error.fixture.js @@ -0,0 +1,21 @@ +'use strict'; + +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.2/test/integration/fixtures/hooks/afterEach-hook-error.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/hooks/afterEach-hook-error.fixture.js new file mode 100644 index 0000000000..5fb9a36c8d --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/hooks/afterEach-hook-error.fixture.js @@ -0,0 +1,19 @@ +'use strict'; + +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.2/test/integration/fixtures/hooks/before-hook-async-error-tip.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/hooks/before-hook-async-error-tip.fixture.js new file mode 100644 index 0000000000..04801c1946 --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/hooks/before-hook-async-error-tip.fixture.js @@ -0,0 +1,13 @@ +'use strict'; + +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.2/test/integration/fixtures/hooks/before-hook-async-error.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/hooks/before-hook-async-error.fixture.js new file mode 100644 index 0000000000..2530eec783 --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/hooks/before-hook-async-error.fixture.js @@ -0,0 +1,21 @@ +'use strict'; + +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.2/test/integration/fixtures/hooks/before-hook-error-tip.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/hooks/before-hook-error-tip.fixture.js new file mode 100644 index 0000000000..64df731573 --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/hooks/before-hook-error-tip.fixture.js @@ -0,0 +1,11 @@ +'use strict'; + +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.2/test/integration/fixtures/hooks/before-hook-error.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/hooks/before-hook-error.fixture.js new file mode 100644 index 0000000000..547e54a243 --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/hooks/before-hook-error.fixture.js @@ -0,0 +1,19 @@ +'use strict'; + +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.2/test/integration/fixtures/hooks/beforeEach-hook-async-error.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/hooks/beforeEach-hook-async-error.fixture.js new file mode 100644 index 0000000000..6ce27784a6 --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/hooks/beforeEach-hook-async-error.fixture.js @@ -0,0 +1,21 @@ +'use strict'; + +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.2/test/integration/fixtures/hooks/beforeEach-hook-error.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/hooks/beforeEach-hook-error.fixture.js new file mode 100644 index 0000000000..4c0ab2f237 --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/hooks/beforeEach-hook-error.fixture.js @@ -0,0 +1,19 @@ +'use strict'; + +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.2/test/integration/fixtures/hooks/multiple-hook-async-error.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/hooks/multiple-hook-async-error.fixture.js new file mode 100644 index 0000000000..858bbb3c5e --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/hooks/multiple-hook-async-error.fixture.js @@ -0,0 +1,141 @@ +'use strict'; + +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.2/test/integration/fixtures/hooks/multiple-hook-error.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/hooks/multiple-hook-error.fixture.js new file mode 100644 index 0000000000..085978ef79 --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/hooks/multiple-hook-error.fixture.js @@ -0,0 +1,131 @@ +'use strict'; + +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.2/test/integration/fixtures/multiple-done-before.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/multiple-done-before.fixture.js new file mode 100644 index 0000000000..1e1bc71a16 --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/multiple-done-before.fixture.js @@ -0,0 +1,12 @@ +'use strict'; + +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.2/test/integration/fixtures/multiple-done-beforeEach.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/multiple-done-beforeEach.fixture.js new file mode 100644 index 0000000000..32de2bf442 --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/multiple-done-beforeEach.fixture.js @@ -0,0 +1,16 @@ +'use strict'; + +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.2/test/integration/fixtures/multiple-done-specs.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/multiple-done-specs.fixture.js new file mode 100644 index 0000000000..a8ae6d1ac4 --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/multiple-done-specs.fixture.js @@ -0,0 +1,12 @@ +'use strict'; + +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.2/test/integration/fixtures/multiple-done.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/multiple-done.fixture.js new file mode 100644 index 0000000000..f1b471c678 --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/multiple-done.fixture.js @@ -0,0 +1,20 @@ +'use strict'; + +// 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.2/test/integration/fixtures/options/async-only-async.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/options/async-only-async.fixture.js new file mode 100644 index 0000000000..d5ba2b37a0 --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/options/async-only-async.fixture.js @@ -0,0 +1,5 @@ +'use strict'; + +it('should pass', function (done) { + done(); +}); diff --git a/tests/lib/mocha-3.1.2/test/integration/fixtures/options/async-only-sync.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/options/async-only-sync.fixture.js new file mode 100644 index 0000000000..512fd0e4db --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/options/async-only-sync.fixture.js @@ -0,0 +1,3 @@ +'use strict'; + +it('throws an error', function () {}); diff --git a/tests/lib/mocha-3.1.2/test/integration/fixtures/options/bail.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/options/bail.fixture.js new file mode 100644 index 0000000000..5095e63158 --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/options/bail.fixture.js @@ -0,0 +1,23 @@ +'use strict'; + +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.2/test/integration/fixtures/options/delay-fail.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/options/delay-fail.fixture.js new file mode 100644 index 0000000000..644cbc0281 --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/options/delay-fail.fixture.js @@ -0,0 +1,8 @@ +'use strict'; + +setTimeout(function () { + throw new Error('oops'); + /* eslint no-unreachable: off */ + it('test', function () {}); + run(); +}, 100); diff --git a/tests/lib/mocha-3.1.2/test/integration/fixtures/options/delay.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/options/delay.fixture.js new file mode 100644 index 0000000000..b2d49217db --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/options/delay.fixture.js @@ -0,0 +1,16 @@ +'use strict'; + +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.2/test/integration/fixtures/options/grep.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/options/grep.fixture.js new file mode 100644 index 0000000000..0939d084ec --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/options/grep.fixture.js @@ -0,0 +1,19 @@ +'use strict'; + +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.2/test/integration/fixtures/options/only/bdd.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/options/only/bdd.fixture.js new file mode 100644 index 0000000000..39323f3567 --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/options/only/bdd.fixture.js @@ -0,0 +1,72 @@ +'use strict'; + +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.2/test/integration/fixtures/options/only/qunit.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/options/only/qunit.fixture.js new file mode 100644 index 0000000000..8bc598030d --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/options/only/qunit.fixture.js @@ -0,0 +1,27 @@ +'use strict'; + +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); +}); diff --git a/tests/lib/mocha-3.1.2/test/integration/fixtures/options/only/tdd.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/options/only/tdd.fixture.js new file mode 100644 index 0000000000..987ee6bfba --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/options/only/tdd.fixture.js @@ -0,0 +1,37 @@ +'use strict'; + +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.2/test/integration/fixtures/options/retries.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/options/retries.fixture.js new file mode 100644 index 0000000000..8d2b0a40b6 --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/options/retries.fixture.js @@ -0,0 +1,7 @@ +'use strict'; + +describe('retries', function () { + it('should fail', function () { + throw new Error('retry failure'); + }); +}); diff --git a/tests/lib/mocha-3.1.2/test/integration/fixtures/options/sort-alpha.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/options/sort-alpha.fixture.js new file mode 100644 index 0000000000..dd74303163 --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/options/sort-alpha.fixture.js @@ -0,0 +1,9 @@ +'use strict'; + +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.2/test/integration/fixtures/options/sort-beta.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/options/sort-beta.fixture.js new file mode 100644 index 0000000000..56da4a6523 --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/options/sort-beta.fixture.js @@ -0,0 +1,7 @@ +'use strict'; + +describe('beta', function () { + it('should be executed second', function () { + global.beta = 1; + }); +}); diff --git a/tests/lib/mocha-3.1.2/test/integration/fixtures/passing.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/passing.fixture.js new file mode 100644 index 0000000000..baf142026d --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/passing.fixture.js @@ -0,0 +1,13 @@ +'use strict'; + +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.2/test/integration/fixtures/pending/skip-async-before.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/pending/skip-async-before.fixture.js new file mode 100644 index 0000000000..efeaa93899 --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/pending/skip-async-before.fixture.js @@ -0,0 +1,18 @@ +'use strict'; + +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.2/test/integration/fixtures/pending/skip-async-beforeEach.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/pending/skip-async-beforeEach.fixture.js new file mode 100644 index 0000000000..d6225564ba --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/pending/skip-async-beforeEach.fixture.js @@ -0,0 +1,18 @@ +'use strict'; + +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.2/test/integration/fixtures/pending/skip-async-spec.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/pending/skip-async-spec.fixture.js new file mode 100644 index 0000000000..44707b026c --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/pending/skip-async-spec.fixture.js @@ -0,0 +1,14 @@ +'use strict'; + +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.2/test/integration/fixtures/pending/skip-sync-before.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/pending/skip-sync-before.fixture.js new file mode 100644 index 0000000000..5e3b208efa --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/pending/skip-sync-before.fixture.js @@ -0,0 +1,15 @@ +'use strict'; + +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.2/test/integration/fixtures/pending/skip-sync-beforeEach.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/pending/skip-sync-beforeEach.fixture.js new file mode 100644 index 0000000000..0bd155ba55 --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/pending/skip-sync-beforeEach.fixture.js @@ -0,0 +1,15 @@ +'use strict'; + +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.2/test/integration/fixtures/pending/skip-sync-spec.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/pending/skip-sync-spec.fixture.js new file mode 100644 index 0000000000..1d22f0b77d --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/pending/skip-sync-spec.fixture.js @@ -0,0 +1,12 @@ +'use strict'; + +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.2/test/integration/fixtures/pending/spec.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/pending/spec.fixture.js new file mode 100644 index 0000000000..d750fcad1a --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/pending/spec.fixture.js @@ -0,0 +1,5 @@ +'use strict'; + +describe('suite', function () { + it('pending spec'); +}); diff --git a/tests/lib/mocha-3.1.2/test/integration/fixtures/regression/1794/issue-1794.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/regression/1794/issue-1794.fixture.js new file mode 100644 index 0000000000..8867369546 --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/regression/1794/issue-1794.fixture.js @@ -0,0 +1,5 @@ +'use strict'; + +test('pass', function () { + // pass +}); diff --git a/tests/lib/mocha-3.1.2/test/integration/fixtures/regression/1794/simple-ui.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/regression/1794/simple-ui.js new file mode 100644 index 0000000000..5cfde0465f --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/regression/1794/simple-ui.js @@ -0,0 +1,28 @@ +'use strict'; + +var path = '../../../../../lib/'; +var Mocha = require(path + 'mocha'); +var 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.2/test/integration/fixtures/regression/issue-1327.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/regression/issue-1327.fixture.js new file mode 100644 index 0000000000..e788278d6d --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/regression/issue-1327.fixture.js @@ -0,0 +1,17 @@ +'use strict'; + +it('test 1', function () { + console.log('testbody1'); + process.nextTick(function () { + throw new Error('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.2/test/integration/fixtures/regression/issue-1417.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/regression/issue-1417.js new file mode 100644 index 0000000000..13ce053784 --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/regression/issue-1417.js @@ -0,0 +1,22 @@ +'use strict'; + +/** + * This file should generate only one failure per spec for the thrown error. + * It should not report misleading 'multiple calls to done()'. + */ + +it('fails exactly once when a global error is thrown synchronously and done errors', function (done) { + setTimeout(function () { + done(new Error('test error')); + }, 1); // Not 0 - it will 'succeed', but won't test the breaking condition + + throw new Error('sync error'); +}); + +it('fails exactly once when a global error is thrown synchronously and done completes', function (done) { + setTimeout(function () { + done(); + }, 1); // Not 0 - it will 'succeed', but won't test the breaking condition + + throw new Error('sync error'); +}); diff --git a/tests/lib/mocha-3.1.2/test/integration/fixtures/regression/issue-1991.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/regression/issue-1991.fixture.js new file mode 100644 index 0000000000..024f02519f --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/regression/issue-1991.fixture.js @@ -0,0 +1,49 @@ +'use strict'; + +/* eslint no-unused-vars: off */ + +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.2/test/integration/fixtures/regression/issue-2315.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/regression/issue-2315.js new file mode 100644 index 0000000000..fe18841d1c --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/regression/issue-2315.js @@ -0,0 +1,11 @@ +'use strict'; + +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.2/test/integration/fixtures/regression/issue-2406.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/regression/issue-2406.fixture.js new file mode 100644 index 0000000000..b3770014dd --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/regression/issue-2406.fixture.js @@ -0,0 +1,17 @@ +'use strict'; + +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.2/test/integration/fixtures/regression/issue-2417.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/regression/issue-2417.fixture.js new file mode 100644 index 0000000000..58f49cf846 --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/regression/issue-2417.fixture.js @@ -0,0 +1,9 @@ +'use strict'; + +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.2/test/integration/fixtures/retries/async.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/retries/async.fixture.js new file mode 100644 index 0000000000..56d067fc05 --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/retries/async.fixture.js @@ -0,0 +1,30 @@ +'use strict'; + +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.2/test/integration/fixtures/retries/early-pass.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/retries/early-pass.fixture.js new file mode 100644 index 0000000000..ddad40399e --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/retries/early-pass.fixture.js @@ -0,0 +1,13 @@ +'use strict'; + +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.2/test/integration/fixtures/retries/hooks.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/retries/hooks.fixture.js new file mode 100644 index 0000000000..b4fc081aaa --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/retries/hooks.fixture.js @@ -0,0 +1,27 @@ +'use strict'; + +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.2/test/integration/fixtures/retries/nested.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/retries/nested.fixture.js new file mode 100644 index 0000000000..877d519d7f --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/retries/nested.fixture.js @@ -0,0 +1,11 @@ +'use strict'; + +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.2/test/integration/fixtures/suite/suite-no-callback.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/suite/suite-no-callback.fixture.js new file mode 100644 index 0000000000..80d046438f --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/suite/suite-no-callback.fixture.js @@ -0,0 +1,3 @@ +'use strict'; + +describe('a suite without a callback'); diff --git a/tests/lib/mocha-3.1.2/test/integration/fixtures/suite/suite-skipped-callback.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/suite/suite-skipped-callback.fixture.js new file mode 100644 index 0000000000..6def25de7f --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/suite/suite-skipped-callback.fixture.js @@ -0,0 +1,3 @@ +'use strict'; + +xdescribe('a pending suite with a callback', function () {}); diff --git a/tests/lib/mocha-3.1.2/test/integration/fixtures/suite/suite-skipped-no-callback.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/suite/suite-skipped-no-callback.fixture.js new file mode 100644 index 0000000000..e9381159bf --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/suite/suite-skipped-no-callback.fixture.js @@ -0,0 +1,3 @@ +'use strict'; + +xdescribe('a pending suite without a callback'); diff --git a/tests/lib/mocha-3.1.2/test/integration/fixtures/timeout.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/timeout.fixture.js new file mode 100644 index 0000000000..d237436811 --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/timeout.fixture.js @@ -0,0 +1,19 @@ +'use strict'; + +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.2/test/integration/fixtures/uncaught-hook.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/uncaught-hook.fixture.js new file mode 100644 index 0000000000..54f30c56e9 --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/uncaught-hook.fixture.js @@ -0,0 +1,15 @@ +'use strict'; + +describe('uncaught', function () { + beforeEach(function (done) { + process.nextTick(function () { + throw new Error('oh noes'); + }); + }); + + it('test', function (done) { + process.nextTick(function () { + throw new Error("I'm uncaught!"); + }); + }); +}); diff --git a/tests/lib/mocha-3.1.2/test/integration/fixtures/uncaught.fixture.js b/tests/lib/mocha-3.1.2/test/integration/fixtures/uncaught.fixture.js new file mode 100644 index 0000000000..6a2ded880c --- /dev/null +++ b/tests/lib/mocha-3.1.2/test/integration/fixtures/uncaught.fixture.js @@ -0,0 +1,22 @@ +'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'); + }, 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); +}); |