timbru31 commented on a change in pull request #1013:
URL: https://github.com/apache/cordova-android/pull/1013#discussion_r450958324



##########
File path: spec/unit/pluginHandlers/common.spec.js
##########
@@ -35,38 +36,39 @@ var deleteJava = common.__get__('deleteJava');
 var copyNewFile = common.__get__('copyNewFile');
 
 describe('common platform handler', function () {
+    afterEach(() => {
+        fs.removeSync(test_dir);
+        fs.removeSync(non_plugin_file);
+    });
+
     describe('copyFile', function () {
         it('Test#001 : should throw if source path not found', function () {
-            fs.removeSync(src);
             expect(function () { copyFile(test_dir, src, project_dir, dest); })
                 .toThrow(new Error('"' + src + '" not found!'));
         });
 
         it('Test#002 : should throw if src not in plugin directory', function 
() {
             fs.ensureDirSync(project_dir);
-            fs.writeFileSync(non_plugin_file, 'contents', 'utf-8');
+            fs.outputFileSync(non_plugin_file, 'contents');
             var outside_file = '../non_plugin_file';
             expect(function () { copyFile(test_dir, outside_file, project_dir, 
dest); })
                 .toThrow(new Error('File "' + path.resolve(test_dir, 
outside_file) + '" is located outside the plugin directory "' + test_dir + 
'"'));
-            fs.removeSync(test_dir);
         });
 
         it('Test#003 : should allow symlink src, if inside plugin', function 
() {
-            fs.ensureDirSync(java_dir);
-            fs.writeFileSync(java_file, 'contents', 'utf-8');
+            fs.outputFileSync(java_file, 'contents');
 
             // This will fail on windows if not admin - ignore the error in 
that case.
             if (ignoreEPERMonWin32(java_file, symlink_file)) {
                 return;
             }
 
             copyFile(test_dir, symlink_file, project_dir, dest);
-            fs.removeSync(project_dir);

Review comment:
       Won't this leave traces of the test behind? It's not cleared via the 
afterEach hook.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to