(builder: new (_tsCode: string) => T, serializeSubstitutions: boolean)
| 655 | |
| 656 | const createTestBuilderFactory = |
| 657 | <T extends TestBuilder>(builder: new (_tsCode: string) => T, serializeSubstitutions: boolean) => |
| 658 | (...args: [string] | [TemplateStringsArray, ...any[]]): T => { |
| 659 | let tsCode: string; |
| 660 | if (typeof args[0] === "string") { |
| 661 | expect(serializeSubstitutions).toBe(false); |
| 662 | tsCode = args[0]; |
| 663 | } else { |
| 664 | let [raw, ...substitutions] = args; |
| 665 | if (serializeSubstitutions) { |
| 666 | substitutions = substitutions.map(s => formatCode(s)); |
| 667 | } |
| 668 | |
| 669 | tsCode = String.raw(Object.assign([], { raw }), ...substitutions); |
| 670 | } |
| 671 | |
| 672 | return new builder(tsCode); |
| 673 | }; |
| 674 | |
| 675 | export const testBundle = createTestBuilderFactory(BundleTestBuilder, false); |
| 676 | export const testModule = createTestBuilderFactory(ModuleTestBuilder, false); |
no test coverage detected