pwd-fs 2.2.0 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.travis.yml +3 -0
- package/appveyor.yml +3 -0
- package/lib/src/index.d.ts +1 -0
- package/lib/src/index.js +0 -2
- package/lib/src/recurse-io-sync.js +0 -1
- package/lib/src/recurse-io.js +0 -1
- package/lib/test/append.spec.js +7 -8
- package/lib/test/bitmask.spec.js +10 -11
- package/lib/test/chmod.spec.js +9 -10
- package/lib/test/chown.spec.js +9 -10
- package/lib/test/constructor.spec.js +3 -4
- package/lib/test/copy.spec.js +12 -13
- package/lib/test/mkdir.spec.js +13 -14
- package/lib/test/read.spec.js +10 -11
- package/lib/test/readdir.spec.js +5 -6
- package/lib/test/remove.spec.js +7 -8
- package/lib/test/rename.spec.js +9 -10
- package/lib/test/stat.spec.js +11 -12
- package/lib/test/symlink.spec.js +11 -12
- package/lib/test/test.spec.js +10 -11
- package/lib/test/write.spec.js +12 -13
- package/package.json +8 -9
- package/readme.md +7 -6
- package/src/index.ts +0 -2
- package/tsconfig.json +2 -2
package/.travis.yml
CHANGED
package/appveyor.yml
CHANGED
package/lib/src/index.d.ts
CHANGED
package/lib/src/index.js
CHANGED
|
@@ -200,7 +200,6 @@ class PoweredFileSystem {
|
|
|
200
200
|
});
|
|
201
201
|
}
|
|
202
202
|
append(src, data, { sync = false, resolve = true, encoding = 'utf8', umask = 0o000, flag = 'a' } = {}) {
|
|
203
|
-
console.log(`'append' with be removed in the next major version. Use 'write' with { flag: 'a' } option`);
|
|
204
203
|
if (resolve) {
|
|
205
204
|
src = this.resolve(src);
|
|
206
205
|
}
|
|
@@ -296,4 +295,3 @@ class PoweredFileSystem {
|
|
|
296
295
|
}
|
|
297
296
|
exports.default = PoweredFileSystem;
|
|
298
297
|
module.exports = PoweredFileSystem;
|
|
299
|
-
//# sourceMappingURL=index.js.map
|
package/lib/src/recurse-io.js
CHANGED
package/lib/test/append.spec.js
CHANGED
|
@@ -11,7 +11,7 @@ const src_1 = __importDefault(require("../src"));
|
|
|
11
11
|
describe('append(src, data [, options])', () => {
|
|
12
12
|
beforeEach(() => {
|
|
13
13
|
const chance = new chance_1.default();
|
|
14
|
-
mock_fs_1.default({
|
|
14
|
+
(0, mock_fs_1.default)({
|
|
15
15
|
'tmpdir': {
|
|
16
16
|
'binapp': chance.string(),
|
|
17
17
|
'libxbase': mock_fs_1.default.directory()
|
|
@@ -29,7 +29,7 @@ describe('append(src, data [, options])', () => {
|
|
|
29
29
|
const payload = chance.string();
|
|
30
30
|
await pfs.append('./tmpdir/binapp', payload);
|
|
31
31
|
const after = await pfs.stat('./tmpdir/binapp');
|
|
32
|
-
assert_1.default(after.size > before.size);
|
|
32
|
+
(0, assert_1.default)(after.size > before.size);
|
|
33
33
|
});
|
|
34
34
|
it('Positive: Must append content to file when path is absolute', async () => {
|
|
35
35
|
const pfs = new src_1.default();
|
|
@@ -41,7 +41,7 @@ describe('append(src, data [, options])', () => {
|
|
|
41
41
|
resolve: false
|
|
42
42
|
});
|
|
43
43
|
const after = await pfs.stat('./tmpdir/binapp');
|
|
44
|
-
assert_1.default(after.size > before.size);
|
|
44
|
+
(0, assert_1.default)(after.size > before.size);
|
|
45
45
|
});
|
|
46
46
|
it(`Negative: Unexpected option 'flag' returns Error`, async () => {
|
|
47
47
|
const pfs = new src_1.default();
|
|
@@ -53,7 +53,7 @@ describe('append(src, data [, options])', () => {
|
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
55
|
catch (err) {
|
|
56
|
-
assert_1.default(err.errno === -9);
|
|
56
|
+
(0, assert_1.default)(err.errno === -9);
|
|
57
57
|
}
|
|
58
58
|
});
|
|
59
59
|
describe('sync mode', () => {
|
|
@@ -66,7 +66,7 @@ describe('append(src, data [, options])', () => {
|
|
|
66
66
|
sync: true
|
|
67
67
|
});
|
|
68
68
|
const after = await pfs.stat('./tmpdir/binapp');
|
|
69
|
-
assert_1.default(after.size > before.size);
|
|
69
|
+
(0, assert_1.default)(after.size > before.size);
|
|
70
70
|
});
|
|
71
71
|
it('Positive: Must append content to file when path is absolute', async () => {
|
|
72
72
|
const pfs = new src_1.default();
|
|
@@ -79,7 +79,7 @@ describe('append(src, data [, options])', () => {
|
|
|
79
79
|
resolve: false
|
|
80
80
|
});
|
|
81
81
|
const after = await pfs.stat('./tmpdir/binapp');
|
|
82
|
-
assert_1.default(after.size > before.size);
|
|
82
|
+
(0, assert_1.default)(after.size > before.size);
|
|
83
83
|
});
|
|
84
84
|
it(`Negative: Unexpected option 'flag' returns Error`, async () => {
|
|
85
85
|
const pfs = new src_1.default();
|
|
@@ -92,9 +92,8 @@ describe('append(src, data [, options])', () => {
|
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
94
|
catch (err) {
|
|
95
|
-
assert_1.default(err.errno === -9);
|
|
95
|
+
(0, assert_1.default)(err.errno === -9);
|
|
96
96
|
}
|
|
97
97
|
});
|
|
98
98
|
});
|
|
99
99
|
});
|
|
100
|
-
//# sourceMappingURL=append.spec.js.map
|
package/lib/test/bitmask.spec.js
CHANGED
|
@@ -7,15 +7,15 @@ const assert_1 = __importDefault(require("assert"));
|
|
|
7
7
|
const src_1 = __importDefault(require("../src"));
|
|
8
8
|
describe('static bitmask(mode: number)', () => {
|
|
9
9
|
it('Positive: Calculate bitmask', () => {
|
|
10
|
-
assert_1.default(src_1.default.bitmask(33024) === 0o400); // (r--------)
|
|
11
|
-
assert_1.default(src_1.default.bitmask(33152) === 0o600); // (rw-------)
|
|
12
|
-
assert_1.default(src_1.default.bitmask(33216) === 0o700); // (rwx------)
|
|
13
|
-
assert_1.default(src_1.default.bitmask(32800) === 0o040); // (---r-----)
|
|
14
|
-
assert_1.default(src_1.default.bitmask(32816) === 0o060); // (---rw----)
|
|
15
|
-
assert_1.default(src_1.default.bitmask(32824) === 0o070); // (---rwx---)
|
|
16
|
-
assert_1.default(src_1.default.bitmask(32772) === 0o004); // (------r--)
|
|
17
|
-
assert_1.default(src_1.default.bitmask(32774) === 0o006); // (------rw-)
|
|
18
|
-
assert_1.default(src_1.default.bitmask(32775) === 0o007); // (------rwx)
|
|
10
|
+
(0, assert_1.default)(src_1.default.bitmask(33024) === 0o400); // (r--------)
|
|
11
|
+
(0, assert_1.default)(src_1.default.bitmask(33152) === 0o600); // (rw-------)
|
|
12
|
+
(0, assert_1.default)(src_1.default.bitmask(33216) === 0o700); // (rwx------)
|
|
13
|
+
(0, assert_1.default)(src_1.default.bitmask(32800) === 0o040); // (---r-----)
|
|
14
|
+
(0, assert_1.default)(src_1.default.bitmask(32816) === 0o060); // (---rw----)
|
|
15
|
+
(0, assert_1.default)(src_1.default.bitmask(32824) === 0o070); // (---rwx---)
|
|
16
|
+
(0, assert_1.default)(src_1.default.bitmask(32772) === 0o004); // (------r--)
|
|
17
|
+
(0, assert_1.default)(src_1.default.bitmask(32774) === 0o006); // (------rw-)
|
|
18
|
+
(0, assert_1.default)(src_1.default.bitmask(32775) === 0o007); // (------rwx)
|
|
19
19
|
});
|
|
20
20
|
it(`Negative: Throw an exception if the argument is 'null' type`, () => {
|
|
21
21
|
try {
|
|
@@ -23,8 +23,7 @@ describe('static bitmask(mode: number)', () => {
|
|
|
23
23
|
src_1.default.bitmask(null);
|
|
24
24
|
}
|
|
25
25
|
catch (err) {
|
|
26
|
-
assert_1.default(err);
|
|
26
|
+
(0, assert_1.default)(err);
|
|
27
27
|
}
|
|
28
28
|
});
|
|
29
29
|
});
|
|
30
|
-
//# sourceMappingURL=bitmask.spec.js.map
|
package/lib/test/chmod.spec.js
CHANGED
|
@@ -11,7 +11,7 @@ const src_1 = __importDefault(require("../src"));
|
|
|
11
11
|
describe('chmod(src, mode [, options])', () => {
|
|
12
12
|
beforeEach(() => {
|
|
13
13
|
const chance = new chance_1.default();
|
|
14
|
-
mock_fs_1.default({
|
|
14
|
+
(0, mock_fs_1.default)({
|
|
15
15
|
'tmpdir': {
|
|
16
16
|
'binapp': chance.string(),
|
|
17
17
|
'libxbase': mock_fs_1.default.directory()
|
|
@@ -27,7 +27,7 @@ describe('chmod(src, mode [, options])', () => {
|
|
|
27
27
|
await pfs.chmod('./tmpdir', 0o744);
|
|
28
28
|
const { mode } = await pfs.stat('./tmpdir/binapp');
|
|
29
29
|
const umask = src_1.default.bitmask(mode);
|
|
30
|
-
assert_1.default(umask === 0o744);
|
|
30
|
+
(0, assert_1.default)(umask === 0o744);
|
|
31
31
|
});
|
|
32
32
|
it('Positive: Must be changes directory when path is absolute', async () => {
|
|
33
33
|
const pfs = new src_1.default();
|
|
@@ -37,7 +37,7 @@ describe('chmod(src, mode [, options])', () => {
|
|
|
37
37
|
});
|
|
38
38
|
const { mode } = await pfs.stat('./tmpdir/libxbase');
|
|
39
39
|
const umask = src_1.default.bitmask(mode);
|
|
40
|
-
assert_1.default(umask === 0o744);
|
|
40
|
+
(0, assert_1.default)(umask === 0o744);
|
|
41
41
|
});
|
|
42
42
|
it('Negative: Search permission is denied on a component of the path prefix', async () => {
|
|
43
43
|
const pfs = new src_1.default();
|
|
@@ -45,7 +45,7 @@ describe('chmod(src, mode [, options])', () => {
|
|
|
45
45
|
await pfs.chmod('./tmpdir', 0);
|
|
46
46
|
}
|
|
47
47
|
catch (err) {
|
|
48
|
-
assert_1.default(err.errno === -9);
|
|
48
|
+
(0, assert_1.default)(err.errno === -9);
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
51
|
it('Negative: Throw if not exists resource', async () => {
|
|
@@ -54,7 +54,7 @@ describe('chmod(src, mode [, options])', () => {
|
|
|
54
54
|
await pfs.chmod('./non-existent-source', 0o744);
|
|
55
55
|
}
|
|
56
56
|
catch (err) {
|
|
57
|
-
assert_1.default(err.errno === -2);
|
|
57
|
+
(0, assert_1.default)(err.errno === -2);
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
60
|
describe('sync mode', () => {
|
|
@@ -65,7 +65,7 @@ describe('chmod(src, mode [, options])', () => {
|
|
|
65
65
|
});
|
|
66
66
|
const { mode } = await pfs.stat('./tmpdir/binapp');
|
|
67
67
|
const umask = src_1.default.bitmask(mode);
|
|
68
|
-
assert_1.default(umask === 0o744);
|
|
68
|
+
(0, assert_1.default)(umask === 0o744);
|
|
69
69
|
});
|
|
70
70
|
it('Positive: Must be changes directory when path is absolute', async () => {
|
|
71
71
|
const pfs = new src_1.default();
|
|
@@ -76,7 +76,7 @@ describe('chmod(src, mode [, options])', () => {
|
|
|
76
76
|
});
|
|
77
77
|
const { mode } = await pfs.stat('./tmpdir/libxbase');
|
|
78
78
|
const umask = src_1.default.bitmask(mode);
|
|
79
|
-
assert_1.default(umask === 0o744);
|
|
79
|
+
(0, assert_1.default)(umask === 0o744);
|
|
80
80
|
});
|
|
81
81
|
it('Negative: Search permission is denied on a component of the path prefix', async () => {
|
|
82
82
|
const pfs = new src_1.default();
|
|
@@ -86,7 +86,7 @@ describe('chmod(src, mode [, options])', () => {
|
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
88
|
catch (err) {
|
|
89
|
-
assert_1.default(err.errno === -9);
|
|
89
|
+
(0, assert_1.default)(err.errno === -9);
|
|
90
90
|
}
|
|
91
91
|
});
|
|
92
92
|
it('Negative: Throw if not exists resource', async () => {
|
|
@@ -97,9 +97,8 @@ describe('chmod(src, mode [, options])', () => {
|
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
99
|
catch (err) {
|
|
100
|
-
assert_1.default(err.errno === -2);
|
|
100
|
+
(0, assert_1.default)(err.errno === -2);
|
|
101
101
|
}
|
|
102
102
|
});
|
|
103
103
|
});
|
|
104
104
|
});
|
|
105
|
-
//# sourceMappingURL=chmod.spec.js.map
|
package/lib/test/chown.spec.js
CHANGED
|
@@ -11,7 +11,7 @@ const src_1 = __importDefault(require("../src"));
|
|
|
11
11
|
describe('chown(src, uid, gid [, options])', () => {
|
|
12
12
|
beforeEach(() => {
|
|
13
13
|
const chance = new chance_1.default();
|
|
14
|
-
mock_fs_1.default({
|
|
14
|
+
(0, mock_fs_1.default)({
|
|
15
15
|
'tmpdir': {
|
|
16
16
|
'binapp': chance.string(),
|
|
17
17
|
'libxbase': mock_fs_1.default.directory()
|
|
@@ -26,13 +26,13 @@ describe('chown(src, uid, gid [, options])', () => {
|
|
|
26
26
|
const pfs = new src_1.default();
|
|
27
27
|
await pfs.chown('./tmpdir', 0, 0);
|
|
28
28
|
const { uid, gid } = await pfs.stat('./tmpdir');
|
|
29
|
-
assert_1.default(uid === 0 && gid === 0);
|
|
29
|
+
(0, assert_1.default)(uid === 0 && gid === 0);
|
|
30
30
|
});
|
|
31
31
|
it('Positive: Changes the permissions of a directory', async () => {
|
|
32
32
|
const pfs = new src_1.default();
|
|
33
33
|
await pfs.chown('./tmpdir/libxbase', 0, 0);
|
|
34
34
|
const { uid, gid } = await pfs.stat('./tmpdir/libxbase');
|
|
35
|
-
assert_1.default(uid === 0 && gid === 0);
|
|
35
|
+
(0, assert_1.default)(uid === 0 && gid === 0);
|
|
36
36
|
});
|
|
37
37
|
it('Positive: Changes the permissions of a file, when path is absolute', async () => {
|
|
38
38
|
const pfs = new src_1.default();
|
|
@@ -41,7 +41,7 @@ describe('chown(src, uid, gid [, options])', () => {
|
|
|
41
41
|
resolve: false
|
|
42
42
|
});
|
|
43
43
|
const { uid, gid } = await pfs.stat('./tmpdir/binapp');
|
|
44
|
-
assert_1.default(uid === 1 && gid === 1);
|
|
44
|
+
(0, assert_1.default)(uid === 1 && gid === 1);
|
|
45
45
|
});
|
|
46
46
|
it('Negative: To a non-existent resource to return an Error', async () => {
|
|
47
47
|
const pfs = new src_1.default();
|
|
@@ -49,7 +49,7 @@ describe('chown(src, uid, gid [, options])', () => {
|
|
|
49
49
|
await pfs.chown('./non-existent-source', 1, 1);
|
|
50
50
|
}
|
|
51
51
|
catch (err) {
|
|
52
|
-
assert_1.default(err.errno === -2);
|
|
52
|
+
(0, assert_1.default)(err.errno === -2);
|
|
53
53
|
}
|
|
54
54
|
});
|
|
55
55
|
describe('sync mode', () => {
|
|
@@ -59,7 +59,7 @@ describe('chown(src, uid, gid [, options])', () => {
|
|
|
59
59
|
sync: true
|
|
60
60
|
});
|
|
61
61
|
const { uid, gid } = await pfs.stat('./tmpdir/binapp');
|
|
62
|
-
assert_1.default(uid === 1 && gid === 1);
|
|
62
|
+
(0, assert_1.default)(uid === 1 && gid === 1);
|
|
63
63
|
});
|
|
64
64
|
it('Positive: Changes the permissions of a directory', async () => {
|
|
65
65
|
const pfs = new src_1.default();
|
|
@@ -67,7 +67,7 @@ describe('chown(src, uid, gid [, options])', () => {
|
|
|
67
67
|
sync: true
|
|
68
68
|
});
|
|
69
69
|
const { uid, gid } = await pfs.stat('./tmpdir');
|
|
70
|
-
assert_1.default(uid === 1 && gid === 1);
|
|
70
|
+
(0, assert_1.default)(uid === 1 && gid === 1);
|
|
71
71
|
});
|
|
72
72
|
it('Positive: Changes the permissions of a file, when path is absolute', async () => {
|
|
73
73
|
const pfs = new src_1.default();
|
|
@@ -77,7 +77,7 @@ describe('chown(src, uid, gid [, options])', () => {
|
|
|
77
77
|
resolve: false
|
|
78
78
|
});
|
|
79
79
|
const { uid, gid } = await pfs.stat('./tmpdir/binapp');
|
|
80
|
-
assert_1.default(uid === 1 && gid === 1);
|
|
80
|
+
(0, assert_1.default)(uid === 1 && gid === 1);
|
|
81
81
|
});
|
|
82
82
|
it(`Negative: To a non-existent resource to return an Error`, async () => {
|
|
83
83
|
const pfs = new src_1.default();
|
|
@@ -87,9 +87,8 @@ describe('chown(src, uid, gid [, options])', () => {
|
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
89
|
catch (err) {
|
|
90
|
-
assert_1.default(err.errno === -2);
|
|
90
|
+
(0, assert_1.default)(err.errno === -2);
|
|
91
91
|
}
|
|
92
92
|
});
|
|
93
93
|
});
|
|
94
94
|
});
|
|
95
|
-
//# sourceMappingURL=chown.spec.js.map
|
|
@@ -7,15 +7,14 @@ const assert_1 = __importDefault(require("assert"));
|
|
|
7
7
|
const src_1 = __importDefault(require("../src"));
|
|
8
8
|
describe('#constructor: new PoweredFileSystem(path)', () => {
|
|
9
9
|
it('Positive: Must be backwards compatible with #require', () => {
|
|
10
|
-
assert_1.default(require('../src') === src_1.default);
|
|
10
|
+
(0, assert_1.default)(require('../src') === src_1.default);
|
|
11
11
|
});
|
|
12
12
|
it('Positive: An empty path must match the context of the cwd', () => {
|
|
13
13
|
const { pwd } = new src_1.default();
|
|
14
|
-
assert_1.default(pwd === process.cwd());
|
|
14
|
+
(0, assert_1.default)(pwd === process.cwd());
|
|
15
15
|
});
|
|
16
16
|
it('Positive: Absolute path must match the context of the pwd', () => {
|
|
17
17
|
const { pwd } = new src_1.default(__dirname);
|
|
18
|
-
assert_1.default(pwd === __dirname);
|
|
18
|
+
(0, assert_1.default)(pwd === __dirname);
|
|
19
19
|
});
|
|
20
20
|
});
|
|
21
|
-
//# sourceMappingURL=constructor.spec.js.map
|
package/lib/test/copy.spec.js
CHANGED
|
@@ -12,7 +12,7 @@ const src_1 = __importDefault(require("../src"));
|
|
|
12
12
|
describe('copy(src, dir [, options])', () => {
|
|
13
13
|
beforeEach(() => {
|
|
14
14
|
const chance = new chance_1.default();
|
|
15
|
-
mock_fs_1.default({
|
|
15
|
+
(0, mock_fs_1.default)({
|
|
16
16
|
'tmpdir': {
|
|
17
17
|
'binapp': chance.string(),
|
|
18
18
|
'libxbase': mock_fs_1.default.directory()
|
|
@@ -29,7 +29,7 @@ describe('copy(src, dir [, options])', () => {
|
|
|
29
29
|
await pfs.copy('./tmpdir/binapp', dist);
|
|
30
30
|
const { mode } = await pfs.stat(`${dist}/binapp`);
|
|
31
31
|
const umask = src_1.default.bitmask(mode);
|
|
32
|
-
assert_1.default(umask === 0o666);
|
|
32
|
+
(0, assert_1.default)(umask === 0o666);
|
|
33
33
|
});
|
|
34
34
|
it('Positive: Recursive copying a directory', async () => {
|
|
35
35
|
const pfs = new src_1.default();
|
|
@@ -37,7 +37,7 @@ describe('copy(src, dir [, options])', () => {
|
|
|
37
37
|
await pfs.copy('./tmpdir', dist);
|
|
38
38
|
const { mode } = await pfs.stat(`${dist}/tmpdir/libxbase`);
|
|
39
39
|
const umask = src_1.default.bitmask(mode);
|
|
40
|
-
assert_1.default(umask === 0o777);
|
|
40
|
+
(0, assert_1.default)(umask === 0o777);
|
|
41
41
|
});
|
|
42
42
|
it('Positive: Recursive copying a directory. Permission check of file', async () => {
|
|
43
43
|
const pfs = new src_1.default();
|
|
@@ -45,7 +45,7 @@ describe('copy(src, dir [, options])', () => {
|
|
|
45
45
|
await pfs.copy('./tmpdir', dist);
|
|
46
46
|
const { mode } = await pfs.stat(`${dist}/tmpdir/binapp`);
|
|
47
47
|
const umask = src_1.default.bitmask(mode);
|
|
48
|
-
assert_1.default(umask === 0o666);
|
|
48
|
+
(0, assert_1.default)(umask === 0o666);
|
|
49
49
|
});
|
|
50
50
|
it('Positive: Copying a item file when path is absolute', async () => {
|
|
51
51
|
const pfs = new src_1.default();
|
|
@@ -56,7 +56,7 @@ describe('copy(src, dir [, options])', () => {
|
|
|
56
56
|
});
|
|
57
57
|
const { mode } = await pfs.stat(`${dist}/tmpdir/binapp`);
|
|
58
58
|
const umask = src_1.default.bitmask(mode);
|
|
59
|
-
assert_1.default(umask === 0o666);
|
|
59
|
+
(0, assert_1.default)(umask === 0o666);
|
|
60
60
|
});
|
|
61
61
|
it('Negative: Throw if not exists resource', async () => {
|
|
62
62
|
const pfs = new src_1.default();
|
|
@@ -64,7 +64,7 @@ describe('copy(src, dir [, options])', () => {
|
|
|
64
64
|
await pfs.copy('./non-existent', '.');
|
|
65
65
|
}
|
|
66
66
|
catch (err) {
|
|
67
|
-
assert_1.default(err.errno === -2);
|
|
67
|
+
(0, assert_1.default)(err.errno === -2);
|
|
68
68
|
}
|
|
69
69
|
});
|
|
70
70
|
it('Negative: An attempt to copy to an existing resource should return an Error', async () => {
|
|
@@ -73,7 +73,7 @@ describe('copy(src, dir [, options])', () => {
|
|
|
73
73
|
await pfs.copy('./tmpdir', '.');
|
|
74
74
|
}
|
|
75
75
|
catch (err) {
|
|
76
|
-
assert_1.default(err.errno === -17);
|
|
76
|
+
(0, assert_1.default)(err.errno === -17);
|
|
77
77
|
}
|
|
78
78
|
});
|
|
79
79
|
describe('sync mode', () => {
|
|
@@ -85,7 +85,7 @@ describe('copy(src, dir [, options])', () => {
|
|
|
85
85
|
});
|
|
86
86
|
const { mode } = await pfs.stat(`${dist}/binapp`);
|
|
87
87
|
const umask = src_1.default.bitmask(mode);
|
|
88
|
-
assert_1.default(umask === 0o666);
|
|
88
|
+
(0, assert_1.default)(umask === 0o666);
|
|
89
89
|
});
|
|
90
90
|
it('Positive: Recursive copying a directory', async () => {
|
|
91
91
|
const pfs = new src_1.default();
|
|
@@ -95,7 +95,7 @@ describe('copy(src, dir [, options])', () => {
|
|
|
95
95
|
});
|
|
96
96
|
const { mode } = await pfs.stat(`${dist}/tmpdir/libxbase`);
|
|
97
97
|
const umask = src_1.default.bitmask(mode);
|
|
98
|
-
assert_1.default(umask === 0o777);
|
|
98
|
+
(0, assert_1.default)(umask === 0o777);
|
|
99
99
|
});
|
|
100
100
|
it('Positive: Copying a item file when path is absolute', async () => {
|
|
101
101
|
const pfs = new src_1.default();
|
|
@@ -107,7 +107,7 @@ describe('copy(src, dir [, options])', () => {
|
|
|
107
107
|
});
|
|
108
108
|
const { mode } = await pfs.stat(`${dist}/tmpdir/binapp`);
|
|
109
109
|
const umask = src_1.default.bitmask(mode);
|
|
110
|
-
assert_1.default(umask === 0o666);
|
|
110
|
+
(0, assert_1.default)(umask === 0o666);
|
|
111
111
|
});
|
|
112
112
|
it('Negative: Throw if not exists resource', async () => {
|
|
113
113
|
const pfs = new src_1.default();
|
|
@@ -117,7 +117,7 @@ describe('copy(src, dir [, options])', () => {
|
|
|
117
117
|
});
|
|
118
118
|
}
|
|
119
119
|
catch (err) {
|
|
120
|
-
assert_1.default(err.errno === -2);
|
|
120
|
+
(0, assert_1.default)(err.errno === -2);
|
|
121
121
|
}
|
|
122
122
|
});
|
|
123
123
|
it('Negative: An attempt to copy to an existing resource should return an Error', async () => {
|
|
@@ -128,9 +128,8 @@ describe('copy(src, dir [, options])', () => {
|
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
130
|
catch (err) {
|
|
131
|
-
assert_1.default(err.errno === -17);
|
|
131
|
+
(0, assert_1.default)(err.errno === -17);
|
|
132
132
|
}
|
|
133
133
|
});
|
|
134
134
|
});
|
|
135
135
|
});
|
|
136
|
-
//# sourceMappingURL=copy.spec.js.map
|
package/lib/test/mkdir.spec.js
CHANGED
|
@@ -12,7 +12,7 @@ const src_1 = __importDefault(require("../src"));
|
|
|
12
12
|
describe('mkdir(src [, options])', () => {
|
|
13
13
|
beforeEach(() => {
|
|
14
14
|
const chance = new chance_1.default();
|
|
15
|
-
mock_fs_1.default({
|
|
15
|
+
(0, mock_fs_1.default)({
|
|
16
16
|
'tmpdir': {
|
|
17
17
|
'binapp': chance.string(),
|
|
18
18
|
'libxbase': mock_fs_1.default.directory()
|
|
@@ -29,19 +29,19 @@ describe('mkdir(src [, options])', () => {
|
|
|
29
29
|
const base = chance.guid();
|
|
30
30
|
await pfs.mkdir(`./tmpdir/${base}`);
|
|
31
31
|
const exist = await pfs.test(`./tmpdir/${base}`);
|
|
32
|
-
assert_1.default(exist);
|
|
32
|
+
(0, assert_1.default)(exist);
|
|
33
33
|
});
|
|
34
34
|
it(`Positive: Make current directory`, async () => {
|
|
35
35
|
const pfs = new src_1.default('./tmpdir');
|
|
36
36
|
await pfs.mkdir('.');
|
|
37
37
|
const exist = await pfs.test('.');
|
|
38
|
-
assert_1.default(exist);
|
|
38
|
+
(0, assert_1.default)(exist);
|
|
39
39
|
});
|
|
40
40
|
it(`Positive: Make current directory, when current directory is absolute path`, async () => {
|
|
41
41
|
const pfs = new src_1.default('./tmpdir');
|
|
42
42
|
await pfs.mkdir(process.cwd());
|
|
43
43
|
const exist = await pfs.test('.');
|
|
44
|
-
assert_1.default(exist);
|
|
44
|
+
(0, assert_1.default)(exist);
|
|
45
45
|
});
|
|
46
46
|
it('Positive: Should work fine with the existing directory', async () => {
|
|
47
47
|
const pfs = new src_1.default();
|
|
@@ -50,7 +50,7 @@ describe('mkdir(src [, options])', () => {
|
|
|
50
50
|
for (const item of [base, base]) {
|
|
51
51
|
await pfs.mkdir(`./tmpdir/${item}`);
|
|
52
52
|
const exist = await pfs.test(`./tmpdir/${item}`);
|
|
53
|
-
assert_1.default(exist);
|
|
53
|
+
(0, assert_1.default)(exist);
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
56
|
it('Positive: Create directories when path is absolute', async () => {
|
|
@@ -62,7 +62,7 @@ describe('mkdir(src [, options])', () => {
|
|
|
62
62
|
resolve: false
|
|
63
63
|
});
|
|
64
64
|
const exist = await pfs.test(`${tmpdir}${path_1.sep}${base}`);
|
|
65
|
-
assert_1.default(exist);
|
|
65
|
+
(0, assert_1.default)(exist);
|
|
66
66
|
});
|
|
67
67
|
it('Negative: Throw an exception if trying to create a directory in file', async () => {
|
|
68
68
|
const pfs = new src_1.default();
|
|
@@ -72,7 +72,7 @@ describe('mkdir(src [, options])', () => {
|
|
|
72
72
|
await pfs.mkdir(`./tmpdir/binapp/${base}`);
|
|
73
73
|
}
|
|
74
74
|
catch (err) {
|
|
75
|
-
assert_1.default(err.errno === -20);
|
|
75
|
+
(0, assert_1.default)(err.errno === -20);
|
|
76
76
|
}
|
|
77
77
|
});
|
|
78
78
|
describe('sync mode', () => {
|
|
@@ -84,7 +84,7 @@ describe('mkdir(src [, options])', () => {
|
|
|
84
84
|
sync: true
|
|
85
85
|
});
|
|
86
86
|
const exist = await pfs.test(`./tmpdir/${base}`);
|
|
87
|
-
assert_1.default(exist);
|
|
87
|
+
(0, assert_1.default)(exist);
|
|
88
88
|
});
|
|
89
89
|
it('Positive: Make current directory', async () => {
|
|
90
90
|
const pfs = new src_1.default('./tmpdir');
|
|
@@ -92,7 +92,7 @@ describe('mkdir(src [, options])', () => {
|
|
|
92
92
|
sync: true
|
|
93
93
|
});
|
|
94
94
|
const exist = await pfs.test('.');
|
|
95
|
-
assert_1.default(exist);
|
|
95
|
+
(0, assert_1.default)(exist);
|
|
96
96
|
});
|
|
97
97
|
it('Positive: Should work fine with the existing directory', async () => {
|
|
98
98
|
const pfs = new src_1.default();
|
|
@@ -103,7 +103,7 @@ describe('mkdir(src [, options])', () => {
|
|
|
103
103
|
sync: true
|
|
104
104
|
});
|
|
105
105
|
const exist = await pfs.test(`./tmpdir/${item}`);
|
|
106
|
-
assert_1.default(exist);
|
|
106
|
+
(0, assert_1.default)(exist);
|
|
107
107
|
}
|
|
108
108
|
});
|
|
109
109
|
it('Positive: Create directories when path is absolute', async () => {
|
|
@@ -116,7 +116,7 @@ describe('mkdir(src [, options])', () => {
|
|
|
116
116
|
resolve: false
|
|
117
117
|
});
|
|
118
118
|
const exist = await pfs.test(`${tmpdir}${path_1.sep}${base}`);
|
|
119
|
-
assert_1.default(exist);
|
|
119
|
+
(0, assert_1.default)(exist);
|
|
120
120
|
});
|
|
121
121
|
it('Positive: Create in current directories when path is absolute', async () => {
|
|
122
122
|
const pfs = new src_1.default();
|
|
@@ -128,7 +128,7 @@ describe('mkdir(src [, options])', () => {
|
|
|
128
128
|
resolve: false
|
|
129
129
|
});
|
|
130
130
|
const exist = await pfs.test(base);
|
|
131
|
-
assert_1.default(exist);
|
|
131
|
+
(0, assert_1.default)(exist);
|
|
132
132
|
});
|
|
133
133
|
it('Negative: Throw an exception if trying to create a directory in file', async () => {
|
|
134
134
|
const pfs = new src_1.default();
|
|
@@ -140,9 +140,8 @@ describe('mkdir(src [, options])', () => {
|
|
|
140
140
|
});
|
|
141
141
|
}
|
|
142
142
|
catch (err) {
|
|
143
|
-
assert_1.default(err.errno === -20);
|
|
143
|
+
(0, assert_1.default)(err.errno === -20);
|
|
144
144
|
}
|
|
145
145
|
});
|
|
146
146
|
});
|
|
147
147
|
});
|
|
148
|
-
//# sourceMappingURL=mkdir.spec.js.map
|
package/lib/test/read.spec.js
CHANGED
|
@@ -11,7 +11,7 @@ const src_1 = __importDefault(require("../src"));
|
|
|
11
11
|
describe('read(src [, options])', () => {
|
|
12
12
|
beforeEach(() => {
|
|
13
13
|
const chance = new chance_1.default();
|
|
14
|
-
mock_fs_1.default({
|
|
14
|
+
(0, mock_fs_1.default)({
|
|
15
15
|
'tmpdir': {
|
|
16
16
|
'binapp': chance.string(),
|
|
17
17
|
'libxbase': mock_fs_1.default.directory()
|
|
@@ -25,14 +25,14 @@ describe('read(src [, options])', () => {
|
|
|
25
25
|
it('Positive: Must read content of file; String type by default', async () => {
|
|
26
26
|
const pfs = new src_1.default();
|
|
27
27
|
const raw = await pfs.read('./tmpdir/binapp');
|
|
28
|
-
assert_1.default(raw.length > 0);
|
|
28
|
+
(0, assert_1.default)(raw.length > 0);
|
|
29
29
|
});
|
|
30
30
|
it('Positive: Must read Buffer content of file when encoding is null', async () => {
|
|
31
31
|
const pfs = new src_1.default();
|
|
32
32
|
const raw = await pfs.read('./tmpdir/binapp', {
|
|
33
33
|
encoding: null
|
|
34
34
|
});
|
|
35
|
-
assert_1.default(raw instanceof Buffer);
|
|
35
|
+
(0, assert_1.default)(raw instanceof Buffer);
|
|
36
36
|
});
|
|
37
37
|
it('Positive: Must read content of file, when path is absolute', async () => {
|
|
38
38
|
const pfs = new src_1.default();
|
|
@@ -40,7 +40,7 @@ describe('read(src [, options])', () => {
|
|
|
40
40
|
const raw = await pfs.read(`${cwd}${path_1.sep}tmpdir${path_1.sep}binapp`, {
|
|
41
41
|
resolve: false
|
|
42
42
|
});
|
|
43
|
-
assert_1.default(raw.length > 0);
|
|
43
|
+
(0, assert_1.default)(raw.length > 0);
|
|
44
44
|
});
|
|
45
45
|
it('Negative: Throw if resource is not file', async () => {
|
|
46
46
|
const pfs = new src_1.default();
|
|
@@ -48,7 +48,7 @@ describe('read(src [, options])', () => {
|
|
|
48
48
|
await pfs.read(`./tmpdir/libxbase`);
|
|
49
49
|
}
|
|
50
50
|
catch (err) {
|
|
51
|
-
assert_1.default(err.errno === -21);
|
|
51
|
+
(0, assert_1.default)(err.errno === -21);
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
54
|
it('Negative: Throw if not exists resource', async () => {
|
|
@@ -59,7 +59,7 @@ describe('read(src [, options])', () => {
|
|
|
59
59
|
await pfs.read(`./${base}`);
|
|
60
60
|
}
|
|
61
61
|
catch (err) {
|
|
62
|
-
assert_1.default(err.errno === -2);
|
|
62
|
+
(0, assert_1.default)(err.errno === -2);
|
|
63
63
|
}
|
|
64
64
|
});
|
|
65
65
|
describe('sync mode', () => {
|
|
@@ -68,7 +68,7 @@ describe('read(src [, options])', () => {
|
|
|
68
68
|
const { length } = pfs.read('./tmpdir/binapp', {
|
|
69
69
|
sync: true
|
|
70
70
|
});
|
|
71
|
-
assert_1.default(length > 0);
|
|
71
|
+
(0, assert_1.default)(length > 0);
|
|
72
72
|
});
|
|
73
73
|
it('Positive: Must read Buffer content of file when encoding is null', async () => {
|
|
74
74
|
const pfs = new src_1.default();
|
|
@@ -76,7 +76,7 @@ describe('read(src [, options])', () => {
|
|
|
76
76
|
encoding: null,
|
|
77
77
|
sync: true
|
|
78
78
|
});
|
|
79
|
-
assert_1.default(raw instanceof Buffer);
|
|
79
|
+
(0, assert_1.default)(raw instanceof Buffer);
|
|
80
80
|
});
|
|
81
81
|
it('Positive: Must read content of file, when path is absolute', async () => {
|
|
82
82
|
const pfs = new src_1.default();
|
|
@@ -85,7 +85,7 @@ describe('read(src [, options])', () => {
|
|
|
85
85
|
sync: true,
|
|
86
86
|
resolve: false
|
|
87
87
|
});
|
|
88
|
-
assert_1.default(length > 0);
|
|
88
|
+
(0, assert_1.default)(length > 0);
|
|
89
89
|
});
|
|
90
90
|
it(`Negative: Throw if not exists resource`, async () => {
|
|
91
91
|
const pfs = new src_1.default();
|
|
@@ -97,9 +97,8 @@ describe('read(src [, options])', () => {
|
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
99
|
catch (err) {
|
|
100
|
-
assert_1.default(err.errno === -2);
|
|
100
|
+
(0, assert_1.default)(err.errno === -2);
|
|
101
101
|
}
|
|
102
102
|
});
|
|
103
103
|
});
|
|
104
104
|
});
|
|
105
|
-
//# sourceMappingURL=read.spec.js.map
|