Skip to content

Commit

Permalink
run out-of-memory tests multiple times with logs
Browse files Browse the repository at this point in the history
  • Loading branch information
idoros committed Aug 7, 2022
1 parent e89475d commit 41f72d9
Showing 1 changed file with 67 additions and 64 deletions.
131 changes: 67 additions & 64 deletions packages/webpack-plugin/test/e2e/watched-project.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,73 +9,76 @@ const project = 'watched-project';
const projectDir = dirname(
require.resolve(`@stylable/webpack-plugin/test/e2e/projects/${project}/webpack.config`)
);

describe(`(${project})`, () => {
const projectRunner = StylableProjectRunner.mochaSetup(
{
projectDir,
launchOptions: {
// headless: false
let i = 50;
while (--i > 0) {
describe(`(${project})`, () => {
const projectRunner = StylableProjectRunner.mochaSetup(
{
projectDir,
launchOptions: {
// headless: false
},
watchMode: true,
useTempDir: true,
log: true,
},
watchMode: true,
useTempDir: true,
},
before,
afterEach,
after
);
it('renders css', async () => {
const { page } = await projectRunner.openInBrowser();
const styleElements = await page.evaluate(browserFunctions.getStyleElementsMetadata, {
includeCSSContent: true,
});
before,
afterEach,
after
);
it('renders css', async () => {
const { page } = await projectRunner.openInBrowser();
const styleElements = await page.evaluate(browserFunctions.getStyleElementsMetadata, {
includeCSSContent: true,
});

expect(styleElements[0]).to.include({
id: './src/index.st.css',
depth: '3',
});
expect(styleElements[0]).to.include({
id: './src/index.st.css',
depth: '3',
});

expect(styleElements[0].css!.replace(/\s\s*/gm, ' ').trim()).to.match(
/\.index\d+__root \{ color: red; font-size: 3em; z-index: 1; \}/
);
expect(styleElements[0].css!.replace(/\s\s*/gm, ' ').trim()).to.match(
/\.index\d+__root \{ color: red; font-size: 3em; z-index: 1; \}/
);

await projectRunner.actAndWaitForRecompile(
'invalidate dependency',
() => {
return writeFile(
join(projectRunner.testDir, 'src', 'mixin-b.st.css'),
'.b{ color: green; }'
);
},
async () => {
const { page } = await projectRunner.openInBrowser();
const styleElements = await page.evaluate(
browserFunctions.getStyleElementsMetadata,
{
includeCSSContent: true,
}
);
expect(styleElements[0].css!.replace(/\s\s*/gm, ' ').trim()).to.match(
/\.index\d+__root \{ color: green; font-size: 3em; z-index: 1; \}/
);
}
);
});
await projectRunner.actAndWaitForRecompile(
'invalidate dependency',
() => {
return writeFile(
join(projectRunner.testDir, 'src', 'mixin-b.st.css'),
'.b{ color: green; }'
);
},
async () => {
const { page } = await projectRunner.openInBrowser();
const styleElements = await page.evaluate(
browserFunctions.getStyleElementsMetadata,
{
includeCSSContent: true,
}
);
expect(styleElements[0].css!.replace(/\s\s*/gm, ' ').trim()).to.match(
/\.index\d+__root \{ color: green; font-size: 3em; z-index: 1; \}/
);
}
);
});

it('allow stylable imports with missing files', async () => {
await projectRunner.actAndWaitForRecompile(
'rename files with invalid dependencies',
() => {
return rename(
join(projectRunner.testDir, 'src', 'index.st.css'),
join(projectRunner.testDir, 'src', 'xxx.st.css')
);
},
() => {
// if we got here we finished to recompile with the missing file.
// when this test is broken the compiler had en error and exit the process.
expect('finish recompile');
}
);
it('allow stylable imports with missing files', async () => {
await projectRunner.actAndWaitForRecompile(
'rename files with invalid dependencies',
() => {
return rename(
join(projectRunner.testDir, 'src', 'index.st.css'),
join(projectRunner.testDir, 'src', 'xxx.st.css')
);
},
() => {
// if we got here we finished to recompile with the missing file.
// when this test is broken the compiler had en error and exit the process.
expect('finish recompile');
}
);
});
});
});
}

0 comments on commit 41f72d9

Please sign in to comment.