Skip to content

Commit

Permalink
ensure goldens tests are excluded if renderer is excluded.
Browse files Browse the repository at this point in the history
  • Loading branch information
bhouston committed Oct 30, 2023
1 parent 5ee586a commit c684bb8
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/render-fidelity-tools/src/artifact-creator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ export class ArtifactCreator {
const {rootDirectory, outputDirectory, goldens} = this;
const {name: scenarioName, exclude, dimensions} = scenario;

// skip if this renderer is excluded from this scenario
if(exclude != null && exclude.includes(renderer) ) {
return;
}

console.log(
`Start to compare ${renderer}'s golden with other renderers' goldens:`);

Expand Down Expand Up @@ -200,10 +205,16 @@ export class ArtifactCreator {
const scenarioName = scenarioBase.name;
const scenario = this[$configReader].scenarioConfig(scenarioName)!;

// skip if white lists exists and this scenario isn't in it
if (scenarioWhitelist != null && !scenarioWhitelist.has(scenarioName)) {
continue;
}

// skip if this renderer is excluded from this scenario
if(scenario.exclude != null && scenario.exclude.includes(renderer) ) {
continue;
}

console.log(`\n🎨 Scenario: ${scenarioName}`);

const scenarioOutputDirectory = join(outputDirectory, scenarioName);
Expand Down Expand Up @@ -241,6 +252,9 @@ export class ArtifactCreator {
this.config,
{scenarios: analyzedScenarios, errors: compareRenderersErrors});

// ensure directory exists, this can happen if all scenarios are ignored
await fs.mkdir(outputDirectory, {recursive: true});

await fs.writeFile(
join(outputDirectory, 'config.json'), JSON.stringify(finalConfig));

Expand Down

0 comments on commit c684bb8

Please sign in to comment.