Skip to content

Conversation

@outslept
Copy link
Contributor

unit tests for TarballFileSystem (mocked unpack), expanded LocalFileSystem tests (exists/read/list/size, nested node_modules)

@pkg-pr-new
Copy link

pkg-pr-new bot commented Sep 21, 2025

Open in StackBlitz

npm i https://pkg.pr.new/e18e/cli/@e18e/cli@97

commit: 0220a43

const hasConfig = await fileSystem.fileExists('/tsconfig.json');
expect(hasConfig).toBe(true);
});
it('should report false for a missing file and true for an existing file', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should probably be two tests

Copy link
Contributor

@43081j 43081j Sep 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking at it, this and the readFile tests were probably organised better before, no?

roughly:

  • fileExists
    • test that it is true for files that exist
    • test that it is false for files that dont exist
  • readFile
    • test that it returns files that exist
    • test that it throws for files that don't exist

same with the listPackageFiles tests, they should have their own block i think

  • listPackageFiles
    • return empty list when no node_modules
    • return list of packages when node_modules exists

and getInstallSize:

  • getInstallSize
    • returns 0 when no modules
    • returns size when modules

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants