Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fs: update tests for rmdir() #29815

Closed

Conversation

mpaktiti
Copy link
Contributor

@mpaktiti mpaktiti commented Oct 2, 2019

Update tests to create more nested folders and files, like rimraf package tests do.
Each test will create 28 nested directories and 210 files.
It will also create different types of files, like symlinks.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

Update tests to create more nested folders and files, like rimraf
package tests do. Each test will create 28 nested directories and
210 files. It will also create different types of files, like
symlinks.
@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Oct 2, 2019
Copy link
Contributor

@iansu iansu left a comment

Choose a reason for hiding this comment

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

Looks good in general. Testing with symlinks and "weird" filenames seems like an improvement. I know this code was ported from rimraf so we can probably modernize it a little bit.

test/parallel/test-fs-rmdir-recursive.js Outdated Show resolved Hide resolved
test/parallel/test-fs-rmdir-recursive.js Outdated Show resolved Hide resolved
test/parallel/test-fs-rmdir-recursive.js Outdated Show resolved Hide resolved
@iansu
Copy link
Contributor

iansu commented Oct 2, 2019

CI is currently failing because of linter errors. You can check those locally by running make lint.

@mpaktiti
Copy link
Contributor Author

mpaktiti commented Oct 5, 2019

@iansu Can you have a look at my last commit? I moved the first part of tests in their own function so I can test it with different folder hierarchy levels and file types. Lmk what you think so I can sth similar with the rest.

@iansu
Copy link
Contributor

iansu commented Oct 5, 2019

@mpaktiti That looks pretty good to me. I'd say go ahead and do something similar with the other tests.

@Trott
Copy link
Member

Trott commented Oct 11, 2019

@nodejs/testing @nodejs/fs @bcoe This could use some reviews.

Copy link
Contributor

@bcoe bcoe left a comment

Choose a reason for hiding this comment

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

I'm happy with this, I think over time we might find that we make the builder more generic, but in a pinch I think this makes it easier to setup a few more scenarios for rimraf.

function makeNonEmptyDirectory() {
const dirname = `rmdir-recursive-${count}`;
fs.mkdirSync(path.join(dirname, 'foo', 'bar', 'baz'), { recursive: true });
function makeNonEmptyDirectory(depth, files, folders, dirname, createSymLinks) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I really like this approach of building this out into a factory, so that it's easy to create a bunch of different scenarios, thanks for doing this 🎉

@nodejs-github-bot
Copy link
Collaborator

@Trott Trott added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Oct 12, 2019
Trott pushed a commit that referenced this pull request Oct 13, 2019
Update tests to create more nested folders and files, like rimraf
package tests do. Each test will create 28 nested directories and
210 files. It will also create different types of files, like
symlinks.

PR-URL: #29815
Reviewed-By: Ben Coe <bencoe@gmail.com>
@Trott
Copy link
Member

Trott commented Oct 13, 2019

Landed in 27507ca.

Thanks for the contribution! 🎉

@Trott Trott closed this Oct 13, 2019
targos pushed a commit that referenced this pull request Oct 14, 2019
Update tests to create more nested folders and files, like rimraf
package tests do. Each test will create 28 nested directories and
210 files. It will also create different types of files, like
symlinks.

PR-URL: #29815
Reviewed-By: Ben Coe <bencoe@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants