-
-
Notifications
You must be signed in to change notification settings - Fork 43
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
Chore: Test fixes for CascadingConfigArrayFactory #17
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you intend to add tests/lib/cascading-config-array-factory.js
to package.json
's test
command as part of this PR? I pulled this branch locally, added that, and got 11 test failures. Checking with you before I dig in case those just aren't finished yet.
beforeEach(async () => { | ||
|
||
({ prepare, cleanup, getPath } = createCustomTeardown({ | ||
cwd: homeDir, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this uses the actual home directory now, some of these tests could fail if someone already has a ~/.eslintrc.json
file there. Thankfully the teardown library appears to leave the file alone if it already exists, so at least it's not destructive:
$ echo '!@#$%^&*()' > ~/.eslintrc.json
$ npm test
# failures
$ cat ~/.eslintrc.json
!@#$%^&*()
Unless you have a bright idea for a way to test this without touching the home directory, I wouldn't be totally opposed to skipping the home directory tests outside CI. It's a little weird, but ideally people won't be touching the code in this repository anymore once you're done with the migration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say at this point let's just let the weird tests be weird. I can't wrap my brain around most of what the tests are doing at this point, so I'd call it a success when stuff starts passing even if it's not ideal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this uses a fake home dir, created in the project's parent dir:
eslintrc/tests/lib/cascading-config-array-factory.js
Lines 166 to 172 in 0acc018
beforeEach(() => { | |
uniqueHomeDirName = `home_${++uid}`; | |
homeDir = path.join(__dirname, `../../../${uniqueHomeDirName}`); | |
warnings = []; | |
sinon.stub(os, "homedir").returns(homeDir); | |
process.on("warning", onWarning); | |
}); |
Should we maybe avoid creating and deleting (potentially already existing and unrelated) directories there, by setting homeDir
to a path inside systemTempDir
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really don't want to be changing how the existing tests work. I've had a hard enough time converting these tests, so I'd rather just keep everything as close to original as possible.
Huh. I thought I had updated the test command. I wonder if I just forgot to push my last commit. I’ll take a look |
Apparently not, I'm seeing the test failures now, too. Unfortunately, a bunch of the failures look like they're the product of tests with implicit dependencies on the results of other tests. 😢 I'll have to take a look tomorrow. |
There are two tests failing on Windows in the CI but not locally when I test (either in Git Bash or the Windows command line). At this point, I think the best path forward is just to turn off those two tests. |
Could be because this directory is missing: https://github.com/eslint/eslint/tree/master/tests/fixtures/config-hierarchy/plugins You probably have it locally, but is git-ignored here: Line 41 in 4440df8
eslint/eslint's .gitignore has It seems that ubuntu tests are passing because 281 passing I see "test": "mocha -R progress -c \"tests/lib/**/*.js\"", |
Wow, nice work catching that. I'll dig in some more. You can probably tell my brain is completely fried from migrating all of these tests. Another set of eyes was definitely needed. |
All green. You are my hero, @mdjermanovic. 🎉 |
Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran tests locally and couldn't find anything else it wasn't cleaning up. LGTM 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Co-authored-by: Brandon Mills <btmills@users.noreply.github.com>
Last bunch of tests! 🎉
Note that I had to port over a bunch of fixtures from the main
eslint
repo so that makes this PR look more involved than it actually is.