Skip to content

Commit 39a6f38

Browse files
committed
test: add failing test for ast-types scope
This witnesses some initialisation weirdness fixed in the next commit.
1 parent 38b017f commit 39a6f38

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/astx/bugs_scope.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { TransformOptions } from '../../src'
2+
import { astxTestcase } from '../astxTestcase'
3+
import { NodePath as AstTypesNodePath } from 'ast-types/lib/node-path'
4+
import dedent from 'dedent-js'
5+
6+
astxTestcase({
7+
file: __filename,
8+
input: dedent`
9+
const foo = 1;
10+
`,
11+
parsers: ['babel', 'babel/tsx'],
12+
astx: ({ astx, report }: TransformOptions): void => {
13+
const path = astx.find`const foo = 1;`.paths[0]
14+
report((path as AstTypesNodePath).scope !== null)
15+
},
16+
expectedReports: [true],
17+
})

0 commit comments

Comments
 (0)