From ec82e2f6fd8dc8a5152f7f5df40b17cfa90365c1 Mon Sep 17 00:00:00 2001 From: Hadrien Croubois Date: Fri, 10 Mar 2023 15:34:48 +0100 Subject: [PATCH] use micromatch --- certora/run.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/certora/run.js b/certora/run.js index 7623f95c6..175cedd88 100644 --- a/certora/run.js +++ b/certora/run.js @@ -11,10 +11,9 @@ const MAX_PARALLEL = 4; const proc = require('child_process'); const { PassThrough } = require('stream'); const events = require('events'); +const micromatch = require('micromatch'); const limit = require('p-limit')(MAX_PARALLEL); -const strToRegex = str => new RegExp(`^${str.replace(/[.+?^${}()|[\]\\]/g, '\\$&').replace(/[*]/g, '.$&')}$`); - let [, , request = '', ...extraOptions] = process.argv; if (request.startsWith('-')) { extraOptions.unshift(request); @@ -23,8 +22,8 @@ if (request.startsWith('-')) { const [reqSpec, reqContract] = request.split(':').reverse(); const specs = require(__dirname + '/specs.js') - .filter(entry => !reqSpec || strToRegex(reqSpec).test(entry.spec)) - .filter(entry => !reqContract || strToRegex(reqContract).test(entry.contract)); + .filter(entry => !reqSpec || micromatch(entry.spec, reqSpec)) + .filter(entry => !reqContract || micromatch(entry.contract, reqContract)); if (specs.length === 0) { console.error(`Error: Requested spec '${request}' not found in specs.json`);