diff --git a/README.md b/README.md index 94ae199..2944bdb 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,7 @@ Or even better, consider using [jsdom-global](https://www.npmjs.com/package/jsdo ```js require('jsdom-global')(undefined, { /*... jsdom config parameters ...*/ }); +global.performance = window.performance; // Required for node.js v14 and older, until https://github.com/rstacruz/jsdom-global/issues/59 is resolved require('mock-mediawiki'); ``` diff --git a/tests/jest.test.js b/tests/jest.test.js index 2b32a73..40a987a 100644 --- a/tests/jest.test.js +++ b/tests/jest.test.js @@ -1,5 +1,5 @@ -describe('test', function () { +describe('test with jest', function () { test('mw.Title works with correct wgLegalTitleChars mocking', () => { expect(new mw.Title('Template:Foo').getMainText()).toBe('Foo'); @@ -103,4 +103,4 @@ function sleep(ms) { resolve(); }, ms); })); -} \ No newline at end of file +} diff --git a/tests/jsdom-global.test.js b/tests/jsdom-global.test.js index 7e8ba5f..89dc2ee 100644 --- a/tests/jsdom-global.test.js +++ b/tests/jsdom-global.test.js @@ -1,9 +1,10 @@ const assert = require('assert'); require('jsdom-global')(undefined, { url: 'https://test.wikipedia.org', runScripts: 'dangerously' }); +global.performance = window.performance; // See readme require('../index'); -describe('test with jsdom-global', function () { +describe('test using jsdom-global and mocha', function () { it('mw.Title works with correct wgLegalTitleChars mocking', () => { assert.strictEqual(new mw.Title('Template:Foo').getMainText(), 'Foo'); diff --git a/tests/mocha.test.js b/tests/mocha.test.js index d6ee201..499ff53 100644 --- a/tests/mocha.test.js +++ b/tests/mocha.test.js @@ -2,7 +2,7 @@ const assert = require('assert'); require('../with-jsdom'); // jest's deps include jsdom, so we haven't explicitly put jsdom as a dev-dep! -describe('test', function () { +describe('test using bundled with-jsdom and mocha', function () { it('mw.Title works with correct wgLegalTitleChars mocking', () => { assert.strictEqual(new mw.Title('Template:Foo').getMainText(), 'Foo'); @@ -107,4 +107,4 @@ function sleep(ms) { resolve(); }, ms); })); -} \ No newline at end of file +}