Skip to content

Disable native automation and caching breaks lru-cache #8478

@fredrikkarlsson-pervanovo

Description

What is your Scenario?

Running tests with config:

  • disableNativeAutomation: true
  • cache: true

What is the Current behavior?

1) Unhandled promise rejection:
      
      TypeError: sizeCalculation return invalid (expect positive integer)
      at LRUCache.#requireSize (***\node_modules\testcafe\node_modules\lru-cache\src\index.ts:1596:19)
      at LRUCache.set (***\node_modules\testcafe\node_modules\lru-cache\src\index.ts:2041:35)
      at Object.add (***\node_modules\testcafe\node_modules\testcafe-hammerhead\lib\request-pipeline\cache.js:45:19)
      at RequestPipelineContext._addTemporaryEntryToCache (***\node_modules\testcafe\node_modules\testcafe-hammerhead\lib\request-pipeline\context\index.js:137:22)
      at RequestPipelineContext.pipeNonProcessedResponse (***\node_modules\testcafe\node_modules\testcafe-hammerhead\lib\request-pipeline\context\index.js:379:18)
      at processTicksAndRejections (node:internal/process/task_queues:95:5)
      at Array.decideOnProcessingStrategy (***\node_modules\testcafe\node_modules\testcafe-hammerhead\lib\request-pipeline\stages.js:89:17)
      at run (***\node_modules\testcafe\node_modules\testcafe-hammerhead\lib\request-pipeline\index.js:20:9)

      Browser: Chrome 143.0.0.0 / Windows 11

What is the Expected behavior?

Not crashing

What is the public URL of the test page? (attach your complete example)

What is your TestCafe test code?

import { Selector } from "testcafe";

fixture`Bug`;

test("test", async t => {
  await t.navigateTo("https://www.bjelin.se");
  await t.wait(2000);
  await t.expect(Selector("div#root").exists).ok();
});

Your complete configuration file

{
  "browser": "chrome",
  "disableNativeAutomation": true,
  "cache": true
}

Your complete test report

npx testcafe chrome Bug.test.ts 
 Running tests in:
 - Chrome 143.0.0.0 / Windows 11

 Bug
 × test

   1) Unhandled promise rejection:
      
      TypeError: sizeCalculation return invalid (expect positive integer)
      at LRUCache.#requireSize (C:\Users\flomm\Documents\Pervanovo\testcafe-bug\node_modules\testcafe-hammerhead\node_modules\lru-cache\src\index.ts:1596:19)
      at LRUCache.set (C:\Users\flomm\Documents\Pervanovo\testcafe-bug\node_modules\testcafe-hammerhead\node_modules\lru-cache\src\index.ts:2041:35)
      at Object.add (C:\Users\flomm\Documents\Pervanovo\testcafe-bug\node_modules\testcafe-hammerhead\lib\request-pipeline\cache.js:45:19)
      at RequestPipelineContext._addTemporaryEntryToCache
      (C:\Users\flomm\Documents\Pervanovo\testcafe-bug\node_modules\testcafe-hammerhead\lib\request-pipeline\context\index.js:137:22)
      at RequestPipelineContext.pipeNonProcessedResponse
      (C:\Users\flomm\Documents\Pervanovo\testcafe-bug\node_modules\testcafe-hammerhead\lib\request-pipeline\context\index.js:379:18)
      at processTicksAndRejections (node:internal/process/task_queues:95:5)
      at Array.decideOnProcessingStrategy (C:\Users\flomm\Documents\Pervanovo\testcafe-bug\node_modules\testcafe-hammerhead\lib\request-pipeline\stages.js:89:17)
      at run (C:\Users\flomm\Documents\Pervanovo\testcafe-bug\node_modules\testcafe-hammerhead\lib\request-pipeline\index.js:20:9)

      Browser: Chrome 143.0.0.0 / Windows 11



 1/1 failed (3s)

Screenshots

No response

Steps to Reproduce

  1. npx testcafe chrome Bug.test.ts

TestCafe version

3.7.3

Node.js version

v20.19.5

Command-line arguments

testcafe chrome Bug.test.ts

Browser name(s) and version(s)

Chrome 143.0.0.0

Platform(s) and version(s)

Windows 11

Other

It have worked for a long time in our CI pipeline with 3.7.0 and seems broken in >= 3.7.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    STATE: Need responseAn issue that requires a response or attention from the team.TYPE: bugThe described behavior is considered as wrong (bug).

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions