jaredwray/cacheable

Fail to run the test

xianqugithub opened this issue · 3 comments

Describe the bug
When I tried to run the test with npm test, it fails to pass all tests.

  FAIL test/cache.test.ts
  ● Test suite failed to run

    test/cache.test.ts:586:3 - error TS2554: Expected 0 arguments, but got 1.

    586   `SELECT * FROM keyv WHERE "key" = "cacheable-request:GET:${
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    587    s.url + endpoint
        ~~~~~~~~~~~~~~~~~~~
    588   }"`,
        ~~~~~
    test/cache.test.ts:592:9 - error TS2571: Object is of type 'unknown'.

    592  expect(cacheResult.length).toBe(1);
                ~~~~~~~~~~~
    test/cache.test.ts:593:14 - error TS2554: Expected 0 arguments, but got 1.

    593  await query('DELETE FROM keyv');
                     ~~~~~~~~~~~~~~~~~~

To Reproduce
npm test

Expected behavior
All tests pass.

@xianqugithub I wasn't able to reproduce this. Can you try npm i && npm test from the command line. Here is the output I am getting:

cacheable-request git:(main) npm i

up to date, audited 870 packages in 607ms

156 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilitiescacheable-request git:(main) npm test

> cacheable-request@9.0.0 test
> xo && NODE_OPTIONS=--experimental-vm-modules jest --coverage

(node:37054) ExperimentalWarning: VM Modules is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
(node:37067) ExperimentalWarning: VM Modules is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
(node:37068) ExperimentalWarning: VM Modules is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
(node:37066) ExperimentalWarning: VM Modules is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
 PASS  test/cacheable-request-class.test.ts
 PASS  test/cacheable-request-instance.test.ts
 PASS  test/cache.test.ts (8.492 s)
----------|---------|----------|---------|---------|-------------------
File      | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
----------|---------|----------|---------|---------|-------------------
All files |     100 |      100 |     100 |     100 |                   
 index.ts |     100 |      100 |     100 |     100 |                   
----------|---------|----------|---------|---------|-------------------

Test Suites: 3 passed, 3 total
Tests:       65 passed, 65 total
Snapshots:   0 total
Time:        8.828 s
Ran all test suites.cacheable-request git:(main) 

Ah... had to blow away the project and on fresh install. Looking into this.

Fixed.