JSONPath-Plus / JSONPath

A fork of JSONPath from http://goessner.net/articles/JsonPath/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Non-existent files referenced in package.json in version 6.0.0

matushorvath opened this issue · comments

Describe the bug

After recent renaming of some files in dist, not all references to those files in package.json were updated.
This causes errors when importing the package in jest.

Code sample or steps to reproduce

// file test/tmp.test.ts
import { JSONPath } from 'jsonpath-plus';
test('', () => { console.log(JSONPath); });
$ npx jest --config jest.json test/tmp.test.ts
 FAIL  test/tmp.test.ts
  ● Test suite failed to run

    Cannot find module 'jsonpath-plus' from 'test/tmp.test.ts'

    > 1 | import { JSONPath } from 'jsonpath-plus';
        | ^
      2 | test('', () => { console.log(JSONPath); });
      3 |

      at Resolver.resolveModule (node_modules/jest-resolve/build/resolver.js:311:11)
      at Object.<anonymous> (test/tmp.test.ts:1:1)

Console error or logs

Expected behavior

Expected is that all fields in package.json file reference existing files, so that tools like Jest that happen to use those fields continue working.

Expected result

After fixing the file name in package.json main field, importing the package from jest is fixed.

$ sed -i 's/index-node-cjs.js/index-node-cjs.cjs/g' node_modules/jsonpath-plus/package.json
$ npx jest --config jest.json test/tmp.test.ts
 PASS  test/tmp.test.ts (5.748 s)
  ✓  (18 ms)

  console.log
    [Function: JSONPath] {
      cache: {},
      toPathString: [Function (anonymous)],
      toPointer: [Function (anonymous)],
      toPathArray: [Function (anonymous)]
    }

      at Object.<anonymous> (test/tmp.test.ts:2:26)

Environment (IMPORTANT)

  • JSONPath-Plus version: [6.0.0]

Desktop**

  • OS: [Debian Linux]
  • Node Version: [14.17.0]

Additional context

The PR also fixes file names in places unrelated to this particular bug report, since they are also clearly wrong and probably will cause an issue somewhere down the road.

PR created #156

Ugh. Thanks for this! Merged and released as part of v6.0.1!