improve treeshaking test

This commit is contained in:
Rene Haas
2022-10-30 21:03:52 +01:00
parent ec5a549202
commit ed7777462a
2 changed files with 6 additions and 5 deletions
+2 -1
View File
@@ -1,8 +1,9 @@
# Compiled output
/dist
# Playwright output
# Tests generated output
.build/
.fixtures/
# Node
/node_modules
@@ -10,14 +10,14 @@ import rollupConfig from '~/../rollup.config';
const cleanBundle = true;
const cleanFixture = true;
const expectedBundleDiff = 2300;
const expectedBundleDiff = 2400;
const normalizePath = (pathName: string) =>
pathName ? pathName.split(path.sep).join(path.posix.sep) : pathName;
const fixturesDir = path.join(__dirname, '.treeshakingFixtures');
const fixturesDir = path.join(__dirname, '.fixtures');
const libraryFixturePath = normalizePath(path.join(fixturesDir, 'lib.js'));
const normalFixturePath = normalizePath(path.join(fixturesDir, 'nromal.js'));
const normalFixturePath = normalizePath(path.join(fixturesDir, 'normal.js'));
const treeshakedFixturePath = normalizePath(path.join(fixturesDir, 'treeshaked.js'));
const unshakedFixtureContent = `
@@ -88,7 +88,7 @@ const bundleFunctions = {
const testBundler = (bundlerName: string) => async () => {
const bundleFunction = bundleFunctions[bundlerName];
const outputDir = path.join(__dirname, `.${bundlerName}`);
const outputDir = path.join(fixturesDir, `.${bundlerName}`);
const normal = await bundleFunction(
normalFixturePath,
path.join(outputDir, path.basename(normalFixturePath))