Home > Mobile >  Glob for NUnit dlls
Glob for NUnit dlls

Time:04-14

We have the following command which SHOULD search for all dlls of test:

packages\NUnit.ConsoleRunner.3.10.0\tools\nunit3-console.exe --result=${env:CI_PROJECT_DIR}\sonite.tests.xml`;transform=nunit3-junit.xslt --noheader --agents=5 --workers=5 --trace=Off ((ls -Recurse *Test(s).dll | % FullName) -Match "\bin\")

In the pipeline we get the following error:

The term 's' is not recognized as the name of a cmdlet, function, script file, or operable

I was expecting this to work where s is optional. What am I doing wrong?

EDIT: I'm running it from a powershell command.

CodePudding user response:

You can get all files with Test string in them, and end with .dll extension, and then check if the strings ends with Test.dll or Tests.dll using a regex:

(ls -Recurse *Test*.dll | ? { $_.Name -match 'Tests?\.dll$' } | % FullName)

Details:

  • Test - Test
  • s? - an optional s
  • \.dll - .dll
  • $ - end of string.

Note -match is case insensitive, if you need it to be case sensitive, use -cmatch.

  • Related