From 286e7fafd73d3428b8e51d85beb10a097d1bed18 Mon Sep 17 00:00:00 2001 From: Ed Rivas Date: Mon, 27 Nov 2023 21:38:30 +0000 Subject: [PATCH] Increase timeout for slow CI --- js-api-spec/compiler.node.test.ts | 55 ++++++++++++++++--------------- js-api-spec/compiler.test.ts | 2 +- 2 files changed, 30 insertions(+), 27 deletions(-) diff --git a/js-api-spec/compiler.node.test.ts b/js-api-spec/compiler.node.test.ts index a54d20a70..f41284502 100644 --- a/js-api-spec/compiler.node.test.ts +++ b/js-api-spec/compiler.node.test.ts @@ -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 => { diff --git a/js-api-spec/compiler.test.ts b/js-api-spec/compiler.test.ts index 9aad39fd4..b80145400 100644 --- a/js-api-spec/compiler.test.ts +++ b/js-api-spec/compiler.test.ts @@ -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();