Skip to content

Commit

Permalink
Improve test runner and make commands (#649)
Browse files Browse the repository at this point in the history
* add make update command

* add make constraint

* improve first run on fresh constraint
  • Loading branch information
wandmagic committed Sep 4, 2024
1 parent c38c2b8 commit 89f6c35
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/scripts/dev-constraint.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,15 @@ async function runCucumberTest(constraintId, testFiles) {
const nodeOptions = '--loader ts-node/esm --no-warnings --experimental-specifier-resolution=node';
const cucumberCommand = `NODE_OPTIONS="${nodeOptions}" npx cucumber-js`;

const scenarioLines = getScenarioLineNumbers(featureFile, constraintId,testFiles);
let scenarioLines = getScenarioLineNumbers(featureFile, constraintId,testFiles);

if (scenarioLines.length === 0) {
console.error(`No scenarios found for constraintId: ${constraintId}`);
execSync("npm run test:coverage",{stdio:'inherit'});
execSync("npm run test:coverage",{stdio:'ignore'});
scenarioLines = getScenarioLineNumbers(featureFile, constraintId,testFiles);
if(scenarioLines.length===0){
return false;
}
}

try {
Expand Down
6 changes: 6 additions & 0 deletions src/validations/module.mk
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ build-validations:
clean-validations:
@echo "Nothing to clean"

update:
npm install
$(OSCAL_CLI) use latest
constraint:
npm run constraint

test-validations:
@echo "Validating rev5 artifacts recursively..."
$(OSCAL_CLI) validate -f $(REV5_BASELINES) -e ./src/validations/constraints/fedramp-external-constraints.xml -r
Expand Down

0 comments on commit 89f6c35

Please sign in to comment.