jgm/djot.js

Error when trying to run `npm run test`

Closed this issue · 2 comments

I get following error when trying to run npm run test:

> @djot/djot@0.3.1 pretest
> npm run build


> @djot/djot@0.3.1 build
> tsc && webpack

asset djot.js 81.1 KiB [compared for emit] [minimized] (name: main)
asset ../types/ast.d.ts 9.58 KiB [compared for emit]
asset ../types/block.d.ts 2.14 KiB [compared for emit]
asset ../types/inline.d.ts 1.46 KiB [compared for emit]
asset ../types/html.d.ts 1.42 KiB [compared for emit]
asset ../types/index.d.ts 1.03 KiB [compared for emit]
asset ../types/attributes.d.ts 792 bytes [compared for emit]
asset ../types/pandoc.d.ts 700 bytes [compared for emit]
asset ../types/parse.d.ts 661 bytes [compared for emit]
asset ../types/filter.d.ts 441 bytes [compared for emit]
asset ../types/options.d.ts 331 bytes [compared for emit]
asset ../types/djot-renderer.d.ts 274 bytes [compared for emit]
asset ../types/find.d.ts 243 bytes [compared for emit]
asset ../types/event.d.ts 104 bytes [compared for emit]
+ 2 assets
./src/index.ts 1.96 KiB [built] [code generated]
./src/parse.ts 46.2 KiB [built] [code generated]
./src/block.ts 45 KiB [built] [code generated]
./src/ast.ts 1.41 KiB [built] [code generated]
./src/html.ts 16.3 KiB [built] [code generated]
./src/filter.ts 4.34 KiB [built] [code generated]
./src/pandoc.ts 34.3 KiB [built] [code generated]
./src/djot-renderer.ts 22.7 KiB [built] [code generated]
./src/version.ts 130 bytes [built] [code generated]
./src/options.ts 717 bytes [built] [code generated]
./src/attributes.ts 9.64 KiB [built] [code generated]
./src/find.ts 983 bytes [built] [code generated]
./src/inline.ts 29.3 KiB [built] [code generated]
webpack 5.88.2 compiled successfully in 5317 ms

> @djot/djot@0.3.1 test
> jest

 FAIL  src/pathological.spec.ts
  ● Test suite failed to run

    Jest encountered an unexpected token

    Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax.

    Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration.

    By default "node_modules" folder is ignored by transformers.

    Here's what you can do:
     • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it.
     • If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript
     • 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/configuration
    For information about custom transformations, see:
    https://jestjs.io/docs/code-transformation

    Details:

    /home/user/djot.js/node_modules/source-map/lib/util.js:53
    }});
      ^

    SyntaxError: Unexpected token ')'

      at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1449:14)
      at Object.<anonymous> (node_modules/source-map/lib/source-map-generator.js:9:12)

...
...

jgm commented

This is strange, I can't reproduce the issue.
Nor do I have the string }}); at /home/user/djot.js/node_modules/source-map/lib/util.js:53.
Are you using the code from the repository here, or a release? What versions of node, jest, webpack, tsc, etc.?

Indeed, in a clean clone I don't see it... must be caused by my change... sorry and thank you for the great tools you write!