@yugu/gogocode
Version:
The simplest tool to parse/transform/generate code on ast
26 lines (24 loc) • 598 B
JavaScript
const $ = require('../index');
test('$.child', () => {
expect(()=>{
const res = $(`function a() {
() => {
var b = 1
}
}`)
.find(`function a() {}`)
.child('body.body.0.expression')
expect(res.parent(2).generate().match('a'))
}).not.toThrow();
})
test('$.child program child', () => {
expect(() => {
const res = $(`function a() {
() => {
var b = 1
}
}`)
.child('body.body.0.expression')
expect(res.parent(2).generate().match('a'))
}).not.toThrow();
})