From fba63784e9485cd8da8b85e2357c2fb052fe83cf Mon Sep 17 00:00:00 2001 From: ShaMan123 Date: Thu, 25 Aug 2022 17:05:50 +0300 Subject: [PATCH 01/22] fix(): propagate failed exit code to the process closes #8186 tests were failing because the process didn't receive the exit code --- scripts/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/index.js b/scripts/index.js index 65cc5b34418..0136d99306e 100644 --- a/scripts/index.js +++ b/scripts/index.js @@ -282,7 +282,12 @@ async function test(suite, tests, options = {}) { shell: true, stdio: 'inherit', detached: options.dev - }); + }) + .on('exit', (code) => { + // propagate failed exit code to the process for ci to fail + // don't exit if tests passed - this is for parallel local testing + code && process.exit(code); + }); if (options.launch) { // open localhost From 8572cae933e15162ad1e761223cd6afee2d5218c Mon Sep 17 00:00:00 2001 From: ShaMan123 Date: Thu, 25 Aug 2022 18:20:30 +0300 Subject: [PATCH 02/22] Update index.js --- scripts/index.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/scripts/index.js b/scripts/index.js index 0136d99306e..08f947a88d7 100644 --- a/scripts/index.js +++ b/scripts/index.js @@ -267,7 +267,14 @@ async function test(suite, tests, options = {}) { '-l', options.context.map(_.upperFirst).join(',') ]; - cp.spawn(args.join(' '), { + if (options.launch) { + // open localhost + const url = `http://localhost:${port}/`; + const start = (os.platform() === 'darwin' ? 'open' : os.platform() === 'win32' ? 'start' : 'xdg-open'); + cp.exec([start, url].join(' ')); + } + + cp[options.dev ? 'spawn' : 'execSync'](args.join(' '), { cwd: wd, env: { ...process.env, @@ -289,12 +296,7 @@ async function test(suite, tests, options = {}) { code && process.exit(code); }); - if (options.launch) { - // open localhost - const url = `http://localhost:${port}/`; - const start = (os.platform() === 'darwin' ? 'open' : os.platform() === 'win32' ? 'start' : 'xdg-open'); - cp.exec([start, url].join(' ')); - } + } /** From 19753666352cd2dcaec60b1948654aa96f8ee8af Mon Sep 17 00:00:00 2001 From: ShaMan123 Date: Thu, 25 Aug 2022 18:21:43 +0300 Subject: [PATCH 03/22] Update index.js --- scripts/index.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/scripts/index.js b/scripts/index.js index 08f947a88d7..5db92cd81e0 100644 --- a/scripts/index.js +++ b/scripts/index.js @@ -289,14 +289,7 @@ async function test(suite, tests, options = {}) { shell: true, stdio: 'inherit', detached: options.dev - }) - .on('exit', (code) => { - // propagate failed exit code to the process for ci to fail - // don't exit if tests passed - this is for parallel local testing - code && process.exit(code); - }); - - + }); } /** From e4c899a5bdbf3abdc3ee8d3d51a7fca00a540fb8 Mon Sep 17 00:00:00 2001 From: ShaMan123 Date: Thu, 25 Aug 2022 20:34:58 +0300 Subject: [PATCH 04/22] build --- scripts/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/index.js b/scripts/index.js index 5db92cd81e0..5908ed449a6 100644 --- a/scripts/index.js +++ b/scripts/index.js @@ -127,7 +127,8 @@ function build(options = {}) { const { name, base, ...rest } = path.parse(path.resolve(options.output)); minDest = path.format({ name: `${name}.min`, ...rest }); } - return cp.spawn(args.join(' '), { + // use `execSync` so exit codes are propagated to the process and reported to ci + cp[options.watch ? 'spawn' : 'execSync'](args.join(' '), { stdio: 'inherit', shell: true, cwd: wd, @@ -274,6 +275,7 @@ async function test(suite, tests, options = {}) { cp.exec([start, url].join(' ')); } + // use `execSync` so exit codes are propagated to the process and reported to ci cp[options.dev ? 'spawn' : 'execSync'](args.join(' '), { cwd: wd, env: { From fd2ced16ffe34c13e94389351ddff08fef2b40a6 Mon Sep 17 00:00:00 2001 From: ShaMan123 Date: Thu, 25 Aug 2022 20:43:27 +0300 Subject: [PATCH 05/22] refactor --- scripts/index.js | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/scripts/index.js b/scripts/index.js index 5908ed449a6..4ad2917b314 100644 --- a/scripts/index.js +++ b/scripts/index.js @@ -260,14 +260,6 @@ async function test(suite, tests, options = {}) { } - const args = [ - 'testem', - !options.dev ? 'ci' : '', - '-p', port, - '-f', `test/testem.${suite}.js`, - '-l', options.context.map(_.upperFirst).join(',') - ]; - if (options.launch) { // open localhost const url = `http://localhost:${port}/`; @@ -275,8 +267,13 @@ async function test(suite, tests, options = {}) { cp.exec([start, url].join(' ')); } - // use `execSync` so exit codes are propagated to the process and reported to ci - cp[options.dev ? 'spawn' : 'execSync'](args.join(' '), { + const processCmdOptions = [ + '-p', port, + '-f', `test/testem.${suite}.js`, + '-l', options.context.map(_.upperFirst).join(',') + ]; + + const processOptions = { cwd: wd, env: { ...process.env, @@ -290,8 +287,23 @@ async function test(suite, tests, options = {}) { }, shell: true, stdio: 'inherit', - detached: options.dev - }); + } + + if (options.dev) { + cp.spawn(['testem', ...processCmdOptions].join(' '), { + ...processOptions, + detached: true + }); + } + else { + try { + cp.execSync(['testem', 'ci', ...processCmdOptions].join(' '), processOptions); + } catch (error) { + console.error(error.message); + // inform ci + process.exit(1); + } + } } /** From 7e07ed7a35766635f7fea12d872803f8a2cdda53 Mon Sep 17 00:00:00 2001 From: ShaMan123 Date: Thu, 25 Aug 2022 20:45:11 +0300 Subject: [PATCH 06/22] Update index.js --- scripts/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/index.js b/scripts/index.js index 4ad2917b314..6f9ec282624 100644 --- a/scripts/index.js +++ b/scripts/index.js @@ -299,6 +299,7 @@ async function test(suite, tests, options = {}) { try { cp.execSync(['testem', 'ci', ...processCmdOptions].join(' '), processOptions); } catch (error) { + // minimal logging, no need for stack trace console.error(error.message); // inform ci process.exit(1); From e0ab5eb10703e1646e2535fa09bf4b68d7779f52 Mon Sep 17 00:00:00 2001 From: ShaMan123 Date: Thu, 25 Aug 2022 21:06:35 +0300 Subject: [PATCH 07/22] Update index.js --- scripts/index.js | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/scripts/index.js b/scripts/index.js index 6f9ec282624..7cde6678284 100644 --- a/scripts/index.js +++ b/scripts/index.js @@ -121,14 +121,13 @@ inquirer.registerPrompt('test-selection', ICheckbox); function build(options = {}) { - const args = ['rollup', '-c', options.watch ? '--watch' : '']; + const cmd = ['rollup', '-c', options.watch ? '--watch' : ''].join(' '); let minDest; if (options.output && !options.fast) { const { name, base, ...rest } = path.parse(path.resolve(options.output)); minDest = path.format({ name: `${name}.min`, ...rest }); } - // use `execSync` so exit codes are propagated to the process and reported to ci - cp[options.watch ? 'spawn' : 'execSync'](args.join(' '), { + const processOptions = { stdio: 'inherit', shell: true, cwd: wd, @@ -139,7 +138,21 @@ function build(options = {}) { BUILD_OUTPUT: options.output, BUILD_MIN_OUTPUT: minDest }, - }); + } + if (options.watch) { + cp.spawn(cmd, processOptions); + } + else { + try { + cp.execSync(cmd, processOptions); + } catch (error) { + // minimal logging, no need for stack trace + console.error(error.message); + // inform ci + process.exit(1); + } + } + } function startWebsite() { From dcba81630a6764d9b84083013674f28cbc431b58 Mon Sep 17 00:00:00 2001 From: ShaMan123 Date: Thu, 25 Aug 2022 21:19:48 +0300 Subject: [PATCH 08/22] Revert "commit build error" This reverts commit d9d1f498be9bd8e3358e3938a9d702a8c8b2f500. --- scripts/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/index.js b/scripts/index.js index 7cde6678284..7671abbf30f 100644 --- a/scripts/index.js +++ b/scripts/index.js @@ -3,6 +3,10 @@ const fs = require('fs-extra'); const os = require('os'); const _ = require('lodash'); const path = require('path'); +/** + * **IMPORTANT** + * use with caution, ci depends on the process' exit code to determine failure + */ const cp = require('child_process'); const inquirer = require('inquirer'); const fuzzy = require('fuzzy'); From 78edbc4f2694c74e806191d63297b62918b93938 Mon Sep 17 00:00:00 2001 From: ShaMan123 Date: Thu, 25 Aug 2022 22:15:33 +0300 Subject: [PATCH 09/22] better comment --- scripts/index.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/scripts/index.js b/scripts/index.js index 7671abbf30f..c31ed53d265 100644 --- a/scripts/index.js +++ b/scripts/index.js @@ -1,12 +1,22 @@ #!/usr/bin/env node + +/** + * Dearest fabric maintainer, + * This file contains the cli logic, which governs most of the available commands fabric has to offer. + * + * **IMPORTANT** + * CI uses these commands. + * In order for CI to correctly report the result of the command, the process must receive a correct exit code + * meaning that if you `spawn` a process makes sure to listen to the `exit` event and terminate the main process with the relevant code. + * Failing to do so will make CI report a false positive. + */ + + + const fs = require('fs-extra'); const os = require('os'); const _ = require('lodash'); const path = require('path'); -/** - * **IMPORTANT** - * use with caution, ci depends on the process' exit code to determine failure - */ const cp = require('child_process'); const inquirer = require('inquirer'); const fuzzy = require('fuzzy'); From c774732e0de4b77f469b30a00b6b250b3d442d86 Mon Sep 17 00:00:00 2001 From: ShaMan123 Date: Thu, 25 Aug 2022 22:21:32 +0300 Subject: [PATCH 10/22] catch the eye --- scripts/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/index.js b/scripts/index.js index c31ed53d265..d94a9395dc3 100644 --- a/scripts/index.js +++ b/scripts/index.js @@ -1,14 +1,14 @@ #!/usr/bin/env node /** - * Dearest fabric maintainer, + * Dearest fabric maintainer 💗, * This file contains the cli logic, which governs most of the available commands fabric has to offer. * - * **IMPORTANT** + * 📢 **IMPORTANT** * CI uses these commands. * In order for CI to correctly report the result of the command, the process must receive a correct exit code * meaning that if you `spawn` a process makes sure to listen to the `exit` event and terminate the main process with the relevant code. - * Failing to do so will make CI report a false positive. + * Failing to do so will make CI report a false positive 📉. */ From 1eef7e20fa4a8593e22f8c99e3214dc3f42a4d12 Mon Sep 17 00:00:00 2001 From: ShaMan123 Date: Thu, 25 Aug 2022 22:22:08 +0300 Subject: [PATCH 11/22] Update index.js --- scripts/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/index.js b/scripts/index.js index d94a9395dc3..62cba3b1981 100644 --- a/scripts/index.js +++ b/scripts/index.js @@ -7,7 +7,7 @@ * 📢 **IMPORTANT** * CI uses these commands. * In order for CI to correctly report the result of the command, the process must receive a correct exit code - * meaning that if you `spawn` a process makes sure to listen to the `exit` event and terminate the main process with the relevant code. + * meaning that if you `spawn` a process, make sure to listen to the `exit` event and terminate the main process with the relevant code. * Failing to do so will make CI report a false positive 📉. */ From 174fdbe6bbdc8eca56203c5f38f85ff11c3a7eee Mon Sep 17 00:00:00 2001 From: ShaMan123 Date: Sat, 27 Aug 2022 14:09:51 +0300 Subject: [PATCH 12/22] revert node testing to qunit cmd --- scripts/index.js | 92 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 61 insertions(+), 31 deletions(-) diff --git a/scripts/index.js b/scripts/index.js index 62cba3b1981..56651925801 100644 --- a/scripts/index.js +++ b/scripts/index.js @@ -272,22 +272,19 @@ function exportToWebsite(options) { }) } - /** - * - * @param {'unit' | 'visual'} suite - * @param {string[] | null} tests file paths - * @param {{debug?:boolean,recreate?:boolean,verbose?:boolean,filter?:string}} [options] + * + * @returns {Promise} true if some tests failed */ -async function test(suite, tests, options = {}) { - const port = options.port || suite === 'visual' ? 8081 : 8080; +async function runTestem({ suite, port, launch, dev, processOptions, context } = {}) { + port = port || suite === 'visual' ? 8081 : 8080; try { await killPort(port); } catch (error) { } - if (options.launch) { + if (launch) { // open localhost const url = `http://localhost:${port}/`; const start = (os.platform() === 'darwin' ? 'open' : os.platform() === 'win32' ? 'start' : 'xdg-open'); @@ -297,9 +294,32 @@ async function test(suite, tests, options = {}) { const processCmdOptions = [ '-p', port, '-f', `test/testem.${suite}.js`, - '-l', options.context.map(_.upperFirst).join(',') + '-l', context.map(_.upperFirst).join(',') ]; + if (dev) { + cp.spawn(['testem', ...processCmdOptions].join(' '), { + ...processOptions, + detached: true + }); + } + else { + try { + cp.execSync(['testem', 'ci', ...processCmdOptions].join(' '), processOptions); + } catch (error) { + return true; + } + } +} + +/** + * + * @param {'unit' | 'visual'} suite + * @param {string[] | null} tests file paths + * @param {{debug?:boolean,recreate?:boolean,verbose?:boolean,filter?:string}} [options] + * @returns {Promise} true if some tests failed + */ +async function test(suite, tests, options = {}) { const processOptions = { cwd: wd, env: { @@ -316,22 +336,29 @@ async function test(suite, tests, options = {}) { stdio: 'inherit', } - if (options.dev) { - cp.spawn(['testem', ...processCmdOptions].join(' '), { - ...processOptions, - detached: true - }); - } - else { + let failed = false; + + // temporary revert + // run node tests directly with qunit + if (options.context.includes('node')) { try { - cp.execSync(['testem', 'ci', ...processCmdOptions].join(' '), processOptions); + cp.execSync(processOptions.env.NODE_CMD, processOptions); } catch (error) { - // minimal logging, no need for stack trace - console.error(error.message); - // inform ci - process.exit(1); + failed = true; } } + + const browserContexts = options.context.filter(c => c !== 'node'); + if (browserContexts.length > 0) { + failed = await runTestem({ + ...options, + suite, + processOptions, + context: browserContexts + }) || failed; + } + + return failed; } /** @@ -447,15 +474,14 @@ async function runIntreactiveTestSuite(options) { } return acc; }, { unit: [], visual: [] }); - _.reduce(tests, async (queue, files, suite) => { - await queue; + return Promise.all(_.map(tests, (files, suite) => { if (files === true) { return test(suite, null, options); } else if (Array.isArray(files) && files.length > 0) { return test(suite, files, options); } - }, Promise.resolve()); + })); } program @@ -507,28 +533,32 @@ program .option('-v, --verbose', 'log passing tests', false) .option('-l, --launch', 'launch tests in the browser', false) .option('--dev', 'runs testem in `dev` mode, without a `ci` flag', false) - .addOption(new commander.Option('-c, --context ', 'context to test in').choices(['chrome', 'firefox', 'node']).default(['chrome', 'node'])) + .addOption(new commander.Option('-c, --context ', 'context to test in').choices(['chrome', 'firefox', 'node']).default(['node'])) .option('-p, --port') .option('-o, --out ', 'path to report test results to') .option('--clear-cache', 'clear CLI test cache', false) - .action((options) => { + .action(async (options) => { if (options.clearCache) { fs.removeSync(CLI_CACHE); } if (options.all) { options.suite = ['unit', 'visual']; } + const results = []; if (options.suite) { - _.reduce(options.suite, async (queue, suite) => { - await queue; + results.push(...await Promise.all(_.map(options.suite, (suite) => { return test(suite, null, options); - }, Promise.resolve()); + }))); } else if (options.file) { - test(options.file.startsWith('visual') ? 'visual' : 'unit', [`test/${options.file}`], options); + results.push(await test(options.file.startsWith('visual') ? 'visual' : 'unit', [`test/${options.file}`], options)); } else { - runIntreactiveTestSuite(options); + results.push(...await runIntreactiveTestSuite(options)); + } + if (_.some(results)) { + // inform ci that tests have failed + process.exit(1); } }); From 7ff48cdc507d4237a29d9cc3fad3ff42a066933b Mon Sep 17 00:00:00 2001 From: ShaMan123 Date: Sat, 27 Aug 2022 14:22:16 +0300 Subject: [PATCH 13/22] Update index.js --- scripts/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/index.js b/scripts/index.js index 56651925801..d2596776e5e 100644 --- a/scripts/index.js +++ b/scripts/index.js @@ -533,7 +533,7 @@ program .option('-v, --verbose', 'log passing tests', false) .option('-l, --launch', 'launch tests in the browser', false) .option('--dev', 'runs testem in `dev` mode, without a `ci` flag', false) - .addOption(new commander.Option('-c, --context ', 'context to test in').choices(['chrome', 'firefox', 'node']).default(['node'])) + .addOption(new commander.Option('-c, --context ', 'context to test in').choices(['node', 'chrome', 'firefox']).default(['node'])) .option('-p, --port') .option('-o, --out ', 'path to report test results to') .option('--clear-cache', 'clear CLI test cache', false) From 80a778a958b53db9141c8b851662c167cfffa122 Mon Sep 17 00:00:00 2001 From: ShaMan123 Date: Sat, 27 Aug 2022 14:51:09 +0300 Subject: [PATCH 14/22] remove cmds --- package.json | 4 ---- 1 file changed, 4 deletions(-) diff --git a/package.json b/package.json index 7569690e816..fac91e3459e 100644 --- a/package.json +++ b/package.json @@ -60,10 +60,6 @@ "export": "node ./scripts website export", "build-tests": "rollup -c ./rollup.test.config.js", "test": "node ./scripts test", - "test:unit-browser": "npm run test -- -s unit -p 8080 -l -c ", - "test:visual-browser": "npm run test -- -s visual -p 8080 -l -c ", - "test:old_but_gold": "qunit --require ./test/node_test_setup.js test/lib test/unit", - "test:visual:old_but_gold": "qunit test/node_test_setup.js test/lib test/visual", "test:coverage": "nyc --silent qunit test/node_test_setup.js test/lib test/unit", "test:visual:coverage": "nyc --silent --no-clean qunit test/node_test_setup.js test/lib test/visual", "coverage:report": "nyc report --reporter=lcov --reporter=text", From ee3388cde5da62254376d7e48c7ca41464c95f21 Mon Sep 17 00:00:00 2001 From: ShaMan123 Date: Mon, 29 Aug 2022 09:47:04 +0300 Subject: [PATCH 15/22] reintroduce node golden generation @asturur this is what I meant in the comments of #8206 --- scripts/index.js | 51 ++++++++++++++++++++++++++--------------- test/node_test_setup.js | 22 +++++++++--------- 2 files changed, 43 insertions(+), 30 deletions(-) diff --git a/scripts/index.js b/scripts/index.js index d2596776e5e..20217848edf 100644 --- a/scripts/index.js +++ b/scripts/index.js @@ -320,40 +320,53 @@ async function runTestem({ suite, port, launch, dev, processOptions, context } = * @returns {Promise} true if some tests failed */ async function test(suite, tests, options = {}) { - const processOptions = { - cwd: wd, - env: { - ...process.env, - TEST_FILES: (tests || []).join(','), - NODE_CMD: ['qunit', 'test/node_test_setup.js', 'test/lib'].concat(tests || `test/${suite}`).join(' '), - VERBOSE: Number(options.verbose), - QUNIT_DEBUG_VISUAL_TESTS: Number(options.debug), - QUNIT_RECREATE_VISUAL_REFS: Number(options.recreate), - QUNIT_FILTER: options.filter, - REPORT_FILE: options.out - }, - shell: true, - stdio: 'inherit', - } - let failed = false; + const qunitEnv = { + QUNIT_DEBUG_VISUAL_TESTS: Number(options.debug), + QUNIT_RECREATE_VISUAL_REFS: Number(options.recreate), + QUNIT_FILTER: options.filter, + }; + const env = { + ...process.env, + TEST_FILES: (tests || []).join(','), + NODE_CMD: ['qunit', 'test/node_test_setup.js', 'test/lib'].concat(tests || `test/${suite}`).join(' '), + VERBOSE: Number(options.verbose), + REPORT_FILE: options.out + }; + const browserContexts = options.context.filter(c => c !== 'node'); // temporary revert // run node tests directly with qunit if (options.context.includes('node')) { try { - cp.execSync(processOptions.env.NODE_CMD, processOptions); + cp.execSync(env.NODE_CMD, { + cwd: wd, + env: { + ...env, + // browser takes precendence in golden ref generation + ...(browserContexts.length === 0 ? qunitEnv : {}) + }, + shell: true, + stdio: 'inherit', + }); } catch (error) { failed = true; } } - const browserContexts = options.context.filter(c => c !== 'node'); if (browserContexts.length > 0) { failed = await runTestem({ ...options, suite, - processOptions, + processOptions: { + cwd: wd, + env: { + ...env, + ...qunitEnv + }, + shell: true, + stdio: 'inherit', + }, context: browserContexts }) || failed; } diff --git a/test/node_test_setup.js b/test/node_test_setup.js index 90ecc2d29dc..413b2c7023d 100644 --- a/test/node_test_setup.js +++ b/test/node_test_setup.js @@ -3,17 +3,17 @@ var chalk = require('chalk'); var diff = require('deep-object-diff').diff; var commander = require('commander'); -// commander.program -// .option('-d, --debug', 'debug visual tests by overriding refs (golden images) in case of visual changes', false) -// .option('-r, --recreate', 'recreate visual refs (golden images)', false) -// .action(options => { -// QUnit.debug = QUnit.debugVisual = options.debug; -// QUnit.recreateVisualRefs = options.recreate; -// }).parse(process.argv); -// // for now accept an env variable because qunit doesn't allow passing unknown options -// QUnit.debugVisual = Number(process.env.QUNIT_DEBUG_VISUAL_TESTS); -// QUnit.recreateVisualRefs = Number(process.env.QUNIT_RECREATE_VISUAL_REFS); -// QUnit.config.filter = process.env.QUNIT_FILTER; +commander.program + .option('-d, --debug', 'debug visual tests by overriding refs (golden images) in case of visual changes', false) + .option('-r, --recreate', 'recreate visual refs (golden images)', false) + .action(options => { + QUnit.debug = QUnit.debugVisual = options.debug; + QUnit.recreateVisualRefs = options.recreate; + }).parse(process.argv); +// for now accept an env variable because qunit doesn't allow passing unknown options +QUnit.debugVisual = Number(process.env.QUNIT_DEBUG_VISUAL_TESTS); +QUnit.recreateVisualRefs = Number(process.env.QUNIT_RECREATE_VISUAL_REFS); +QUnit.config.filter = process.env.QUNIT_FILTER; global.fabric = require('../dist/fabric').fabric; global.pixelmatch = require('pixelmatch'); From b852b888c19f0c70aa0545a7980484d156b03c43 Mon Sep 17 00:00:00 2001 From: ShaMan123 Date: Tue, 30 Aug 2022 06:19:55 +0300 Subject: [PATCH 16/22] default `verbose` true --- scripts/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/index.js b/scripts/index.js index 20217848edf..088c3083065 100644 --- a/scripts/index.js +++ b/scripts/index.js @@ -543,7 +543,8 @@ program .option('-a, --all', 'run all tests', false) .option('-d, --debug', 'debug visual tests by overriding refs (golden images) in case of visual changes', false) .option('-r, --recreate', 'recreate visual refs (golden images)', false) - .option('-v, --verbose', 'log passing tests', false) + .option('-v, --verbose', 'log passing tests', true) + .option('--no-verbose', 'disable verbose logging') .option('-l, --launch', 'launch tests in the browser', false) .option('--dev', 'runs testem in `dev` mode, without a `ci` flag', false) .addOption(new commander.Option('-c, --context ', 'context to test in').choices(['node', 'chrome', 'firefox']).default(['node'])) From ba542368b902548c4e8e040f2daa3b65f4041ed2 Mon Sep 17 00:00:00 2001 From: ShaMan123 Date: Tue, 30 Aug 2022 06:32:22 +0300 Subject: [PATCH 17/22] fix(test): catch unhandled rejection https://api.qunitjs.com/extension/QUnit.onUncaughtException/ --- test/node_test_setup.js | 2 ++ test/tests.mustache | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/test/node_test_setup.js b/test/node_test_setup.js index 413b2c7023d..5a65650f6e5 100644 --- a/test/node_test_setup.js +++ b/test/node_test_setup.js @@ -15,6 +15,8 @@ QUnit.debugVisual = Number(process.env.QUNIT_DEBUG_VISUAL_TESTS); QUnit.recreateVisualRefs = Number(process.env.QUNIT_RECREATE_VISUAL_REFS); QUnit.config.filter = process.env.QUNIT_FILTER; +process.on('uncaughtException', QUnit.onUncaughtException); + global.fabric = require('../dist/fabric').fabric; global.pixelmatch = require('pixelmatch'); global.fs = require('fs'); diff --git a/test/tests.mustache b/test/tests.mustache index 686650a55d1..9b3a856feb6 100644 --- a/test/tests.mustache +++ b/test/tests.mustache @@ -18,6 +18,10 @@ QUnit.config.reorder = false;