-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.js
37 lines (31 loc) · 963 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
'use strict';
require('mocha');
const path = require('path');
const assert = require('assert');
const gm = require('global-modules');
const paths = require('./');
const isWindows = process.platform === 'win32'
|| process.env.OSTYPE === 'msys'
|| process.env.OSTYPE === 'cygwin';
describe('paths', () => {
it('should return an array of directories', () => {
assert(paths().length > 1);
});
it('should include node_modules in the cwd', () => {
assert(paths().includes(path.join(process.cwd(), 'node_modules')));
});
it('should include /node_modules', () => {
assert(paths().includes('/node_modules'));
});
it('should include APPDATA path on windows', function() {
if (!isWindows) {
this.skip();
return;
}
let dir = path.join(process.env.APPDATA, 'npm', 'node_modules');
assert(paths().includes(dir));
});
it('should include npm global modules', () => {
assert(paths().includes(gm));
});
});