Skip to content

Commit

Permalink
added support for example versioning in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
liabru committed Dec 30, 2020
1 parent 0792716 commit 31d0ace
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
9 changes: 8 additions & 1 deletion test/Browser.spec.js
Expand Up @@ -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;
Expand Down
10 changes: 9 additions & 1 deletion test/Examples.spec.js
Expand Up @@ -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'), {
Expand Down

0 comments on commit 31d0ace

Please sign in to comment.