mirror of
https://github.com/liabru/matter-js.git
synced 2024-12-27 13:59:01 -05:00
added support for example versioning in tests
This commit is contained in:
parent
07927162fc
commit
31d0ace631
2 changed files with 17 additions and 2 deletions
|
@ -5,9 +5,16 @@ jest.setTimeout(120 * 1000);
|
|||
|
||||
const puppeteer = require('puppeteer-core');
|
||||
const Example = require('../examples/index');
|
||||
const MatterBuild = require('../build/matter');
|
||||
const { versionSatisfies } = require('../src/core/Plugin');
|
||||
const fs = require('fs');
|
||||
|
||||
const examples = Object.keys(Example);
|
||||
const examples = Object.keys(Example).filter(key => {
|
||||
const buildVersion = MatterBuild.version;
|
||||
const exampleFor = Example[key].for;
|
||||
return versionSatisfies(buildVersion, exampleFor);
|
||||
});
|
||||
|
||||
const browserPath = '/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome';
|
||||
const demoPagePath = 'http://localhost:8000/';
|
||||
const totalUpdates = 5;
|
||||
|
|
|
@ -7,13 +7,21 @@ const { comparisonReport, toMatchExtrinsics, toMatchIntrinsics } = require('./Te
|
|||
|
||||
const Example = require('../examples/index');
|
||||
const MatterBuild = require('../build/matter');
|
||||
const { versionSatisfies } = require('../src/core/Plugin');
|
||||
const Worker = require('jest-worker').default;
|
||||
|
||||
const testComparison = process.env.COMPARE === 'true';
|
||||
const saveComparison = process.env.SAVE === 'true';
|
||||
const excludeExamples = ['svg', 'terrain'];
|
||||
const excludeJitter = ['stack', 'circleStack', 'restitution', 'staticFriction', 'friction', 'newtonsCradle', 'catapult'];
|
||||
const examples = Object.keys(Example).filter(key => !excludeExamples.includes(key));
|
||||
|
||||
const examples = Object.keys(Example).filter(key => {
|
||||
const excluded = excludeExamples.includes(key);
|
||||
const buildVersion = MatterBuild.version;
|
||||
const exampleFor = Example[key].for;
|
||||
const supported = versionSatisfies(buildVersion, exampleFor);
|
||||
return !excluded && supported;
|
||||
});
|
||||
|
||||
const runExamples = async useDev => {
|
||||
const worker = new Worker(require.resolve('./ExampleWorker'), {
|
||||
|
|
Loading…
Reference in a new issue