|
1 | 1 | import process from 'node:process'; |
2 | 2 | import fs from 'node:fs'; |
3 | 3 | import path from 'node:path'; |
| 4 | +import {pathToFileURL} from 'node:url'; |
4 | 5 | import test from 'ava'; |
5 | 6 | import {temporaryDirectory, temporaryFile} from 'tempy'; |
6 | 7 | import gracefulFs from 'graceful-fs'; |
@@ -107,6 +108,22 @@ test('handles null bytes in path', t => { |
107 | 108 | t.regex(error.code, /ERR_INVALID_ARG_VALUE|ENOENT/); |
108 | 109 | }); |
109 | 110 |
|
| 111 | +test('accepts URL instance', t => { |
| 112 | + const directory = getFixture(); |
| 113 | + const urlPath = pathToFileURL(directory); |
| 114 | + const madeDirectory = makeDirectorySync(urlPath); |
| 115 | + t.true(madeDirectory.length > 0); |
| 116 | + assertDirectory(t, madeDirectory); |
| 117 | +}); |
| 118 | + |
| 119 | +test('accepts URL instance with custom fs', t => { |
| 120 | + const directory = getFixture(); |
| 121 | + const urlPath = pathToFileURL(directory); |
| 122 | + const madeDirectory = makeDirectorySync(urlPath, customFsOptions); |
| 123 | + t.true(madeDirectory.length > 0); |
| 124 | + assertDirectory(t, madeDirectory); |
| 125 | +}); |
| 126 | + |
110 | 127 | test('preserves EACCES error when parent directory lacks execute permission', t => { |
111 | 128 | if (process.platform === 'win32') { |
112 | 129 | t.pass('Skip on Windows'); |
|
0 commit comments