Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import test from 'tape';
import postcss from 'postcss';
import plugin from '../lib';
import { name } from '../package.json';
import requireDir from 'require-directory';
import forEach from 'lodash/collection/forEach';
let suites = requireDir(module);
let tests = [];
forEach(suites, (test, suite) => {
tests = tests.concat(test.default.filter( test => test.message = `${suite}: ${test.message}`));
});
function process (css, options) {
return postcss(plugin(options)).process(css).css;
}
test(name, t => {
t.plan(tests.length);
tests.forEach(test => {
var options = test.options || {};
t.equal(process(test.fixture, options), test.expected, test.message);
(async () => {
try {
await initializeServices(services);
const seeds = requireDirectory(module, './seeds');
const aggregates = {};
for (let [key, seed] of Object.entries(seeds)) { await seed.default(services, aggregates); };
process.exit(0);
} catch (err) {
logger.error(err);
process.exit(1);
}
})();
import requireDirectory from 'require-directory';
import contains from 'lodash/collection/contains';
let processors = requireDirectory(module);
let types = Object.keys(processors);
let trblTypes = processors.trbl.types;
export function process(css) {
css.walkDecls( decl => {
if (contains(decl.value, 'null')) {
if (contains(types, decl.prop)) {
processors[decl.prop].default(decl);
}
else if (contains(trblTypes, decl.prop)) {
processors.trbl.default(decl);
}