Windows: make invalid param errors recoverable by default (#3002)

* Tests: ensure writing to missing directory fails

Co-authored-by: Lovell Fuller <github@lovell.info>
This commit is contained in:
Kleis Auke Wolthuizen
2021-12-06 11:08:32 +01:00
committed by GitHub
parent add4c7928f
commit 659cdabd8e
3 changed files with 31 additions and 0 deletions

View File

@@ -797,6 +797,19 @@ describe('Input/output', function () {
});
});
it('Fails when writing to missing directory', async () => {
const create = {
width: 8,
height: 8,
channels: 3,
background: { r: 0, g: 0, b: 0 }
};
await assert.rejects(
() => sharp({ create }).toFile('does-not-exist/out.jpg'),
/unable to open for write/
);
});
describe('create new image', function () {
it('RGB', function (done) {
const create = {