Skip to content

Commit 61cae32

Browse files
committed
run out-of-memory tests multiple times with logs
1 parent 3d6081c commit 61cae32

1 file changed

Lines changed: 67 additions & 64 deletions

File tree

packages/webpack-plugin/test/e2e/watched-project.spec.ts

Lines changed: 67 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -9,73 +9,76 @@ const project = 'watched-project';
99
const projectDir = dirname(
1010
require.resolve(`@stylable/webpack-plugin/test/e2e/projects/${project}/webpack.config`)
1111
);
12-
13-
describe(`(${project})`, () => {
14-
const projectRunner = StylableProjectRunner.mochaSetup(
15-
{
16-
projectDir,
17-
launchOptions: {
18-
// headless: false
12+
let i = 50;
13+
while (--i > 0) {
14+
describe(`(${project})`, () => {
15+
const projectRunner = StylableProjectRunner.mochaSetup(
16+
{
17+
projectDir,
18+
launchOptions: {
19+
// headless: false
20+
},
21+
watchMode: true,
22+
useTempDir: true,
23+
log: true,
1924
},
20-
watchMode: true,
21-
useTempDir: true,
22-
},
23-
before,
24-
afterEach,
25-
after
26-
);
27-
it('renders css', async () => {
28-
const { page } = await projectRunner.openInBrowser();
29-
const styleElements = await page.evaluate(browserFunctions.getStyleElementsMetadata, {
30-
includeCSSContent: true,
31-
});
25+
before,
26+
afterEach,
27+
after
28+
);
29+
it('renders css', async () => {
30+
const { page } = await projectRunner.openInBrowser();
31+
const styleElements = await page.evaluate(browserFunctions.getStyleElementsMetadata, {
32+
includeCSSContent: true,
33+
});
3234

33-
expect(styleElements[0]).to.include({
34-
id: './src/index.st.css',
35-
depth: '3',
36-
});
35+
expect(styleElements[0]).to.include({
36+
id: './src/index.st.css',
37+
depth: '3',
38+
});
3739

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

42-
await projectRunner.actAndWaitForRecompile(
43-
'invalidate dependency',
44-
() => {
45-
return writeFile(
46-
join(projectRunner.testDir, 'src', 'mixin-b.st.css'),
47-
'.b{ color: green; }'
48-
);
49-
},
50-
async () => {
51-
const { page } = await projectRunner.openInBrowser();
52-
const styleElements = await page.evaluate(
53-
browserFunctions.getStyleElementsMetadata,
54-
{
55-
includeCSSContent: true,
56-
}
57-
);
58-
expect(styleElements[0].css!.replace(/\s\s*/gm, ' ').trim()).to.match(
59-
/\.index\d+__root \{ color: green; font-size: 3em; z-index: 1; \}/
60-
);
61-
}
62-
);
63-
});
44+
await projectRunner.actAndWaitForRecompile(
45+
'invalidate dependency',
46+
() => {
47+
return writeFile(
48+
join(projectRunner.testDir, 'src', 'mixin-b.st.css'),
49+
'.b{ color: green; }'
50+
);
51+
},
52+
async () => {
53+
const { page } = await projectRunner.openInBrowser();
54+
const styleElements = await page.evaluate(
55+
browserFunctions.getStyleElementsMetadata,
56+
{
57+
includeCSSContent: true,
58+
}
59+
);
60+
expect(styleElements[0].css!.replace(/\s\s*/gm, ' ').trim()).to.match(
61+
/\.index\d+__root \{ color: green; font-size: 3em; z-index: 1; \}/
62+
);
63+
}
64+
);
65+
});
6466

65-
it('allow stylable imports with missing files', async () => {
66-
await projectRunner.actAndWaitForRecompile(
67-
'rename files with invalid dependencies',
68-
() => {
69-
return rename(
70-
join(projectRunner.testDir, 'src', 'index.st.css'),
71-
join(projectRunner.testDir, 'src', 'xxx.st.css')
72-
);
73-
},
74-
() => {
75-
// if we got here we finished to recompile with the missing file.
76-
// when this test is broken the compiler had en error and exit the process.
77-
expect('finish recompile');
78-
}
79-
);
67+
it('allow stylable imports with missing files', async () => {
68+
await projectRunner.actAndWaitForRecompile(
69+
'rename files with invalid dependencies',
70+
() => {
71+
return rename(
72+
join(projectRunner.testDir, 'src', 'index.st.css'),
73+
join(projectRunner.testDir, 'src', 'xxx.st.css')
74+
);
75+
},
76+
() => {
77+
// if we got here we finished to recompile with the missing file.
78+
// when this test is broken the compiler had en error and exit the process.
79+
expect('finish recompile');
80+
}
81+
);
82+
});
8083
});
81-
});
84+
}

0 commit comments

Comments
 (0)