mirror of
https://github.com/developit/microbundle.git
synced 2026-01-25 14:06:50 +00:00
Merge pull request #358 from jviide/up-to-eleven
Fix failing tests by setting fixture test timeout to 11000ms
This commit is contained in:
commit
66cce0753f
@ -13,6 +13,7 @@ const rimraf = promisify(_rimraf);
|
||||
|
||||
const FIXTURES_DIR = `${__dirname}/fixtures`;
|
||||
const DEFAULT_SCRIPT = 'microbundle';
|
||||
const TEST_TIMEOUT = 11000;
|
||||
|
||||
const join = (arr, delimiter = '') => arr.join(delimiter);
|
||||
|
||||
@ -61,49 +62,56 @@ describe('fixtures', () => {
|
||||
return;
|
||||
}
|
||||
|
||||
it(fixtureDir, async () => {
|
||||
if (fixtureDir.endsWith('-with-cwd')) {
|
||||
fixturePath = resolve(fixturePath, fixtureDir.replace('-with-cwd', ''));
|
||||
}
|
||||
it(
|
||||
fixtureDir,
|
||||
async () => {
|
||||
if (fixtureDir.endsWith('-with-cwd')) {
|
||||
fixturePath = resolve(
|
||||
fixturePath,
|
||||
fixtureDir.replace('-with-cwd', ''),
|
||||
);
|
||||
}
|
||||
|
||||
const dist = resolve(`${fixturePath}/dist`);
|
||||
// clean up
|
||||
await rimraf(dist);
|
||||
await rimraf(resolve(`${fixturePath}/.rts2_cache_cjs`));
|
||||
await rimraf(resolve(`${fixturePath}/.rts2_cache_es`));
|
||||
await rimraf(resolve(`${fixturePath}/.rts2_cache_umd`));
|
||||
const dist = resolve(`${fixturePath}/dist`);
|
||||
// clean up
|
||||
await rimraf(dist);
|
||||
await rimraf(resolve(`${fixturePath}/.rts2_cache_cjs`));
|
||||
await rimraf(resolve(`${fixturePath}/.rts2_cache_es`));
|
||||
await rimraf(resolve(`${fixturePath}/.rts2_cache_umd`));
|
||||
|
||||
const script = await getBuildScript(fixturePath, DEFAULT_SCRIPT);
|
||||
const script = await getBuildScript(fixturePath, DEFAULT_SCRIPT);
|
||||
|
||||
const prevDir = process.cwd();
|
||||
process.chdir(resolve(fixturePath));
|
||||
const prevDir = process.cwd();
|
||||
process.chdir(resolve(fixturePath));
|
||||
|
||||
const parsedOpts = parseScript(script);
|
||||
const parsedOpts = parseScript(script);
|
||||
|
||||
const output = await microbundle({
|
||||
...parsedOpts,
|
||||
cwd: parsedOpts.cwd !== '.' ? parsedOpts.cwd : resolve(fixturePath),
|
||||
});
|
||||
const output = await microbundle({
|
||||
...parsedOpts,
|
||||
cwd: parsedOpts.cwd !== '.' ? parsedOpts.cwd : resolve(fixturePath),
|
||||
});
|
||||
|
||||
process.chdir(prevDir);
|
||||
process.chdir(prevDir);
|
||||
|
||||
const printedDir = printTree([dirTree(fixturePath)]);
|
||||
const printedDir = printTree([dirTree(fixturePath)]);
|
||||
|
||||
expect(
|
||||
[
|
||||
`Used script: ${script}`,
|
||||
'Directory tree:',
|
||||
printedDir,
|
||||
strip(output),
|
||||
].join('\n\n'),
|
||||
).toMatchSnapshot();
|
||||
|
||||
fs.readdirSync(resolve(dist)).forEach(file => {
|
||||
expect(
|
||||
fs.readFileSync(resolve(dist, file)).toString('utf8'),
|
||||
[
|
||||
`Used script: ${script}`,
|
||||
'Directory tree:',
|
||||
printedDir,
|
||||
strip(output),
|
||||
].join('\n\n'),
|
||||
).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
fs.readdirSync(resolve(dist)).forEach(file => {
|
||||
expect(
|
||||
fs.readFileSync(resolve(dist, file)).toString('utf8'),
|
||||
).toMatchSnapshot();
|
||||
});
|
||||
},
|
||||
TEST_TIMEOUT,
|
||||
);
|
||||
});
|
||||
|
||||
it('should keep shebang', () => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user