| 41 | }; |
| 42 | |
| 43 | export const buildDirectory = async fixtureDir => { |
| 44 | let fixturePath = resolve(FIXTURES_DIR, fixtureDir); |
| 45 | if (fixtureDir.endsWith('-with-cwd')) { |
| 46 | fixturePath = resolve(fixturePath, fixtureDir.replace('-with-cwd', '')); |
| 47 | } |
| 48 | |
| 49 | const dist = resolve(`${fixturePath}/dist`); |
| 50 | // clean up |
| 51 | await rimraf(dist); |
| 52 | if (!fixturePath.endsWith('ts-custom-declaration')) { |
| 53 | await rimraf(resolve(`${fixturePath}/types`)); |
| 54 | } |
| 55 | await rimraf(resolve(`${fixturePath}/.rts2_cache_cjs`)); |
| 56 | await rimraf(resolve(`${fixturePath}/.rts2_cache_es`)); |
| 57 | await rimraf(resolve(`${fixturePath}/.rts2_cache_umd`)); |
| 58 | |
| 59 | const script = await getBuildScript(fixturePath, DEFAULT_SCRIPT); |
| 60 | |
| 61 | const prevDir = process.cwd(); |
| 62 | process.chdir(resolve(fixturePath)); |
| 63 | |
| 64 | const parsedOpts = parseScript(script); |
| 65 | let { output } = await microbundle({ |
| 66 | ...parsedOpts, |
| 67 | cwd: parsedOpts.cwd !== '.' ? parsedOpts.cwd : resolve(fixturePath), |
| 68 | }); |
| 69 | output = output || ''; |
| 70 | |
| 71 | process.chdir(prevDir); |
| 72 | |
| 73 | return output; |
| 74 | }; |
no test coverage detected
searching dependent graphs…