Skip to content

Commit

Permalink
Upgrade test config to ESM
Browse files Browse the repository at this point in the history
- change `helper.js` to `helper.mjs`.
- `use` no longer mutates a global `chai` object, which changes how spies are set up.
  • Loading branch information
eatyourgreens committed Jan 2, 2024
1 parent 11b2219 commit 11e58c4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"build:cjs": "babel src --out-dir lib/cjs",
"build:esm": "BABEL_ENV=es6 babel src --out-dir lib/esm",
"lint": "eslint src",
"test": "mocha --require @babel/register test/helper.js test/*-test.js*",
"test": "mocha --require @babel/register test/helper.mjs test/*-test.js*",
"prepare": "npm run build",
"preversion": "rm -rf lib && npm test",
"version": "npm run build",
Expand Down
12 changes: 6 additions & 6 deletions test/helper.js → test/helper.mjs
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import React from 'react';
import chai from 'chai';
import spy from 'chai-spies';
import { expect, use } from 'chai';
import spies from 'chai-spies';
import MarkdownIt from 'markdown-it';
import jsdom from 'jsdom';
import Adapter from 'enzyme-adapter-react-16';
import Enzyme from 'enzyme';

const { spy } = use(spies);

Enzyme.configure({
adapter: new Adapter()
});

chai.use(spy);

global.React = React;
global.expect = chai.expect;
global.spy = chai.spy;
global.expect = expect;
global.spy = spy;
global.MarkdownIt = MarkdownIt;

const { JSDOM } = jsdom;
Expand Down

0 comments on commit 11e58c4

Please sign in to comment.