unum-cloud / usearch

Fast Open-Source Search & Clustering engine × for Vectors & 🔜 Strings × in C++, C, Python, JavaScript, Rust, Java, Objective-C, Swift, C#, GoLang, and Wolfram 🔍
https://unum-cloud.github.io/usearch/
Apache License 2.0
1.92k stars 109 forks source link

Bug: Syntax Error with Jest in ESM #418

Open eryue0220 opened 1 month ago

eryue0220 commented 1 month ago

Describe the bug

When run test through Jest in ESM, it will occur an error like: image

Steps to reproduce

  1. git clone https://github.com/eryue0220/usearch-jest-esm-bug
  2. cd usearch-jest-esm-bug
  3. pnpm i
  4. pnpm test

Expected behavior

It should pass without babel transform the code.

USearch version

2.11.1

Operating System

Mac OSX

Hardware architecture

Arm

Which interface are you using?

Other bindings

Contact Details

No response

Are you open to being tagged as a contributor?

Is there an existing issue for this?

Code of Conduct

eryue0220 commented 1 month ago

Currently, A workaround is provide a transform in jest to remove module.exports in source code: https://github.com/eryue0220/usearch-jest-esm-bug/blob/main/jest.config.mjs#L5

ashvardanian commented 1 month ago

I am very inexperienced in JS tooling. Any chance you could open a PR if you know how to fix that, @eryue0220?

eryue0220 commented 1 month ago

I am very inexperienced in JS tooling. Any chance you could open a PR if you know how to fix that, @eryue0220?

Sure, I will fix this later.