From 42720c84771a5efcb2bb52eb5475cfb5e7c952e3 Mon Sep 17 00:00:00 2001 From: Robert Jackson Date: Sat, 21 Feb 2015 23:02:34 -0500 Subject: [PATCH 1/2] Add mocha ES6 shim. --- lib/mocha.js | 11 +++++++++++ tests/shims-test.js | 8 ++++++++ 2 files changed, 19 insertions(+) create mode 100644 lib/mocha.js create mode 100644 tests/shims-test.js diff --git a/lib/mocha.js b/lib/mocha.js new file mode 100644 index 00000000..1d505b0d --- /dev/null +++ b/lib/mocha.js @@ -0,0 +1,11 @@ +/* globals mocha, describe, it */ + +export { + mocha, + describe, + it, + before, + beforeEach, + after, + afterEach +}; diff --git a/tests/shims-test.js b/tests/shims-test.js new file mode 100644 index 00000000..bcc045f9 --- /dev/null +++ b/tests/shims-test.js @@ -0,0 +1,8 @@ +import { describe, it } from 'mocha'; + +describe('mocha-shim', function() { + it('should work', function() { + window.expect(describe).to.equal(window.describe); + window.expect(it).to.equal(window.it); + }); +}); From 1c56101dd6f64cbcda0b3fcc89d543b456370a74 Mon Sep 17 00:00:00 2001 From: Robert Jackson Date: Sat, 21 Feb 2015 23:12:15 -0500 Subject: [PATCH 2/2] Add chai ES6 shim. --- lib/chai.js | 4 ++++ tests/shims-test.js | 8 ++++++++ 2 files changed, 12 insertions(+) create mode 100644 lib/chai.js diff --git a/lib/chai.js b/lib/chai.js new file mode 100644 index 00000000..900c634a --- /dev/null +++ b/lib/chai.js @@ -0,0 +1,4 @@ +/* globals chai */ + +export var expect = chai.expect; +export var assert = chai.assert; diff --git a/tests/shims-test.js b/tests/shims-test.js index bcc045f9..6d0e14b5 100644 --- a/tests/shims-test.js +++ b/tests/shims-test.js @@ -1,4 +1,5 @@ import { describe, it } from 'mocha'; +import { expect, assert } from 'chai'; describe('mocha-shim', function() { it('should work', function() { @@ -6,3 +7,10 @@ describe('mocha-shim', function() { window.expect(it).to.equal(window.it); }); }); + +describe('chai-shim', function() { + it('should work', function() { + window.expect(expect).to.equal(window.chai.expect); + window.expect(assert).to.equal(window.chai.assert); + }); +});