packages/babel-plugin-transform-new-target/test/fixtures/exec/reflect-class/exec.js
raw| 1 | const targets = []; |
| 2 | class Foo { |
| 3 | constructor() { |
| 4 | targets.push(new.target); |
| 5 | } |
| 6 | } |
| 7 | |
| 8 | class Bar extends Foo { |
| 9 | } |
| 10 | class Baz { |
| 11 | } |
| 12 | |
| 13 | Reflect.construct(Foo, []); |
| 14 | Reflect.construct(Foo, [], Bar); |
| 15 | Reflect.construct(Bar, []); |
| 16 | Reflect.construct(Bar, [], Baz); |
| 17 | Reflect.construct(Foo, [], Baz); |
| 18 | |
| 19 | expect(targets[0]).toBe(Foo); |
| 20 | |
| 21 | expect(targets[1]).toBe(Bar); |
| 22 | |
| 23 | expect(targets[2]).toBe(Bar); |
| 24 | |
| 25 | expect(targets[3]).toBe(Baz); |
| 26 | |
| 27 | expect(targets[4]).toBe(Baz); |