From 0559f4f75f26b9216449a3bd465b57a962d3caec Mon Sep 17 00:00:00 2001 From: Simon Lydell Date: Mon, 6 Jul 2026 14:44:19 +0200 Subject: [PATCH 1/2] Configure 10 seconds test timeout for all tests --- .mocharc.json | 3 ++ tests/ci.js | 26 +++++++------- tests/flags.js | 82 +++++++++++++++++++++---------------------- tests/test-quality.js | 2 +- 4 files changed, 58 insertions(+), 55 deletions(-) create mode 100644 .mocharc.json diff --git a/.mocharc.json b/.mocharc.json new file mode 100644 index 00000000..85043886 --- /dev/null +++ b/.mocharc.json @@ -0,0 +1,3 @@ +{ + "timeout": 10000 +} diff --git a/tests/ci.js b/tests/ci.js index 3a16acbe..fab04477 100755 --- a/tests/ci.js +++ b/tests/ci.js @@ -128,7 +128,7 @@ describe('--help', () => { assertTestSuccess(runResult); // ensure we have a non-empty output assert.ok(runResult.stdout.length > 0); - }).timeout(5000); + }); }); describe('--version', () => { @@ -136,7 +136,7 @@ describe('--version', () => { const runResult = execElmTest(['--version']); assertTestSuccess(runResult); assert.strictEqual(elmTestVersion, runResult.stdout.trim()); - }).timeout(5000); + }); }); /* Test examples */ @@ -148,18 +148,18 @@ describe('Testing elm-test on an example application', () => { const args = path.join('tests', '*Pass*.elm'); const runResult = execElmTest([args], cwd); assertTestSuccess(runResult); - }).timeout(60000); + }); it('Should fail for failing tests', () => { const args = path.join('tests', '*Fail*.elm'); const runResult = execElmTest([args], cwd); assertTestFailure(runResult); - }).timeout(60000); + }); it('Should successfully run `elm-test make`', () => { const runResult = execElmTest(['make'], cwd); assertTestSuccess(runResult); - }).timeout(60000); + }); }); describe('Testing elm-test on an example package', () => { @@ -169,18 +169,18 @@ describe('Testing elm-test on an example package', () => { const args = path.join('tests', '*Pass*.elm'); const runResult = execElmTest([args], cwd); assertTestSuccess(runResult); - }).timeout(60000); + }); it('Should fail for failing tests', () => { const args = path.join('tests', '*Fail*.elm'); const runResult = execElmTest([args], cwd); assertTestFailure(runResult); - }).timeout(60000); + }); it('Should successfully run `elm-test make`', () => { const runResult = execElmTest(['make'], cwd); assertTestSuccess(runResult); - }).timeout(60000); + }); }); describe('Testing elm-test on example-application-src', () => { @@ -189,7 +189,7 @@ describe('Testing elm-test on example-application-src', () => { it('Should pass successfully', () => { const runResult = execElmTest(['src'], cwd); assertTestSuccess(runResult); - }).timeout(60000); + }); }); describe('Testing elm-test on an application with no tests', () => { @@ -198,7 +198,7 @@ describe('Testing elm-test on an application with no tests', () => { it('Should fail due to missing tests', () => { const runResult = execElmTest([], cwd); assertTestFailure(runResult); - }).timeout(60000); + }); }); /* ci tests on single elm files */ @@ -220,7 +220,7 @@ describe('Testing elm-test on single Elm files', () => { const itsPath = path.join('tests', 'Passing', testToRun); const runResult = execElmTest([itsPath], cwd); assertTestSuccess(runResult); - }).timeout(10000); + }); } it(`Should run every file in tests/Passing`, () => { @@ -245,7 +245,7 @@ describe('Testing elm-test on single Elm files', () => { const itsPath = path.join('tests', 'Failing', testToRun); const runResult = execElmTest([itsPath], cwd); assertTestFailure(runResult); - }).timeout(10000); + }); } it(`Should run every file in tests/Failing`, () => { @@ -261,7 +261,7 @@ describe('Testing elm-test on single Elm files', () => { const itsPath = path.join('tests', 'RuntimeException', testToRun); const runResult = execElmTest([itsPath], cwd); assertTestErrored(runResult); - }).timeout(10000); + }); } it(`Should run every file in tests/RuntimeException`, () => { diff --git a/tests/flags.js b/tests/flags.js index 4687cc35..9b49751c 100644 --- a/tests/flags.js +++ b/tests/flags.js @@ -76,7 +76,7 @@ describe('flags', () => { const runResult = execElmTest(['init', 'frontend/elm']); assert.ok(Number.isInteger(runResult.status)); assert.notStrictEqual(runResult.status, 0); - }).timeout(60000); + }); describe('for a PACKAGE', () => { it('Adds elm-explorations/test', (done) => { @@ -102,7 +102,7 @@ describe('flags', () => { done(); }); - }).timeout(60000); + }); }); describe('for an APPLICATION', () => { @@ -133,7 +133,7 @@ describe('flags', () => { done(); }); - }).timeout(60000); + }); }); }); @@ -146,19 +146,19 @@ describe('flags', () => { const runResult = execElmTest(['install']); assert.ok(Number.isInteger(runResult.status)); assert.notStrictEqual(runResult.status, 0); - }).timeout(60000); + }); it('should fail if given extra arguments', () => { const runResult = execElmTest(['install', 'elm/regex', 'elm/time']); assert.ok(Number.isInteger(runResult.status)); assert.notStrictEqual(runResult.status, 0); - }).timeout(60000); + }); it('should fail if no elm.json can be found', () => { const runResult = execElmTest(['install', 'elm/regex'], rootDir); assert.ok(Number.isInteger(runResult.status)); assert.notStrictEqual(runResult.status, 0); - }).timeout(60000); + }); it('should not allow command injection', () => { fs.copyFileSync( @@ -175,19 +175,19 @@ describe('flags', () => { ); assert(!runResult.stdout.includes('FINDME')); assert(!runResult.stderr.includes('FINDMETWICE')); - }).timeout(60000); + }); it('should exit with success if package already installed', () => { const runResult = execElmTest(['install', 'elm-explorations/test']); assert.strictEqual(runResult.status, 0); - }).timeout(60000); + }); }); describe('elm-test make', () => { it('should exit with success for valid Elm code', () => { const runResult = execElmTest(['make', 'tests/Passing/One.elm']); assert.strictEqual(runResult.status, 0); - }).timeout(60000); + }); it('should exit with non-success for invalid Elm code', () => { const runResult = execElmTest([ @@ -196,7 +196,7 @@ describe('flags', () => { ]); assert.ok(Number.isInteger(runResult.status)); assert.notStrictEqual(runResult.status, 0); - }).timeout(60000); + }); describe('--output', () => { it('should ignore --output flag when set to /dev/null', () => { @@ -207,7 +207,7 @@ describe('flags', () => { ]); assert.strictEqual(runResult.status, 0); - }).timeout(60000); + }); it('should fail if setting --output to anything other than /dev/null', () => { const runResult = execElmTest([ @@ -218,7 +218,7 @@ describe('flags', () => { assert.ok(Number.isInteger(runResult.status)); assert.notStrictEqual(runResult.status, 0); - }).timeout(60000); + }); }); }); @@ -228,12 +228,12 @@ describe('flags', () => { // Checking against a fixture is brittle here // For now, check that the output is non-empty. assert.ok(runResult.stdout.length > 0); - }).timeout(60000); + }); it('Should exit indicating success (see #359)', () => { const runResult = execElmTest(['--help']); assert.strictEqual(0, runResult.status); - }).timeout(60000); + }); }); describe('--report', () => { @@ -246,7 +246,7 @@ describe('flags', () => { assert.ok(Number.isInteger(runResult.status)); assert.notStrictEqual(runResult.status, 0); - }).timeout(5000); + }); it('Should be able to report json lines', () => { const runResult = execElmTest([ @@ -266,7 +266,7 @@ describe('flags', () => { }); assert.ok(linesReceived > 0); - }).timeout(60000); + }); it('Should be able to report passing junit xml', (done) => { const runResult = execElmTest([ @@ -280,7 +280,7 @@ describe('flags', () => { assert.ok(data); done(); }); - }).timeout(60000); + }); it('Should be able to report compilation errors', () => { const runResult = execElmTest([ @@ -289,7 +289,7 @@ describe('flags', () => { ]); assert.ok(runResult.stderr.match(/ENDLESS COMMENT/)); - }).timeout(60000); + }); it('Should be able to report failing junit xml', (done) => { const runResult = execElmTest([ @@ -303,7 +303,7 @@ describe('flags', () => { assert.ok(data); done(); }); - }).timeout(60000); + }); }); describe('--seed', () => { @@ -316,7 +316,7 @@ describe('flags', () => { assert.ok(Number.isInteger(runResult.status)); assert.notStrictEqual(runResult.status, 0); - }).timeout(5000); + }); it('Should fail if given a negative integer', () => { const runResult = execElmTest([ @@ -327,7 +327,7 @@ describe('flags', () => { assert.ok(Number.isInteger(runResult.status)); assert.notStrictEqual(runResult.status, 0); - }).timeout(5000); + }); it('Should use and, thus, show the proper seed in the JSON report', () => { const runResult = execElmTest([ @@ -338,7 +338,7 @@ describe('flags', () => { const firstOutput = JSON.parse(runResult.stdout.split('\n')[0]); assert.strictEqual('12345', firstOutput.initialSeed); - }).timeout(60000); + }); it('Should allow 0', () => { const runResult = execElmTest([ @@ -349,7 +349,7 @@ describe('flags', () => { const firstOutput = JSON.parse(runResult.stdout.split('\n')[0]); assert.strictEqual('0', firstOutput.initialSeed); - }).timeout(60000); + }); }); describe('--fuzz', () => { @@ -362,7 +362,7 @@ describe('flags', () => { assert.ok(Number.isInteger(runResult.status)); assert.notStrictEqual(runResult.status, 0); - }).timeout(5000); + }); it('Should fail if given 0', () => { const runResult = execElmTest([ @@ -373,7 +373,7 @@ describe('flags', () => { assert.ok(Number.isInteger(runResult.status)); assert.notStrictEqual(runResult.status, 0); - }).timeout(5000); + }); it('Should fail if given a negative integer', () => { const runResult = execElmTest([ @@ -384,7 +384,7 @@ describe('flags', () => { assert.ok(Number.isInteger(runResult.status)); assert.notStrictEqual(runResult.status, 0); - }).timeout(5000); + }); it('Should default to 100', () => { const runResult = execElmTest([ @@ -394,7 +394,7 @@ describe('flags', () => { const firstOutput = JSON.parse(runResult.stdout.split('\n')[0]); assert.strictEqual('100', firstOutput.fuzzRuns); - }).timeout(60000); + }); it('Should use the provided value', () => { const runResult = execElmTest([ @@ -405,7 +405,7 @@ describe('flags', () => { const firstOutput = JSON.parse(runResult.stdout.split('\n')[0]); assert.strictEqual('5', firstOutput.fuzzRuns); - }).timeout(60000); + }); }); describe('--compiler', () => { @@ -426,7 +426,7 @@ describe('flags', () => { assert.ok(Number.isInteger(runResult.status)); assert.notStrictEqual(runResult.status, 0); - }).timeout(5000); + }); it("Should fail if the given compiler can't be executed", () => { const runResult = execElmTest([ @@ -436,7 +436,7 @@ describe('flags', () => { assert.ok(Number.isInteger(runResult.status)); assert.notStrictEqual(runResult.status, 0); - }).timeout(5000); + }); it('Should work with different elm on PATH', () => { const runResult = execElmTest([ @@ -445,7 +445,7 @@ describe('flags', () => { ]); assert.strictEqual(runResult.status, 0); - }).timeout(5000); + }); it('Should work with local different elm', () => { const runResult = execElmTest([ @@ -454,7 +454,7 @@ describe('flags', () => { ]); assert.strictEqual(runResult.status, 0); - }).timeout(5000); + }); }); describe('--watch', () => { @@ -466,7 +466,7 @@ describe('flags', () => { assert.ok(Number.isInteger(runResult.status)); assert.notStrictEqual(runResult.status, 0); - }).timeout(5000); + }); it('Should re-run tests when files are changed, added and removed', (done) => { const addedFile = path.join( @@ -543,7 +543,7 @@ describe('flags', () => { done(e); } }); - }).timeout(60000); + }); it('Should re-run tests after install', (done) => { ensureEmptyDir(scratchDir); @@ -626,7 +626,7 @@ describe('flags', () => { } }); }); - }).timeout(60000); + }); }); describe('color', () => { @@ -684,7 +684,7 @@ describe('flags', () => { shouldHaveColor('Env var overrides flag (to color)', ['--no-color'], { FORCE_COLOR: '1', }); - }).timeout(60000); + }); }); describe('mixed', () => { @@ -694,7 +694,7 @@ describe('flags', () => { path.join(fixturesDir, 'tests', 'Passing') ); assert.strictEqual(runResult.status, 0); - }).timeout(60000); + }); it('Should deduplicate test files', () => { // This is nice if two globs accidentally intersect. @@ -703,12 +703,12 @@ describe('flags', () => { 'tests/**/!(Failing)/**/One.elm', ]); assert.strictEqual(runResult.status, 0); - }).timeout(60000); + }); it('Should find all Elm files inside the directory that a glob resolves to', () => { const runResult = execElmTest(['tests/Pass*']); assert.strictEqual(runResult.status, 0); - }).timeout(60000); + }); }); describe('unknown flags', () => { @@ -720,7 +720,7 @@ describe('flags', () => { assert.ok(Number.isInteger(runResult.status)); assert.notStrictEqual(runResult.status, 0); - }).timeout(5000); + }); it('Should fail on unknown long flag', () => { const runResult = execElmTest([ @@ -730,6 +730,6 @@ describe('flags', () => { assert.ok(Number.isInteger(runResult.status)); assert.notStrictEqual(runResult.status, 0); - }).timeout(5000); + }); }); }); diff --git a/tests/test-quality.js b/tests/test-quality.js index d56eb2e2..0dd5555d 100644 --- a/tests/test-quality.js +++ b/tests/test-quality.js @@ -33,7 +33,7 @@ describe('examples quality', () => { if (require(path.join(example, 'elm.json')).type === 'package') { assert.strictEqual(execElm(['make'], example).status, 0); } - }).timeout(5000); + }); } }); }); From 57b273152d8dde20bedbad451f0fd6c46330bef0 Mon Sep 17 00:00:00 2001 From: Simon Lydell Date: Mon, 6 Jul 2026 14:51:17 +0200 Subject: [PATCH 2/2] Try 20 seconds --- .mocharc.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.mocharc.json b/.mocharc.json index 85043886..4c90ae61 100644 --- a/.mocharc.json +++ b/.mocharc.json @@ -1,3 +1,3 @@ { - "timeout": 10000 + "timeout": 20000 }