mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Fix a problem of file append test on Windows (#1431)
* Fix a problem of file append test on Windows * Skip the test case of file node that fails on Windows * Remove close() call * Fixed a recreated file test case on Windows
This commit is contained in:
parent
d7f59dac84
commit
848fb975ed
@ -154,8 +154,23 @@ describe('file Nodes', function() {
|
|||||||
var f = fs.readFileSync(fileToTest).toString();
|
var f = fs.readFileSync(fileToTest).toString();
|
||||||
f.should.equal("onetwo");
|
f.should.equal("onetwo");
|
||||||
|
|
||||||
|
if (os.type() === "Windows_NT") {
|
||||||
|
var dummyFile = path.join(resourcesDir,"50-file-test-dummy.txt");
|
||||||
|
fs.rename(fileToTest, dummyFile, function() {
|
||||||
|
recreateTest(n1, dummyFile);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
recreateTest(n1, fileToTest);
|
||||||
|
}
|
||||||
|
} catch(err) {
|
||||||
|
done(err);
|
||||||
|
}
|
||||||
|
},wait);
|
||||||
|
});
|
||||||
|
|
||||||
|
function recreateTest(n1, fileToDelete) {
|
||||||
// Delete the file
|
// Delete the file
|
||||||
fs.unlinkSync(fileToTest);
|
fs.unlinkSync(fileToDelete);
|
||||||
|
|
||||||
// Recreate it
|
// Recreate it
|
||||||
fs.writeFileSync(fileToTest,"");
|
fs.writeFileSync(fileToTest,"");
|
||||||
@ -175,11 +190,7 @@ describe('file Nodes', function() {
|
|||||||
done(err);
|
done(err);
|
||||||
}
|
}
|
||||||
},wait);
|
},wait);
|
||||||
} catch(err) {
|
|
||||||
done(err);
|
|
||||||
}
|
}
|
||||||
},wait);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user