pillarjs / path-to-regexp

Turn a path string such as `/user/:name` into a regular expression

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Another dumb question: How to run tests?

Lord-Kamina opened this issue · comments

I'm trying to run the tests on my computer so I can compare them with the port I'm doing and debug it because I'm experiencing some odd behavior on

[
    "/{apple-}?icon-:res(\\d+).png",
    undefined,
    [
      "/",
      {
        name: "",
        prefix: "apple-",
        suffix: "",
        modifier: "?",
        pattern: "",
      },
      "icon-",
      {
        name: "res",
        prefix: "",
        suffix: "",
        modifier: "",
        pattern: "\\d+",
      },
      ".png",
    ]

It's probably not a path2regex error but rather on the c++ library I'm working with. Still, test logs are expired on github and when I try to run tests, I get this error:

[~/path-to-regexp] $ ts-scripts test
> Running "eslint"...

~/path-to-regexp/src/index.spec.ts
  17:10  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

~/path-to-regexp/src/index.ts
  277:32  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

✖ 2 problems (0 errors, 2 warnings)

> Running "prettier"...
Checking formatting...
All matched files use Prettier code style!
> Running "tsc --noEmit --project tsconfig.json"...
❌ Unable to resolve: vitest/vitest.mjs

You should be using NPM scripts, never a global module you've installed. The package you installed is a different version to the one this package depends on for tests. In this case, you can use npm test or npm specs (for just the tests without lint checks).

You should be using NPM scripts, never a global module you've installed. The package you installed is a different version to the one this package depends on for tests. In this case, you can use npm test or npm specs (for just the tests without lint checks).

I ended figuring it out. Yes, my node set-up is a raging mess. Thanks!