A Jest snapshot serializer that pretty-prints Babel AST nodes (e.g., from @babel/parser) in a human-readable, indented format. Current stable version is 0.0.5 (unreleased beyond). No active release cadence; maintained sporadically. Differentiators: provides a clean, nested view of AST node properties, ideal for snapshot testing Babel plugins or AST transformations. Compared to alternatives like jest-serialize, it is purpose-built for Babel AST and outputs structured property lists. Works with Jest snapshotSerializers configuration.
npm install jest-serializer-babel-astVerified import paths — ran on the pinned version, not inferred.
Configures Jest to use the serializer, then generates a human-readable AST snapshot from parsed code.
Ensure you are using @babel/parser (or babylon) to generate AST nodes.
Make sure the snapshot content contains Babel AST nodes. For other objects, Jest's default serializer will be used.
Consider alternatives like jest-serializer-ast or writing your own serializer with a library like pretty-format.
If you need location data, configure Babel parser to include 'ranges' or check the node's 'loc' property.
Run: npm install jest-serializer-babel-ast --save-dev
Use: const serializer = require('jest-serializer-babel-ast');No dependency data recorded yet.