Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /usr/local/share/.cache/yarn/v6/npm-dotignore-0.1.2-integrity/node_modules/dotignore/test/ drwxr-xr-x | |
| Viewing file: Select action/file-type: 'use strict';
var fs = require('fs');
var path = require('path');
var rules = String(fs.readFileSync(path.join(process.cwd(), 'test', '.1-ignore')));
var matcher = require('../').createMatcher(rules);
var test = require('tape');
var checkDir = function checkDir(dir, paths, output) {
if (!output) { output = ''; }
paths.forEach(function (pathArr) {
var isDir = Array.isArray(pathArr);
var filename = isDir ? pathArr[0] : pathArr;
var resolved = path.join(dir, filename);
if (matcher.shouldIgnore(resolved)) {
output += '- ' + resolved + '\n';
} else if (isDir) {
output = checkDir(resolved, pathArr[1], output);
} else {
output += '+ ' + resolved + '\n';
}
});
return output;
};
test('expected output', function (t) {
process.chdir(path.join(process.cwd(), 'test'));
var root = [
'.ignore',
[
'a',
[
['a', ['notignored']],
'ignored',
'notignored',
'notlisted'
]
],
'expected',
'test.js'
];
var output = checkDir('.', root);
t.equal(output, String(fs.readFileSync('1-expected')));
t.end();
});
test('delimiter defaults to path.sep', function (t) {
t.equal(matcher.delimiter, path.sep);
t.end();
});
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0116 ]-- |