* Load a resource in test/fixtures/wpt specified with a URL * @param {string} from the path of the file loading this resource, * relative to the WPT folder. * @param {string} url the url of the resource being loaded. * @returns {Promise<{ * ok: string, * arrayBuffer: function
(from, url)
| 219 | * }>} |
| 220 | */ |
| 221 | async readAsFetch(from, url) { |
| 222 | const file = this.toRealFilePath(from, url); |
| 223 | const data = await fsPromises.readFile(file); |
| 224 | return { |
| 225 | ok: true, |
| 226 | arrayBuffer() { return data.buffer; }, |
| 227 | bytes() { return new Uint8Array(data); }, |
| 228 | json() { return JSON.parse(data.toString()); }, |
| 229 | text() { return data.toString(); }, |
| 230 | }; |
| 231 | } |
| 232 | } |
| 233 | |
| 234 | class StatusRule { |
no test coverage detected