File tree Expand file tree Collapse file tree 3 files changed +166
-0
lines changed
src/utils/__tests__/__snapshots__ Expand file tree Collapse file tree 3 files changed +166
-0
lines changed Original file line number Diff line number Diff line change 7070 "temp" : " ^0.9.0"
7171 },
7272 "jest" : {
73+ "snapshotSerializers" : [
74+ " ./tests/NodePathSerializer.js"
75+ ],
7376 "setupFilesAfterEnv" : [
7477 " <rootDir>/tests/setupTestFramework.js"
7578 ],
Original file line number Diff line number Diff line change 1+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+ exports [` getMembers finds all "members" "inside" a MemberExpression 1` ] = `
4+ Array [
5+ Object {
6+ " argumentsPath" : Node {
7+ " arguments" : Array [
8+ Node {
9+ " end" : 12 ,
10+ " loc" : SourceLocation {
11+ " end" : Position {
12+ " column" : 12 ,
13+ " line" : 1 ,
14+ },
15+ " start" : Position {
16+ " column" : 9 ,
17+ " line" : 1 ,
18+ },
19+ },
20+ " raw" : " 123" ,
21+ " start" : 9 ,
22+ " type" : " Literal" ,
23+ " value" : 123 ,
24+ },
25+ ],
26+ " callee" : Node {
27+ " computed" : false ,
28+ " end" : 8 ,
29+ " loc" : SourceLocation {
30+ " end" : Position {
31+ " column" : 8 ,
32+ " line" : 1 ,
33+ },
34+ " start" : Position {
35+ " column" : 1 ,
36+ " line" : 1 ,
37+ },
38+ },
39+ " object" : Node {
40+ " end" : 4 ,
41+ " loc" : SourceLocation {
42+ " end" : Position {
43+ " column" : 4 ,
44+ " line" : 1 ,
45+ },
46+ " identifierName" : " foo" ,
47+ " start" : Position {
48+ " column" : 1 ,
49+ " line" : 1 ,
50+ },
51+ },
52+ " name" : " foo" ,
53+ " start" : 1 ,
54+ " type" : " Identifier" ,
55+ },
56+ " property" : Node {
57+ " end" : 8 ,
58+ " loc" : SourceLocation {
59+ " end" : Position {
60+ " column" : 8 ,
61+ " line" : 1 ,
62+ },
63+ " identifierName" : " bar" ,
64+ " start" : Position {
65+ " column" : 5 ,
66+ " line" : 1 ,
67+ },
68+ },
69+ " name" : " bar" ,
70+ " start" : 5 ,
71+ " type" : " Identifier" ,
72+ },
73+ " start" : 1 ,
74+ " type" : " MemberExpression" ,
75+ },
76+ " end" : 13 ,
77+ " loc" : SourceLocation {
78+ " end" : Position {
79+ " column" : 13 ,
80+ " line" : 1 ,
81+ },
82+ " start" : Position {
83+ " column" : 1 ,
84+ " line" : 1 ,
85+ },
86+ },
87+ " start" : 1 ,
88+ " type" : " CallExpression" ,
89+ },
90+ " computed" : false ,
91+ " path" : Node {
92+ " end" : 8 ,
93+ " loc" : SourceLocation {
94+ " end" : Position {
95+ " column" : 8 ,
96+ " line" : 1 ,
97+ },
98+ " identifierName" : " bar" ,
99+ " start" : Position {
100+ " column" : 5 ,
101+ " line" : 1 ,
102+ },
103+ },
104+ " name" : " bar" ,
105+ " start" : 5 ,
106+ " type" : " Identifier" ,
107+ },
108+ } ,
109+ Object {
110+ " argumentsPath" : null ,
111+ " computed" : true ,
112+ " path" : Node {
113+ " end" : 22 ,
114+ " loc" : SourceLocation {
115+ " end" : Position {
116+ " column" : 22 ,
117+ " line" : 1 ,
118+ },
119+ " identifierName" : " baz" ,
120+ " start" : Position {
121+ " column" : 19 ,
122+ " line" : 1 ,
123+ },
124+ },
125+ " name" : " baz" ,
126+ " start" : 19 ,
127+ " type" : " Identifier" ,
128+ },
129+ } ,
130+ Object {
131+ " argumentsPath" : null ,
132+ " computed" : true ,
133+ " path" : Node {
134+ " end" : 26 ,
135+ " loc" : SourceLocation {
136+ " end" : Position {
137+ " column" : 26 ,
138+ " line" : 1 ,
139+ },
140+ " start" : Position {
141+ " column" : 24 ,
142+ " line" : 1 ,
143+ },
144+ },
145+ " raw" : " 42" ,
146+ " start" : 24 ,
147+ " type" : " Literal" ,
148+ " value" : 42 ,
149+ },
150+ } ,
151+ ]
152+ ` ;
Original file line number Diff line number Diff line change 1+ const { NodePath } = require ( 'ast-types' ) ;
2+
3+ module . exports = {
4+ print ( val , serialize ) {
5+ return serialize ( val . node ) ;
6+ } ,
7+
8+ test ( val ) {
9+ return val && val instanceof NodePath ;
10+ } ,
11+ } ;
You can’t perform that action at this time.
0 commit comments