(passPerPreset)
| 418 | let aliasBaseType = null; |
| 419 | |
| 420 | function execTest(passPerPreset) { |
| 421 | return transformSync("type Foo = number; let x = (y): Foo => y;", { |
| 422 | sourceType: "script", |
| 423 | passPerPreset: passPerPreset, |
| 424 | presets: [ |
| 425 | // First preset with our plugin, "before" |
| 426 | function () { |
| 427 | return { |
| 428 | plugins: [ |
| 429 | () => ({ |
| 430 | visitor: { |
| 431 | Function: function (path) { |
| 432 | const alias = path.scope |
| 433 | .getProgramParent() |
| 434 | .path.get("body")[0].node; |
| 435 | if (!babel.types.isTypeAlias(alias)) return; |
| 436 | |
| 437 | // In case of `passPerPreset` being `false`, the |
| 438 | // alias node is already removed by Flow plugin. |
| 439 | if (!alias) { |
| 440 | return; |
| 441 | } |
| 442 | |
| 443 | // In case of `passPerPreset` being `true`, the |
| 444 | // alias node should still exist. |
| 445 | aliasBaseType = alias.right.type; // NumberTypeAnnotation |
| 446 | }, |
| 447 | }, |
| 448 | }), |
| 449 | ], |
| 450 | }; |
| 451 | }, |
| 452 | |
| 453 | // env preset |
| 454 | [presetEnv, { targets: { browsers: "ie 6" } }], |
| 455 | |
| 456 | // Third preset for Flow. |
| 457 | () => ({ |
| 458 | plugins: [pluginSyntaxFlow, pluginFlowStripTypes], |
| 459 | }), |
| 460 | ], |
| 461 | }); |
| 462 | } |
| 463 | |
| 464 | // 1. passPerPreset: true |
| 465 |
no test coverage detected
searching dependent graphs…