We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 24691dd commit e29d667Copy full SHA for e29d667
test/common/wpt.js
@@ -503,9 +503,16 @@ class StatusLoader {
503
const jsonFile = path.join(dir, 'status', `${this.path}.json`);
504
let result;
505
506
- if (fs.existsSync(jsonFile)) {
+ let fd;
507
+ try {
508
+ fd = fs.openSync(jsonFile, 'r');
509
+ } catch (err) {
510
+ if (err?.code !== 'ENOENT') throw err;
511
+ }
512
+ if (fd) {
513
this.statusFile = `${this.path}.json`;
- result = JSON.parse(fs.readFileSync(jsonFile, 'utf8'));
514
+ result = JSON.parse(fs.readFileSync(fd, 'utf8'));
515
+ fs.closeSync(fd);
516
} else {
517
this.statusFile = `${this.path}.cjs`;
518
result = require(path.join(dir, 'status', this.statusFile));
0 commit comments