TypeError: config.transforms[index] is not a function
See original GitHub issueSubject of the issue
Failing unit tests when using react-markdown which using this library
● Some test with react-markdown in jest using testing-library
TypeError: config.transforms[index] is not a function
at compile (../node_modules/mdast-util-from-markdown/dist/index.js:226:38)
at fromMarkdown (../node_modules/mdast-util-from-markdown/dist/index.js:24:27)
at parse (../node_modules/remark-parse/index.js:13:12)
at Function.parse (../node_modules/unified/index.js:284:12)
at ReactMarkdown (../node_modules/react-markdown/lib/react-markdown.js:42:42)
at renderWithHooks (../node_modules/react-dom/cjs/react-dom.development.js:16260:18)
at mountIndeterminateComponent (../node_modules/react-dom/cjs/react-dom.development.js:18794:13)
at beginWork$1 (../node_modules/react-dom/cjs/react-dom.development.js:20162:16)
at HTMLUnknownElement.callCallback (../node_modules/react-dom/cjs/react-dom.development.js:336:14)
at invokeEventListeners (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:193:27)
at HTMLUnknownElementImpl._dispatch (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:119:9)
at HTMLUnknownElementImpl.dispatchEvent (../node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:82:17)
at HTMLUnknownElementImpl.dispatchEvent (../node_modules/jsdom/lib/jsdom/living/nodes/HTMLElement-impl.js:30:27)
at HTMLUnknownElement.dispatchEvent (../node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:157:21)
at Object.invokeGuardedCallbackDev (../node_modules/react-dom/cjs/react-dom.development.js:385:16)
at invokeGuardedCallback (../node_modules/react-dom/cjs/react-dom.development.js:440:31)
at beginWork$$1 (../node_modules/react-dom/cjs/react-dom.development.js:25780:7)
at performUnitOfWork (../node_modules/react-dom/cjs/react-dom.development.js:24698:12)
at workLoopSync (../node_modules/react-dom/cjs/react-dom.development.js:24671:22)
at performSyncWorkOnRoot (../node_modules/react-dom/cjs/react-dom.development.js:24270:11)
at ../node_modules/react-dom/cjs/react-dom.development.js:12199:24
at unstable_runWithPriority (../node_modules/scheduler/cjs/scheduler.development.js:697:12)
at runWithPriority$2 (../node_modules/react-dom/cjs/react-dom.development.js:12149:10)
at flushSyncCallbackQueueImpl (../node_modules/react-dom/cjs/react-dom.development.js:12194:7)
at flushSyncCallbackQueue (../node_modules/react-dom/cjs/react-dom.development.js:12182:3)
at scheduleUpdateOnFiber (../node_modules/react-dom/cjs/react-dom.development.js:23709:9)
at dispatchAction (../node_modules/react-dom/cjs/react-dom.development.js:17076:5)
Your environment
- OS: Mac os
- Packages: version “0.8.4”
- Env: node 15, yarn 1.22, jest 26
Steps to reproduce
rendering a markdown with react-markdown. it works in our prod. works when working locally with the unit tests but it fails in our pipeline so I’m really sorry that i cant reproduce that easily. but maybe that’s enught for you to tackle or understand what’s the issue or if mdast-util-from-markdown should handle that case
Expected behavior
What should happen? handle that case, without exploding or provide a better error explaining what went wrong
Actual behavior
exploding on this code block https://github.com/syntax-tree/mdast-util-from-markdown/blob/16c95f55298acb90f69cd253601672eb78e1b4d4/lib/index.js#L225
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (6 by maintainers)
Top Results From Across the Web
"index.js: Transformer.transform is not a function" #29301
After upgrading react-native from 0.48.3 to 0.62.2 I get the error when running "react-native run-ios" command: "index.js: Transformer.transform ...
Read more >React-native: index.js: Transformer.transform is not a function
... to 0.62.2 on a project I get the error when running "react-native run-ios" command: "index.js: Transformer.transform is not a function".
Read more >TypeError: "x" is not a constructor - JavaScript - MDN Web Docs
The JavaScript exception "is not a constructor" occurs when there was an attempt to use an object or a variable as a constructor,...
Read more >TypeError: forEach is not a function in JavaScript
The "TypeError: forEach is not a function" error occurs when we call the forEach() method on a value that is not of type...
Read more >Configuring Vitest
To configure vitest itself, add test property in your Vite config. ... TypeError: createAsyncThunk is not a function TypeError: default is ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks, will try
Fixed already: rm -r node modules; npm install should do the trick!