1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 41x 41x 17x 17x 17x 41x 437x | /*global jasmine*/ var recast = require('recast'); var matchers = { toEqualASTNode: function () { return { compare: function (actual, expected) { Iif (!expected || typeof expected !== 'object') { throw new Error( 'Expected value must be an object representing an AST node.\n' + 'Got ' + expected + '(' + typeof expected + ') instead.' ); } return {pass: recast.types.astNodesAreEquivalent(actual, expected)}; } }; } }; jasmine.getEnv().beforeEach(function() { jasmine.addMatchers(matchers); }); |