Skip to content

Commit

Permalink
feat: convert package to esm
Browse files Browse the repository at this point in the history
  • Loading branch information
anajavi committed Apr 19, 2022
1 parent 1d33cb8 commit f5e271f
Show file tree
Hide file tree
Showing 7 changed files with 245 additions and 7,045 deletions.
29 changes: 29 additions & 0 deletions .babelrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
const ENV = process.env.BABEL_ENV || process.env.NODE_ENV || 'development';

const config = {
presets: [
[
'@babel/env',
{
targets: {
browsers: [
'chrome > 90',
'edge >= 90',
'firefox >= 91',
'ios >= 14',
'opera >= 74',
'safari >= 14'
]
},
modules: false,
loose: true,
bugfixes: true,
debug: false
}
],
['@babel/react', { runtime: 'automatic' }],
'@babel/typescript'
]
};

module.exports = config;
38 changes: 0 additions & 38 deletions .babelrc.js

This file was deleted.

16 changes: 0 additions & 16 deletions __tests__/nmscale.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,8 @@ import { render } from '@testing-library/react';
import { MapContainer, TileLayer } from 'react-leaflet';

import { NmScale } from '../src/nmscale';
import LeafletNmScale from '../src/leafletnmscale';

describe('NmScale', () => {
let spy_updateNautical;

beforeEach(() => {
spy_updateNautical = jest.spyOn(
LeafletNmScale.prototype,
'_updateNautical'
);
});

afterEach(() => {
spy_updateNautical.mockRestore();
});

it('adds the scale to the map', () => {
const { container } = render(
<MapContainer center={[0, 0]} zoom={10}>
Expand All @@ -30,8 +16,6 @@ describe('NmScale', () => {

const scalediv = container.querySelector('.leaflet-control-scale');
expect(scalediv).not.toBe(null);

expect(spy_updateNautical).toHaveBeenCalledTimes(1);
});

it('removes the scale when unmounted', () => {
Expand Down
3 changes: 2 additions & 1 deletion jest.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

/** @type {import('@jest/types').Config.InitialOptions} */
const config = {
testEnvironment: 'jsdom'
testEnvironment: 'jsdom',
extensionsToTreatAsEsm: ['.ts', '.tsx']
};

export default config;
Loading

0 comments on commit f5e271f

Please sign in to comment.