npm glob pattern not matching subdirectories

后端 未结 3 579
面向向阳花
面向向阳花 2020-12-17 09:48

In my package.json, I have a scripts block that uses **/*Test.js to match files. When run via npm, they do not match sub-directories m

3条回答
  •  隐瞒了意图╮
    2020-12-17 10:08

    You can inline the find command with the -name option in your scripts to replace the extended globbing syntax provided by zsh.

    In your case, the command would be:

    mocha `find dist -type f -name '*Test.js'`
    

    You can realistically omit the -type f part if you're confident that you won't ever put "Test.js" in a directory name. (A safe assumption, most likely, but I included it for completeness sake)

提交回复
热议问题