diff --git a/package.json b/package.json index 2bdb97d..0a5c29a 100644 --- a/package.json +++ b/package.json @@ -53,8 +53,8 @@ "test-all": "jest --no-cache", "test-save": "SAVE=true npm run test-node", "test-watch": "npm run test-node -- --watch", - "test-node": "jest --no-cache ./test/Examples.spec.js", - "test-browser": "jest --no-cache ./test/Browser.spec.js", + "test-node": "node --expose-gc node_modules/.bin/jest --no-cache --runInBand ./test/Examples.spec.js", + "test-browser": "node --expose-gc node_modules/.bin/jest --no-cache --runInBand ./test/Browser.spec.js", "changelog": "conventional-changelog -i CHANGELOG.md -s -r", "release": "npm version --no-git-tag-version", "preversion": "git checkout master && npm run lint && SAVE=true npm run test-all", diff --git a/test/ExampleWorker.js b/test/ExampleWorker.js index ba13118..64285c2 100644 --- a/test/ExampleWorker.js +++ b/test/ExampleWorker.js @@ -30,6 +30,8 @@ const runExample = options => { const consoleOriginal = global.console; const logs = []; + global.gc(); + mock('matter-js', Matter); global.Matter = Matter; diff --git a/test/Examples.spec.js b/test/Examples.spec.js index dcc7e41..b20a0c9 100644 --- a/test/Examples.spec.js +++ b/test/Examples.spec.js @@ -30,7 +30,8 @@ const examples = Object.keys(Example).filter(key => { const runExamples = async useDev => { const worker = new Worker(require.resolve('./ExampleWorker'), { - enableWorkerThreads: true + enableWorkerThreads: true, + numWorkers: 1 }); const result = await Promise.all(examples.map(name => worker.runExample({ diff --git a/test/TestTools.js b/test/TestTools.js index 129d70b..1b21767 100644 --- a/test/TestTools.js +++ b/test/TestTools.js @@ -256,9 +256,8 @@ const comparisonReport = (capturesDev, capturesBuild, buildVersion, save) => { let perfChange = 1 - (totalTimeDev / totalTimeBuild); - const perfChangeThreshold = 0.075; - const perfChangeLarge = Math.abs(perfChange) > perfChangeThreshold; - perfChange = perfChangeLarge ? perfChange : 0; + const perfChangeThreshold = 0.01; + perfChange = Math.abs(perfChange) > perfChangeThreshold ? perfChange : 0; let similarityAvg = 0; similarityEntries.forEach(([_, similarity]) => { @@ -288,7 +287,7 @@ const comparisonReport = (capturesDev, capturesBuild, buildVersion, save) => { } return output; }, '\n\n'), - `\nwhere · no change ● extrinsics changed ◆ intrinsics changed\n`, + `\n\nwhere · no change ● extrinsics changed ◆ intrinsics changed\n`, similarityAvg < 1 ? `\n${format('▶', colors.White)} ${format(compareCommand + '=' + 120 + '#' + similarityEntries[0][0], colors.BrightCyan)}` : '', intrinsicChangeCount > 0 ? `\n${format('▶', colors.White)} ${format((save ? diffCommand : diffSaveCommand), colors.BrightCyan)}` : '' ].join(' ');