I am trying to match URLs.
lab.before(async () => {
nock('https://dev.azure.com')
.get(centosAzureUri)
.times(5)
.reply(201, [
...
If I use a string, it is working just fine. An example is below:
const centosAzureUri = `/${conf.org}/${conf.buildProject}/_apis/build/builds?api-version=4.1&branchName=${conf.buildBranch}`
However, I want to use a RegEx as below:
const centosAzureUri = new RegExp(`/${conf.org}/${conf.buildProject}/_apis/build/builds?api-version=4.1.*`, 'g')
That is not working.
According to the documentation, nock
should accept regular expressions and .*
should match any symbol [because of the .] and allow those matched characters to be repeated any number of times. Hence, I am assuming this should accept any string ending, including &branchName=${conf.buildBranch}
.
What I am doing wrong?