From 2b8a1ff636d58b023ae727dcef8e0c5d7784496e Mon Sep 17 00:00:00 2001 From: irrationnelle Date: Sun, 9 Aug 2020 03:43:29 +0900 Subject: [PATCH] fix: add Mocha to global variable --- rollup.config.js | 3 ++- test/browser-specific/esm.spec.mjs | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/rollup.config.js b/rollup.config.js index 9005b6138a..e90bb5203e 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -17,7 +17,8 @@ const config = { file: './mocha.js', format: 'umd', sourcemap: true, - name: 'mocha' + name: 'mocha', + footer: 'window.Mocha = window.mocha.Mocha;' }, plugins: [ json(), diff --git a/test/browser-specific/esm.spec.mjs b/test/browser-specific/esm.spec.mjs index 884f64324b..477aa505cc 100644 --- a/test/browser-specific/esm.spec.mjs +++ b/test/browser-specific/esm.spec.mjs @@ -3,3 +3,7 @@ import './fixtures/esm.fixture.mjs'; it('should register a global if it did not fail', function() { expect(window.MOCHA_IS_OK, 'to be ok'); }); + +it('should has global Mocha', function() { + expect(window.Mocha, 'not to be', undefined); +});