liferay / liferay-module-config-generator

GNU Lesser General Public License v3.0
4 stars 8 forks source link

Tmp test files aren't deleted if the test fails #37

Closed jbalsas closed 7 years ago

jbalsas commented 7 years ago

In tests with skipFileOverride: false, we use the following construction to make sure we restore the original files:

var tmpFileName = path.join(path.resolve(__dirname, 'modal'), 'namespace-define-custom.es.tmp.js');
    fs.copy(path.resolve(__dirname, 'modal/js/namespace-define-custom.es.js'), tmpFileName, function(error) {
        if (error) {
            throw error;
        }

        var configGenerator = new ConfigGenerator({...});

        configGenerator.process().then(function(config) {
            // assertions
            fs.remove(tmpFileName, function() {
                done();
            });
        });
 });

If the test fails, the tmpFile will not be removed, showing as an untracked file