codeowners-utils
Version:
Utilities for working with CODEOWNERS files
32 lines (29 loc) • 525 B
text/typescript
import test from "ava"
import * as codeowners from "../src/codeowners-utils"
import stripIndent from "strip-indent"
test("parse", t => {
let entries = codeowners.parse(
stripIndent(`
# comment
* @root
*.js @js js@example.com
# comment
# comment
doc/*.md @doc
`),
)
t.deepEqual(entries, [
{
pattern: "doc/*.md",
owners: ["@doc"],
},
{
pattern: "*.js",
owners: ["@js", "js@example.com"],
},
{
pattern: "*",
owners: ["@root"],
},
])
})