Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 67 additions & 8 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,68 @@
module.exports = {
presets: ['@babel/preset-env', '@babel/preset-react'],
plugins: [
['@babel/plugin-proposal-class-properties', {loose: true}],
'@babel/plugin-transform-destructuring',
['@babel/plugin-proposal-object-rest-spread', {loose: true}],
'istanbul'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This plugin was causing issues

]
'use strict';
// Grab the env in the same fashion as Babel core
const env = process.env.BABEL_ENV || 'default';
const presetReact = require('@babel/preset-react');

// Define shared configuration
const DEFAULT_PLUGINS = [
['@babel/plugin-proposal-class-properties', {loose: true}],
'@babel/plugin-transform-destructuring',
['@babel/plugin-proposal-object-rest-spread', {loose: true}]
];
const PRESET_ENV_CONFIG = {
loose: true
};
const PRESET_ENV_CONFIG_MOD_FALSE = {
...PRESET_ENV_CONFIG,
modules: false
};
const TRANSFORM_IMPORT_CONFIG = {
original: '^(.+?)\\.less$',
replacement: '$1.css'
};

const environments = {
default: {
presets: [
[require.resolve('@babel/preset-env'), PRESET_ENV_CONFIG],
presetReact
],
plugins: DEFAULT_PLUGINS,
comments: false
},
esm: {
presets: [
[require.resolve('@babel/preset-env'), PRESET_ENV_CONFIG_MOD_FALSE],
presetReact
],
plugins: [
...DEFAULT_PLUGINS,
['transform-rename-import', TRANSFORM_IMPORT_CONFIG]
],
comments: false
},
modern: {
presets: [
[require.resolve('@babel/preset-env'), PRESET_ENV_CONFIG],
presetReact
],
plugins: [
...DEFAULT_PLUGINS,
['transform-rename-import', TRANSFORM_IMPORT_CONFIG]
],
comments: false
},
umd: {
presets: [
[require.resolve('@babel/preset-env'), PRESET_ENV_CONFIG_MOD_FALSE],
presetReact
],
plugins: DEFAULT_PLUGINS,
comments: false
}
};

module.exports = (api) => {
api.cache(false);
return environments[env];
};
5 changes: 5 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// jest.config.js
module.exports = {
testEnvironment: 'jsdom',
testMatch: ['**/tests/unit/*.test.js']
};
16 changes: 5 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
"build:umd": "BABEL_ENV=umd webpack --bail",
"build:analyze": "NODE_ENV=production BABEL_ENV=umd webpack",
"coverage": "nyc report --reporter=text-lcov | coveralls",
"test": "npm run test:lint && npm run test:coverage",
"test:coverage": "nyc --reporter=html --reporter=text npm run test:unit",
"test": "npm run test:lint && npm run test:unit",
"test:lint": "eslint --color src",
"test:unit": "mocha --require ./setup.js --colors tests/unit/*.test.js",
"test:unit": "jest --coverage",
"test:unit:debug": "node --inspect-brk ./node_modules/.bin/jest --runInBand --colors --detectOpenHandles",
"semantic-release": "semantic-release"
},
"repository": {
Expand Down Expand Up @@ -91,13 +91,12 @@
"babel-eslint": "^10.0.1",
"babel-loader": "^8.0.0",
"babel-plugin-istanbul": "^5.2.0",
"babel-plugin-transform-rename-import": "^2.3.0",
"chai": "^4.1.2",
"classnames": "^2.0.0",
"coveralls": "^3.0.6",
"css-loader": "^1.0.0",
"cssnano": "^4.1.4",
"enzyme": "^3.4.3",
"enzyme-adapter-react-16": "^1.0.0",
"eslint": "^6.1.0",
"eslint-config-standard": "^13.0.1",
"eslint-loader": "^2.1.0",
Expand All @@ -110,14 +109,11 @@
"file-loader": "^2.0.0",
"html-webpack-plugin": "^3.2.0",
"ignore-styles": "^5.0.1",
"jsdom": "^15.1.1",
"jsdom-global": "^3.0.2",
"jest": "^25.1.0",
"less": "^3.8.1",
"less-loader": "^4.1.0",
"less-plugin-npm-import": "^2.1.0",
"mini-css-extract-plugin": "^0.5.0",
"mocha": "^6.2.0",
"nyc": "^14.1.1",
"open": "7.0.0",
"postcss-loader": "^3.0.0",
"prettier": "^1.18.2",
Expand All @@ -128,8 +124,6 @@
"react-responsive-carousel": "^3.1.49",
"react-test-renderer": "^16.0.0",
"semantic-release": "^17.0.4",
"sinon": "^7.0.0",
"sinon-chai": "^3.2.0",
"style-loader": "^0.23.1",
"system-bell-webpack-plugin": "^1.0.0",
"terser-webpack-plugin": "^1.1.0",
Expand Down
1 change: 0 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ export default class FPSMeter {
this.rafTimeout = setTimeout(() => {
this.stop('timeout');
}, this.timeout);

window.requestAnimationFrame(this.tick);
return true;
};
Expand Down
21 changes: 0 additions & 21 deletions tests/mocks/html.mock.js

This file was deleted.

Loading