chromaui / chromatic-e2e

Archive end-to-end tests to be replayed in Storybook and Chromatic
MIT License
21 stars 4 forks source link

EISDIR: illegal operation on a directory, open #14

Closed joshuajaco closed 1 year ago

joshuajaco commented 1 year ago

Describe the bug

Trying to open a page that loads a subpath URL results in an error. For example the following page structure is problematic:

/foo -> HTML that loads /foo/bar.js /foo/bar.js -> some javascript

Error: EISDIR: illegal operation on a directory, open '/user/playwright-chromatic-index-issue/test-archives/9-5-2023-1-55-57-pm/archive/

To Reproduce Steps to reproduce the behavior:

  1. checkout https://github.com/joshuajaco/playwright-chromatic-index-issue
  2. run npm run test

Expected behavior It does not throw an error

joshuajaco commented 1 year ago

The culprit is the following: https://github.com/chromaui/test-archiver/blob/da18dd1f81dfd71444daa1d5382b1fd59bcf3ab6/src/write-archive/index.ts#L60-L63

The pathname.endsWith('/') does not account for this case. I'm not entirely sure how to properly detect it instead.

joshuajaco commented 1 year ago

Also, there is a race condition. The error changes whether the dir or the file was created first. The error EEXIST: file already exists, mkdir has the same origin.

tevanoff commented 1 year ago

@joshuajaco Interesting one, thanks for reporting! We'll take a look this week.

thafryer commented 1 year ago

:rocket: Issue was released in v0.0.23 :rocket: