ortexx / ip-cidr

Module for working with CIDR
47 stars 18 forks source link

jest + 4.0.1 version issues. SyntaxError: Cannot use import statement outside a module #46

Open Ginxo opened 4 months ago

Ginxo commented 4 months ago

After upgrading the library to version 4.0.1 there is an issue on our jest execution.

to mock the library was the only solution I found for being able to upgrade, like

class IPCIDR {
  address: string;

  constructor(address: string) {
    this.address = address;
  }

  start = () => this.address.split('/')[0];
}

export default IPCIDR;

and then '^ip-cidr$': '<rootDir>/__mocks__/ip-cidr-mock.ts', added to moduleNameMapper but this is not the right solution and could be very problematic in the future.

I guess library should be adapted to properly import ip-address library, right?

Ginxo commented 3 months ago

any update on this? @ortexx @zyoshoka