Skip to content

Commit

Permalink
Increase timeout for slow CI
Browse files Browse the repository at this point in the history
  • Loading branch information
jerivas committed Nov 27, 2023
1 parent 25562de commit 286e7fa
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 27 deletions.
55 changes: 29 additions & 26 deletions js-api-spec/compiler.node.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,39 +81,42 @@ describe('AsyncCompiler', () => {
});

describe('compileAsync', () => {
it('handles multiple concurrent compilations', () =>
sandbox(async dir => {
const logger = getLogger();
const compilations = Array(runs)
.fill(0)
.map((_, i) => {
const filename = `input-${i}.scss`;
dir.write({
[filename]: `@import "${i}"; .fn {value: foo(${i})}`,
it(
'handles multiple concurrent compilations',
() =>
sandbox(async dir => {
const logger = getLogger();
const compilations = Array(runs)
.fill(0)
.map((_, i) => {
const filename = `input-${i}.scss`;
dir.write({
[filename]: `@import "${i}"; .fn {value: foo(${i})}`,
});
return compiler.compileAsync(dir(filename), {
importers: asyncImporters,
functions,
logger,
});
});
return compiler.compileAsync(dir(filename), {
importers: asyncImporters,
functions,
logger,
Array.from(await Promise.all(compilations))
.map((result: CompileResult) => result.css)
.forEach((result, i) => {
expect(result).toEqualIgnoringWhitespace(
`.import {value: ${i};} .fn {value: "${i}";}`
);
});
});
Array.from(await Promise.all(compilations))
.map((result: CompileResult) => result.css)
.forEach((result, i) => {
expect(result).toEqualIgnoringWhitespace(
`.import {value: ${i};} .fn {value: "${i}";}`
);
});
expect(logger.debug).toHaveBeenCalledTimes(runs);
}));
expect(logger.debug).toHaveBeenCalledTimes(runs);
}),
40_000 // Increase timeout for slow CI
);

it('throws after being disposed', async () => {
it('throws after being disposed', () =>
sandbox(async dir => {
dir.write({'input.scss': '$a: b; c {d: $a}'});
await compiler.dispose();
expect(() => compiler.compileAsync(dir('input.scss'))).toThrowError();
});
});
}));

it('waits for compilations to finish before disposing', () =>
sandbox(async dir => {
Expand Down
2 changes: 1 addition & 1 deletion js-api-spec/compiler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ describe('AsyncCompiler', () => {
);
});
expect(logger.debug).toHaveBeenCalledTimes(runs);
});
}, 15_000); // Increase timeout for slow CI

it('throws after being disposed', async () => {
await compiler.dispose();
Expand Down

0 comments on commit 286e7fa

Please sign in to comment.