Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 730c3b2

Browse filesBrowse files
radelmannMylesBorins
authored andcommitted
test: refactor test-fs-fsync
- replace var with const. - remove successes var. - use assert.ifError() for handling all errors. - wrap all callbacks with common.mustCall(). PR-URL: #10176 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Italo A. Casas <me@italoacasas.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
1 parent 9c9d422 commit 730c3b2
Copy full SHA for 730c3b2

File tree

Expand file treeCollapse file tree

1 file changed

+14
-23
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+14
-23
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-fs-fsync.js‎

Copy file name to clipboard
+14-23Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,23 @@
11
'use strict';
2-
var common = require('../common');
3-
var assert = require('assert');
2+
const common = require('../common');
3+
const assert = require('assert');
44

5-
var path = require('path');
6-
var fs = require('fs');
7-
var successes = 0;
5+
const path = require('path');
6+
const fs = require('fs');
87

9-
var file = path.join(common.fixturesDir, 'a.js');
8+
const file = path.join(common.fixturesDir, 'a.js');
109

11-
fs.open(file, 'a', 0o777, function(err, fd) {
12-
if (err) throw err;
10+
fs.open(file, 'a', 0o777, common.mustCall(function(err, fd) {
11+
assert.ifError(err);
1312

1413
fs.fdatasyncSync(fd);
15-
successes++;
1614

1715
fs.fsyncSync(fd);
18-
successes++;
1916

20-
fs.fdatasync(fd, function(err) {
21-
if (err) throw err;
22-
successes++;
23-
fs.fsync(fd, function(err) {
24-
if (err) throw err;
25-
successes++;
26-
});
27-
});
28-
});
29-
30-
process.on('exit', function() {
31-
assert.equal(4, successes);
32-
});
17+
fs.fdatasync(fd, common.mustCall(function(err) {
18+
assert.ifError(err);
19+
fs.fsync(fd, common.mustCall(function(err) {
20+
assert.ifError(err);
21+
}));
22+
}));
23+
}));

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.