-
Notifications
You must be signed in to change notification settings - Fork 52
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Hey @arnog, what would be the recommended way to use math-json with Typescript?
Currently my editor complains...
Also: Jest with Typescript does not like the js files in the dist folder:
FAIL src/util/mathjson.test.ts
● Test suite failed to run
Jest encountered an unexpected token
This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.
By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules".
Here's what you can do:
• If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/en/ecmascript-modules for how to enable it.
• To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
• If you need a custom transformation specify a "transform" option in your config.
• If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.
You'll find more details and examples of these config options in the docs:
https://jestjs.io/docs/en/configuration.html
Details:
/Users/roman/Desktop/work/playground/node_modules/@cortex-js/math-json/dist/math-json.js:7745
export { ComputeEngine, LatexSyntax, evaluate, format, parse, parseCortex, serialize, serializeCortex };
^^^^^^
SyntaxError: Unexpected token 'export'
Test-file:
import { expect } from '@jest/globals'
import { parse, serialize } from '@cortex-js/math-json'
describe('something', () => {
it('should ', () => {
console.log(parse('\\frac{\\pi}{2}'))
})
})
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working