()
| 109 | } |
| 110 | |
| 111 | function generateTestFile() { |
| 112 | const uniqueImports = Array.from(new Set(testImports)).sort(); |
| 113 | |
| 114 | const output: string[] = []; |
| 115 | |
| 116 | output.push(`/* tslint:disable */`); |
| 117 | output.push(`import { compare, report } from "./module-compare";\n\n`); |
| 118 | |
| 119 | uniqueImports.forEach((name) => { |
| 120 | const moduleName = name.replace(/[\.\/\-]/g, '_'); |
| 121 | const compatName = `module_${moduleName}_compat`; |
| 122 | const coreName = `module_${moduleName}_core`; |
| 123 | output.push(`import * as ${coreName} from "@nativescript/core/${name}";`); |
| 124 | output.push(`import * as ${compatName} from "tns-core-modules/${name}";`); |
| 125 | output.push(`compare("${name}", ${coreName}, ${compatName});\n`); |
| 126 | }); |
| 127 | |
| 128 | output.push(`\n`); |
| 129 | output.push(`report();`); |
| 130 | |
| 131 | const testFilePath = path.resolve('dist/generated-tests/tests.ts'); |
| 132 | ensureDirectoryExistence(testFilePath); |
| 133 | |
| 134 | fs.writeFileSync(testFilePath, output.join('\n'), 'utf8'); |
| 135 | (<any>fs).copyFileSync(path.resolve('build/generated-compat-checks/module-compare.ts'), path.resolve('dist/generated-tests/module-compare.ts')); |
| 136 | |
| 137 | console.log(`Compat tests generated: ${testFilePath}`); |
| 138 | } |
| 139 | |
| 140 | function generateExportsForPrivateModules() { |
| 141 | privateModulesWhitelist.forEach((pathNoExt) => { |
no test coverage detected