Skip to content

Commit

Permalink
Use flags from package.json to determine testing level, see phetsims/…
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Apr 7, 2021
1 parent ce0cf94 commit 9a4239c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
8 changes: 7 additions & 1 deletion js/phet-io/phetioCompareAPISets.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,17 @@ module.exports = async ( repos, proposedAPIs, options ) => {

repos.forEach( repo => {

const packageObject = JSON.parse( fs.readFileSync( `../${repo}/package.json`, 'utf8' ) );
const phetioSection = packageObject.phet[ 'phet-io' ] || {};

// Fails on missing file or parse error.
const referenceAPI = JSON.parse( fs.readFileSync( `${API_DIR}/${repo}.json`, 'utf8' ) );
const proposedAPI = proposedAPIs[ repo ];

const comparisonData = phetioCompareAPIs( referenceAPI, proposedAPI, _ );
const comparisonData = phetioCompareAPIs( referenceAPI, proposedAPI, _, {
compareBreakingAPIChanges: !!phetioSection.compareBreakingAPIChanges,
compareDesignedAPIChanges: !!phetioSection.compareDesignedAPIChanges
} );

if ( comparisonData.breakingProblems.length ) {
console.log( `${repo} BREAKING PROBLEMS` );
Expand Down
5 changes: 4 additions & 1 deletion js/phet-io/phetioCompareAPIs.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ const _phetioCompareAPIs = ( referenceAPI, proposedAPI, _, options ) => {
const missingFromProposed = referencePhetioIDs.filter( e => !proposedPhetioIDs.includes( e ) );
missingFromProposed.forEach( missingPhetioID => {
appendProblem( `PhET-iO Element missing: ${missingPhetioID}`, false );
appendProblem( `PhET-iO Element missing: ${missingPhetioID}`, true );

if ( isPhetioDesigned( referenceAPI, missingPhetioID ) ) {
appendProblem( `PhET-iO Element missing: ${missingPhetioID}`, true );
}

delete newReferenceAPI.phetioElements[ missingPhetioID ];
} );
Expand Down

0 comments on commit 9a4239c

Please sign in to comment.