| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 6b08d00 commit 954e2f2
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -25,26 +25,26 @@ const absoluteProtectedFolder = path.resolve(relativeProtectedFolder); | |||
| 25 | 25 | { | |
| 26 | 26 | assert.throws(() => { | |
| 27 | 27 | fs.writeFile(blockedFile, 'example', () => {}); | |
| 28 | - }, common.expectsError({ | ||
| 28 | + }, { | ||
| 29 | 29 | code: 'ERR_ACCESS_DENIED', | |
| 30 | 30 | permission: 'FileSystemWrite', | |
| 31 | 31 | resource: path.toNamespacedPath(blockedFile), | |
| 32 | - })); | ||
| 32 | + }); | ||
| 33 | 33 | assert.throws(() => { | |
| 34 | 34 | fs.writeFile(relativeProtectedFile, 'example', () => {}); | |
| 35 | - }, common.expectsError({ | ||
| 35 | + }, { | ||
| 36 | 36 | code: 'ERR_ACCESS_DENIED', | |
| 37 | 37 | permission: 'FileSystemWrite', | |
| 38 | 38 | resource: path.toNamespacedPath(absoluteProtectedFile), | |
| 39 | - })); | ||
| 39 | + }); | ||
| 40 | 40 | ||
| 41 | 41 | assert.throws(() => { | |
| 42 | 42 | fs.writeFile(path.join(blockedFolder, 'anyfile'), 'example', () => {}); | |
| 43 | - }, common.expectsError({ | ||
| 43 | + }, { | ||
| 44 | 44 | code: 'ERR_ACCESS_DENIED', | |
| 45 | 45 | permission: 'FileSystemWrite', | |
| 46 | 46 | resource: path.toNamespacedPath(path.join(blockedFolder, 'anyfile')), | |
| 47 | - })); | ||
| 47 | + }); | ||
| 48 | 48 | } | |
| 49 | 49 | ||
| 50 | 50 | // fs.createWriteStream | |
@@ -54,69 +54,69 @@ const absoluteProtectedFolder = path.resolve(relativeProtectedFolder); | |||
| 54 | 54 | const stream = fs.createWriteStream(blockedFile); | |
| 55 | 55 | stream.on('error', reject); | |
| 56 | 56 | }); | |
| 57 | - }, common.expectsError({ | ||
| 57 | + }, { | ||
| 58 | 58 | code: 'ERR_ACCESS_DENIED', | |
| 59 | 59 | permission: 'FileSystemWrite', | |
| 60 | 60 | resource: path.toNamespacedPath(blockedFile), | |
| 61 | - })).then(common.mustCall()); | ||
| 61 | + }).then(common.mustCall()); | ||
| 62 | 62 | assert.rejects(() => { | |
| 63 | 63 | return new Promise((_resolve, reject) => { | |
| 64 | 64 | const stream = fs.createWriteStream(relativeProtectedFile); | |
| 65 | 65 | stream.on('error', reject); | |
| 66 | 66 | }); | |
| 67 | - }, common.expectsError({ | ||
| 67 | + }, { | ||
| 68 | 68 | code: 'ERR_ACCESS_DENIED', | |
| 69 | 69 | permission: 'FileSystemWrite', | |
| 70 | 70 | resource: path.toNamespacedPath(absoluteProtectedFile), | |
| 71 | - })).then(common.mustCall()); | ||
| 71 | + }).then(common.mustCall()); | ||
| 72 | 72 | ||
| 73 | 73 | assert.rejects(() => { | |
| 74 | 74 | return new Promise((_resolve, reject) => { | |
| 75 | 75 | const stream = fs.createWriteStream(path.join(blockedFolder, 'example')); | |
| 76 | 76 | stream.on('error', reject); | |
| 77 | 77 | }); | |
| 78 | - }, common.expectsError({ | ||
| 78 | + }, { | ||
| 79 | 79 | code: 'ERR_ACCESS_DENIED', | |
| 80 | 80 | permission: 'FileSystemWrite', | |
| 81 | 81 | resource: path.toNamespacedPath(path.join(blockedFolder, 'example')), | |
| 82 | - })).then(common.mustCall()); | ||
| 82 | + }).then(common.mustCall()); | ||
| 83 | 83 | } | |
| 84 | 84 | ||
| 85 | 85 | // fs.utimes | |
| 86 | 86 | { | |
| 87 | 87 | assert.throws(() => { | |
| 88 | 88 | fs.utimes(blockedFile, new Date(), new Date(), () => {}); | |
| 89 | - }, common.expectsError({ | ||
| 89 | + }, { | ||
| 90 | 90 | code: 'ERR_ACCESS_DENIED', | |
| 91 | 91 | permission: 'FileSystemWrite', | |
| 92 | 92 | resource: path.toNamespacedPath(blockedFile), | |
| 93 | - })); | ||
| 93 | + }); | ||
| 94 | 94 | assert.throws(() => { | |
| 95 | 95 | fs.utimes(relativeProtectedFile, new Date(), new Date(), () => {}); | |
| 96 | - }, common.expectsError({ | ||
| 96 | + }, { | ||
| 97 | 97 | code: 'ERR_ACCESS_DENIED', | |
| 98 | 98 | permission: 'FileSystemWrite', | |
| 99 | 99 | resource: path.toNamespacedPath(absoluteProtectedFile), | |
| 100 | - })); | ||
| 100 | + }); | ||
| 101 | 101 | ||
| 102 | 102 | assert.throws(() => { | |
| 103 | 103 | fs.utimes(path.join(blockedFolder, 'anyfile'), new Date(), new Date(), () => {}); | |
| 104 | - }, common.expectsError({ | ||
| 104 | + }, { | ||
| 105 | 105 | code: 'ERR_ACCESS_DENIED', | |
| 106 | 106 | permission: 'FileSystemWrite', | |
| 107 | 107 | resource: path.toNamespacedPath(path.join(blockedFolder, 'anyfile')), | |
| 108 | - })); | ||
| 108 | + }); | ||
| 109 | 109 | } | |
| 110 | 110 | ||
| 111 | 111 | // fs.lutimes | |
| 112 | 112 | { | |
| 113 | 113 | assert.throws(() => { | |
| 114 | 114 | fs.lutimes(blockedFile, new Date(), new Date(), () => {}); | |
| 115 | - }, common.expectsError({ | ||
| 115 | + },{ | ||
| 116 | 116 | code: 'ERR_ACCESS_DENIED', | |
| 117 | 117 | permission: 'FileSystemWrite', | |
| 118 | 118 | resource: path.toNamespacedPath(blockedFile), | |
| 119 | - })); | ||
| 119 | + }); | ||
| 120 | 120 | } | |
| 121 | 121 | ||
| 122 | 122 | // fs.mkdir | |
@@ -125,37 +125,37 @@ const absoluteProtectedFolder = path.resolve(relativeProtectedFolder); | |||
| 125 | 125 | fs.mkdir(path.join(blockedFolder, 'any-folder'), (err) => { | |
| 126 | 126 | assert.ifError(err); | |
| 127 | 127 | }); | |
| 128 | - }, common.expectsError({ | ||
| 128 | + },{ | ||
| 129 | 129 | code: 'ERR_ACCESS_DENIED', | |
| 130 | 130 | permission: 'FileSystemWrite', | |
| 131 | 131 | resource: path.toNamespacedPath(path.join(blockedFolder, 'any-folder')), | |
| 132 | - })); | ||
| 132 | + }); | ||
| 133 | 133 | assert.throws(() => { | |
| 134 | 134 | fs.mkdir(path.join(relativeProtectedFolder, 'any-folder'), (err) => { | |
| 135 | 135 | assert.ifError(err); | |
| 136 | 136 | }); | |
| 137 | - }, common.expectsError({ | ||
| 137 | + },{ | ||
| 138 | 138 | code: 'ERR_ACCESS_DENIED', | |
| 139 | 139 | permission: 'FileSystemWrite', | |
| 140 | 140 | resource: path.toNamespacedPath(path.join(absoluteProtectedFolder, 'any-folder')), | |
| 141 | - })); | ||
| 141 | + }); | ||
| 142 | 142 | } | |
| 143 | 143 | ||
| 144 | 144 | { | |
| 145 | 145 | assert.throws(() => { | |
| 146 | 146 | fs.mkdtempSync(path.join(blockedFolder, 'any-folder')); | |
| 147 | - }, common.expectsError({ | ||
| 147 | + },{ | ||
| 148 | 148 | code: 'ERR_ACCESS_DENIED', | |
| 149 | 149 | permission: 'FileSystemWrite', | |
| 150 | - })); | ||
| 150 | + }); | ||
| 151 | 151 | assert.throws(() => { | |
| 152 | 152 | fs.mkdtemp(path.join(relativeProtectedFolder, 'any-folder'), (err) => { | |
| 153 | 153 | assert.ifError(err); | |
| 154 | 154 | }); | |
| 155 | - }, common.expectsError({ | ||
| 155 | + },{ | ||
| 156 | 156 | code: 'ERR_ACCESS_DENIED', | |
| 157 | 157 | permission: 'FileSystemWrite', | |
| 158 | - })); | ||
| 158 | + }); | ||
| 159 | 159 | } | |
| 160 | 160 | ||
| 161 | 161 | // fs.rename | |
@@ -164,93 +164,93 @@ const absoluteProtectedFolder = path.resolve(relativeProtectedFolder); | |||
| 164 | 164 | fs.rename(blockedFile, path.join(blockedFile, 'renamed'), (err) => { | |
| 165 | 165 | assert.ifError(err); | |
| 166 | 166 | }); | |
| 167 | - }, common.expectsError({ | ||
| 167 | + },{ | ||
| 168 | 168 | code: 'ERR_ACCESS_DENIED', | |
| 169 | 169 | permission: 'FileSystemWrite', | |
| 170 | 170 | resource: path.toNamespacedPath(blockedFile), | |
| 171 | - })); | ||
| 171 | + }); | ||
| 172 | 172 | assert.throws(() => { | |
| 173 | 173 | fs.rename(relativeProtectedFile, path.join(relativeProtectedFile, 'renamed'), (err) => { | |
| 174 | 174 | assert.ifError(err); | |
| 175 | 175 | }); | |
| 176 | - }, common.expectsError({ | ||
| 176 | + },{ | ||
| 177 | 177 | code: 'ERR_ACCESS_DENIED', | |
| 178 | 178 | permission: 'FileSystemWrite', | |
| 179 | 179 | resource: path.toNamespacedPath(absoluteProtectedFile), | |
| 180 | - })); | ||
| 180 | + }); | ||
| 181 | 181 | assert.throws(() => { | |
| 182 | 182 | fs.rename(blockedFile, path.join(regularFolder, 'renamed'), (err) => { | |
| 183 | 183 | assert.ifError(err); | |
| 184 | 184 | }); | |
| 185 | - }, common.expectsError({ | ||
| 185 | + },{ | ||
| 186 | 186 | code: 'ERR_ACCESS_DENIED', | |
| 187 | 187 | permission: 'FileSystemWrite', | |
| 188 | 188 | resource: path.toNamespacedPath(blockedFile), | |
| 189 | - })); | ||
| 189 | + }); | ||
| 190 | 190 | ||
| 191 | 191 | assert.throws(() => { | |
| 192 | 192 | fs.rename(regularFile, path.join(blockedFolder, 'renamed'), (err) => { | |
| 193 | 193 | assert.ifError(err); | |
| 194 | 194 | }); | |
| 195 | - }, common.expectsError({ | ||
| 195 | + },{ | ||
| 196 | 196 | code: 'ERR_ACCESS_DENIED', | |
| 197 | 197 | permission: 'FileSystemWrite', | |
| 198 | 198 | resource: path.toNamespacedPath(path.join(blockedFolder, 'renamed')), | |
| 199 | - })); | ||
| 199 | + }); | ||
| 200 | 200 | } | |
| 201 | 201 | ||
| 202 | 202 | // fs.copyFile | |
| 203 | 203 | { | |
| 204 | 204 | assert.throws(() => { | |
| 205 | 205 | fs.copyFileSync(regularFile, path.join(blockedFolder, 'any-file')); | |
| 206 | - }, common.expectsError({ | ||
| 206 | + },{ | ||
| 207 | 207 | code: 'ERR_ACCESS_DENIED', | |
| 208 | 208 | permission: 'FileSystemWrite', | |
| 209 | 209 | resource: path.toNamespacedPath(path.join(blockedFolder, 'any-file')), | |
| 210 | - })); | ||
| 210 | + }); | ||
| 211 | 211 | assert.throws(() => { | |
| 212 | 212 | fs.copyFileSync(regularFile, path.join(relativeProtectedFolder, 'any-file')); | |
| 213 | - }, common.expectsError({ | ||
| 213 | + },{ | ||
| 214 | 214 | code: 'ERR_ACCESS_DENIED', | |
| 215 | 215 | permission: 'FileSystemWrite', | |
| 216 | 216 | resource: path.toNamespacedPath(path.join(absoluteProtectedFolder, 'any-file')), | |
| 217 | - })); | ||
| 217 | + }); | ||
| 218 | 218 | } | |
| 219 | 219 | ||
| 220 | 220 | // fs.cp | |
| 221 | 221 | { | |
| 222 | 222 | assert.throws(() => { | |
| 223 | 223 | fs.cpSync(regularFile, path.join(blockedFolder, 'any-file')); | |
| 224 | - }, common.expectsError({ | ||
| 224 | + },{ | ||
| 225 | 225 | code: 'ERR_ACCESS_DENIED', | |
| 226 | 226 | permission: 'FileSystemWrite', | |
| 227 | 227 | resource: path.toNamespacedPath(path.join(blockedFolder, 'any-file')), | |
| 228 | - })); | ||
| 228 | + }); | ||
| 229 | 229 | assert.throws(() => { | |
| 230 | 230 | fs.cpSync(regularFile, path.join(relativeProtectedFolder, 'any-file')); | |
| 231 | - }, common.expectsError({ | ||
| 231 | + },{ | ||
| 232 | 232 | code: 'ERR_ACCESS_DENIED', | |
| 233 | 233 | permission: 'FileSystemWrite', | |
| 234 | 234 | resource: path.toNamespacedPath(path.join(absoluteProtectedFolder, 'any-file')), | |
| 235 | - })); | ||
| 235 | + }); | ||
| 236 | 236 | } | |
| 237 | 237 | ||
| 238 | 238 | // fs.rm | |
| 239 | 239 | { | |
| 240 | 240 | assert.throws(() => { | |
| 241 | 241 | fs.rmSync(blockedFolder, { recursive: true }); | |
| 242 | - }, common.expectsError({ | ||
| 242 | + },{ | ||
| 243 | 243 | code: 'ERR_ACCESS_DENIED', | |
| 244 | 244 | permission: 'FileSystemWrite', | |
| 245 | 245 | resource: path.toNamespacedPath(blockedFolder), | |
| 246 | - })); | ||
| 246 | + }); | ||
| 247 | 247 | assert.throws(() => { | |
| 248 | 248 | fs.rmSync(relativeProtectedFolder, { recursive: true }); | |
| 249 | - }, common.expectsError({ | ||
| 249 | + },{ | ||
| 250 | 250 | code: 'ERR_ACCESS_DENIED', | |
| 251 | 251 | permission: 'FileSystemWrite', | |
| 252 | 252 | resource: path.toNamespacedPath(absoluteProtectedFolder), | |
| 253 | - })); | ||
| 253 | + }); | ||
| 254 | 254 | } | |
| 255 | 255 | ||
| 256 | 256 | // fs.open | |
| Back | FazBrowse Home | New Git URL |
0 commit comments