jscodeshaft
Version:
Collection of more or less primitive helpers and abstractions for JSCodeShift, build for design system migrations and upgrades.
28 lines (21 loc) • 671 B
JavaScript
// helpers
const {astToSource} = require('../../../general');
// this
const {getMeaningfulChildren} = require('../../');
const {initHelpers} = require('../../../../helpers/tests');
// prep
const {
runSnapshotTest,
getProcessorScaffold,
} = initHelpers(__dirname);
describe('traversal::getMeaningfulChildren()', () => {
runSnapshotTest({
title: 'should trim all whitespace text nodes',
moduleName: 'mixed.js',
processor: (fileInfo, api) => {
const {root, testWrapperNode} = getProcessorScaffold(fileInfo, api);
testWrapperNode.children = getMeaningfulChildren(testWrapperNode.children);
return astToSource(root);
},
});
});