Comments (10)
Fixed it. Just had to move the jest config into package.json:
"jest": {
"transformIgnorePatterns": [
"<rootDir>/node_modules/(?!d3)/"
]
},
from d3-interpolate.
Yes. Please check if the Jest section in https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c answers the use case? (linked from https://github.com/d3/d3-interpolate/releases/tag/v3.0.0).
from d3-interpolate.
same here @matiasfacio do you have any fix?
I kind of found a workaround for my case. I am using ant-design which uses 3d. I mocked the imports of the components using the library in the test file that was throwing the error... shame on me, but couldn't do it otherwise.
jest.mock('@ant-design/plots', () => ({
Column: () => null,
ColumnConfig: () => null,
}));
from d3-interpolate.
hi!
I still have this problem, but this time use ant design and running jest.
Do you know how to solve it??
` Details:
/Users/work-dashboard/node_modules/@antv/g-base/node_modules/d3-interpolate/src/index.js:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,jest){export { default as interpolate } from "./value.js";
^^^^^^
SyntaxError: Unexpected token 'export'`
Thanks for any hint!
By the way, the other solutions did not help me.
from d3-interpolate.
@Fil thank you for the hint.
If anyone stumbles upon this issue, the specific solution that works for me is:
// jest.config.js
moudle.exports = {
<other_configs_in_this_file>,
transformIgnorePatterns: [
'/node_modules/(?!d3-(interpolate|color))',
],
};
In particular beware that if you try only '/node_modules/(?!d3-interpolate)'
, you'll get the SyntaxError: Unexpected token 'export'
error happening in d3-color
, which is IMO quite tricky to spot that it's not still the same error.
from d3-interpolate.
I'm also seeing this:
Details:
/Users/me/app/node_modules/d3/src/index.js:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){export * from "d3-array";
^^^^^^
SyntaxError: Unexpected token 'export'
> 1 | import { BaseType, Selection, Transition, select } from 'd3';
I tried your suggestion @slaweet but it makes no difference. I'm putting the config in craco.config.js because I'm using create-react-app:
jest: {
configure: {
moduleNameMapper: {
'@/(.*)$': '<rootDir>/src/$1',
},
transformIgnorePatterns: ['<rootDir>/node_modules/(?!d3)'],
},
},
from d3-interpolate.
Forgot to add that my project is written in Typescript including the Jest tests.
from d3-interpolate.
same here @matiasfacio do you have any fix?
from d3-interpolate.
any solution? still problematic
from d3-interpolate.
I ran into this as well.
Project initially was: CRA, TS, Nivo, Chakra, Jest
Then went from CRA -> Craco.
Then, WIP, Craco -> Vite.
Here's what solve it for me:
transformIgnorePatterns: ['/node_modules/(?!d3-(interpolate|color|scale|array|format|time)|internmap)'],
from d3-interpolate.
Related Issues (20)
- Images in readme not loading due to Content Security Policy
- Simple zoom-in with interpolateZoom gives negative duration
- Interpolated data spike value problem HOT 1
- d3-color vulnerable to ReDoS HOT 1
- d3-color dependency update due to ReDoS HOT 1
- d3-color version issue HOT 2
- [bug] require() of ES modules is not supported HOT 1
- NaN RGB values if passing zero to interpolateRgb
- Meteor app crashes HOT 1
- d3-color version issue
- interpolateBalanced? HOT 3
- d3.piecewise(values)?
- Non-uniform d3.interpolateRgbBasis HOT 2
- array.js sometimes reports errors HOT 1
- Catmull-Rom interpolator? HOT 1
- Interpolate with t=Infinity returns NaN instead of Infinity HOT 6
- d3.interpolateHcl(a,b)(1) doesn't return 'b' HOT 3
- Require Cycle with object.js and value.js HOT 1
- Require cycle: `value.js` -> `object.js` -> `value.js` HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from d3-interpolate.