streamich / memfs

JavaScript file system utilities
http://streamich.github.io/memfs/
Apache License 2.0
1.77k stars 130 forks source link

TypeError: blob.text is not a function (`nodeToFsa`) #1071

Open StephanMeijer opened 1 month ago

StephanMeijer commented 1 month ago

Cause

In my test I am using nodeToFsa^2 in order to 'mock' the Origin Private File System (OPFS)^6 API's that are available in the browser.

Application logic and tests can be found here.^1

In OriginPrivateFileSystemStorage.load I am calling fileHandle.getFile()^3. The expectation is that this function^3 returns Promise<File>. Promise<File> was returned but the .text()^4 method on File^5 seems not to be properly implemented..

Reproduction

  1. Checkout https://gitlab.com/toegang-voor-iedereen/frontend/editor-app:
$ git checkout git@gitlab.com:toegang-voor-iedereen/frontend/editor-app.git
# or
$ git checkout https://gitlab.com/toegang-voor-iedereen/frontend/editor-app.git
  1. run $ git checkout feature/NLD-264-opfs-memfs-issue
  2. run $ npm ci
  3. run $ npm run test -- src/storage/OriginPrivateFileSystemStorage.spec.ts

Versions

$ npm list | grep memfs
memfs@4.14.0
$ npm -v
10.8.2
$ node -v
v22.8.0