Skip to content

Commit 6984dcb

Browse files
committed
[Tests] fix indentation, manual linting.
1 parent c622aef commit 6984dcb

File tree

3 files changed

+58
-58
lines changed

3 files changed

+58
-58
lines changed

lib/async.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ module.exports = function resolve(x, options, callback) {
4343
else if (n) cb(null, n, pkg);
4444
else if (core[x]) return cb(null, x);
4545
else {
46-
var err = new Error("Cannot find module '" + x + "' from '" + y + "'");
47-
err.code = 'MODULE_NOT_FOUND';
48-
cb(err);
46+
var moduleError = new Error("Cannot find module '" + x + "' from '" + y + "'");
47+
moduleError.code = 'MODULE_NOT_FOUND';
48+
cb(moduleError);
4949
}
5050
});
5151

@@ -56,9 +56,9 @@ module.exports = function resolve(x, options, callback) {
5656
if (err) cb(err);
5757
else if (d) cb(null, d, pkg);
5858
else {
59-
var err = new Error("Cannot find module '" + x + "' from '" + y + "'");
60-
err.code = 'MODULE_NOT_FOUND';
61-
cb(err);
59+
var moduleError = new Error("Cannot find module '" + x + "' from '" + y + "'");
60+
moduleError.code = 'MODULE_NOT_FOUND';
61+
cb(moduleError);
6262
}
6363
});
6464
}

lib/sync.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ module.exports = function (x, options) {
99
var isFile = opts.isFile || function (file) {
1010
try {
1111
var stat = fs.statSync(file);
12-
} catch (err) {
13-
if (err && err.code === 'ENOENT') return false;
14-
throw err;
12+
} catch (e) {
13+
if (e && e.code === 'ENOENT') return false;
14+
throw e;
1515
}
1616
return stat.isFile() || stat.isFIFO();
1717
};
@@ -67,7 +67,7 @@ module.exports = function (x, options) {
6767
var n = loadAsDirectorySync(path.resolve(x, pkg.main));
6868
if (n) return n;
6969
}
70-
} catch (err) {}
70+
} catch (e) {}
7171
}
7272

7373
return loadAsFileSync(path.join(x, '/index'));

test/node-modules-paths.js

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -2,75 +2,75 @@ var test = require('tape');
22
var path = require('path');
33

44
var getAllNodeModulePathsUpwards = function (start, moduleDirectory) {
5-
if (!moduleDirectory) { moduleDirectory = 'node_modules'; }
6-
var currentPath = start;
7-
var expectedDirs = ['/' + path.join(currentPath, moduleDirectory)];
8-
while (currentPath && currentPath !== '/') {
9-
currentPath = path.join(currentPath, '../');
10-
expectedDirs.push('/' + path.join(currentPath, moduleDirectory));
11-
}
12-
return expectedDirs;
13-
}
5+
if (!moduleDirectory) { moduleDirectory = 'node_modules'; }
6+
var currentPath = start;
7+
var expectedDirs = ['/' + path.join(currentPath, moduleDirectory)];
8+
while (currentPath && currentPath !== '/') {
9+
currentPath = path.join(currentPath, '../');
10+
expectedDirs.push('/' + path.join(currentPath, moduleDirectory));
11+
}
12+
return expectedDirs;
13+
};
1414

1515
var nodeModulesPaths = require('../lib/node-modules-paths');
1616

1717
test('node-modules-paths', function (t) {
18-
t.test('no options', function (t) {
19-
var start = path.join(__dirname, 'resolver');
20-
var dirs = nodeModulesPaths(start);
18+
t.test('no options', function (t) {
19+
var start = path.join(__dirname, 'resolver');
20+
var dirs = nodeModulesPaths(start);
2121

22-
var expectedDirs = getAllNodeModulePathsUpwards(start);
22+
var expectedDirs = getAllNodeModulePathsUpwards(start);
2323

24-
t.deepEqual(dirs, expectedDirs);
24+
t.deepEqual(dirs, expectedDirs);
2525

26-
t.end();
27-
});
26+
t.end();
27+
});
2828

29-
t.test('empty options', function (t) {
30-
var start = path.join(__dirname, 'resolver');
31-
var dirs = nodeModulesPaths(start, {});
29+
t.test('empty options', function (t) {
30+
var start = path.join(__dirname, 'resolver');
31+
var dirs = nodeModulesPaths(start, {});
3232

33-
var expectedDirs = getAllNodeModulePathsUpwards(start);
33+
var expectedDirs = getAllNodeModulePathsUpwards(start);
3434

35-
t.deepEqual(dirs, expectedDirs);
35+
t.deepEqual(dirs, expectedDirs);
3636

37-
t.end();
38-
});
37+
t.end();
38+
});
3939

40-
t.test('with paths option', function (t) {
41-
var start = path.join(__dirname, 'resolver');
42-
var paths = ['a', 'b'];
43-
var dirs = nodeModulesPaths(start, { paths: paths });
40+
t.test('with paths option', function (t) {
41+
var start = path.join(__dirname, 'resolver');
42+
var paths = ['a', 'b'];
43+
var dirs = nodeModulesPaths(start, { paths: paths });
4444

45-
var expectedDirs = getAllNodeModulePathsUpwards(start);
45+
var expectedDirs = getAllNodeModulePathsUpwards(start);
4646

47-
t.deepEqual(dirs, expectedDirs.concat(paths));
47+
t.deepEqual(dirs, expectedDirs.concat(paths));
4848

49-
t.end();
50-
});
49+
t.end();
50+
});
5151

52-
t.test('with moduleDirectory option', function (t) {
53-
var start = path.join(__dirname, 'resolver');
54-
var paths = ['a', 'b'];
55-
var dirs = nodeModulesPaths(start, { paths: paths });
52+
t.test('with moduleDirectory option', function (t) {
53+
var start = path.join(__dirname, 'resolver');
54+
var paths = ['a', 'b'];
55+
var dirs = nodeModulesPaths(start, { paths: paths });
5656

57-
var expectedDirs = getAllNodeModulePathsUpwards(start);
57+
var expectedDirs = getAllNodeModulePathsUpwards(start);
5858

59-
t.deepEqual(dirs, expectedDirs.concat(paths));
59+
t.deepEqual(dirs, expectedDirs.concat(paths));
6060

61-
t.end();
62-
});
61+
t.end();
62+
});
6363

64-
t.test('with moduleDirectory and paths options', function (t) {
65-
var start = path.join(__dirname, 'resolver');
66-
var paths = ['a', 'b'];
67-
var moduleDirectory = 'not node modules';
68-
var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectory });
64+
t.test('with moduleDirectory and paths options', function (t) {
65+
var start = path.join(__dirname, 'resolver');
66+
var paths = ['a', 'b'];
67+
var moduleDirectory = 'not node modules';
68+
var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectory });
6969

70-
var expectedDirs = getAllNodeModulePathsUpwards(start, moduleDirectory);
70+
var expectedDirs = getAllNodeModulePathsUpwards(start, moduleDirectory);
7171

72-
t.deepEqual(dirs, expectedDirs.concat(paths));
72+
t.deepEqual(dirs, expectedDirs.concat(paths));
7373

74-
t.end();
75-
});
74+
t.end();
75+
});
7676
});

0 commit comments

Comments
 (0)