-
Notifications
You must be signed in to change notification settings - Fork 7.6k
replace node fs-extra remove() with removeTempDirectory() #5187
Conversation
@@ -132,7 +132,7 @@ define(function (require, exports, module) { | |||
afterEach(function () { | |||
ExtensionLoader.getUserExtensionPath = realGetUserExtensionPath; | |||
ExtensionLoader.loadExtension = realLoadExtension; | |||
var promise = SpecRunnerUtils.remove(mockGetUserExtensionPath()); | |||
var promise = SpecRunnerUtils.removeTempDirectory(); |
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.
Do you think deleting the entire temp folder after every spec could cause problems? I know that the LowLevelFileIO tests do this, but now (for performance) we keep Brackets window open across multiple specs, so that seems like it could lead to using a temp file across multiple specs.
Maybe removeTempDirectory()
should take a subfolder parameter so it could append this to temp folder path and only delete a subfolder inside the temp folder.
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.
It shouldn't cause problems. Each suite should be cleaning up after itself and not have suite-to-suite dependencies like that anyhow.
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.
SpecRunner doesn't wait until 1 suite is done before starting the next suite -- the specs are intermingled -- so 1 suite can delete files being used by another suite.
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.
Are you sure about that? That would seem to violate the expectations of beforeEach/afterEach. I don't think I've ever seen that behavior.
Regardless, I understand your concern about the overreach. I'll use deletePath
instead...still goes through brackets.fs
instead of node. Fix pushed.
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.
SpecRunner doesn't wait until 1 suite is done before starting the next suite -- the specs are intermingled
You're right -- what I said does not seem to be true. SpecRunner always seemed like it was running things in any order, but watching it more closely, it seems to run only 1 suite at a time.
Done with review. Just a question about possibly deleting too much. |
Actually...hold on. I might have found an issue. |
@redmunds false alarm. All tests recreate the temp folder as they need it via |
Looks good. Merging. |
…ilure replace node fs-extra remove() with removeTempDirectory()
Fix intermittent failure (see 0.31.0.-9452 on windows) by replacing
fs-extra.remove()
in Node withbrackets.fs.unlink
viaSpecRunnerUtils.removeTempDirectory()
. Possible related issue from fs-extra rim-raf dependency isaacs/rimraf#19.