Skip to content

Commit

Permalink
feat(query): display queryContext in results
Browse files Browse the repository at this point in the history
  • Loading branch information
nlf authored and lukekarrys committed Sep 21, 2022
1 parent ebf167b commit 6ee5b32
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
5 changes: 3 additions & 2 deletions lib/commands/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class QuerySelectorItem {
this.inBundle = node.target.inBundle
this.deduped = this.from.length > 1
this.overridden = node.overridden
this.queryContext = node.queryContext
for (const edge of node.target.edgesIn) {
this.from.push(edge.from.location)
}
Expand Down Expand Up @@ -63,7 +64,7 @@ class Query extends BaseCommand {
}
const arb = new Arborist(opts)
const tree = await arb.loadActual(opts)
const items = await tree.querySelectorAll(args[0])
const items = await tree.querySelectorAll(args[0], this.npm.flatOptions)
this.buildResponse(items)

this.npm.output(this.parsedResponse)
Expand All @@ -84,7 +85,7 @@ class Query extends BaseCommand {
items = await tree.querySelectorAll(args[0])
} else {
const [workspace] = await tree.querySelectorAll(`.workspace:path(${workspacePath})`)
items = await workspace.target.querySelectorAll(args[0])
items = await workspace.target.querySelectorAll(args[0], this.npm.flatOptions)
}
this.buildResponse(items)
}
Expand Down
33 changes: 22 additions & 11 deletions tap-snapshots/test/lib/commands/query.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ exports[`test/lib/commands/query.js TAP global > should return global package 1`
"dev": false,
"inBundle": false,
"deduped": false,
"overridden": false
"overridden": false,
"queryContext": {}
}
]
`
Expand Down Expand Up @@ -53,7 +54,8 @@ exports[`test/lib/commands/query.js TAP include-workspace-root > should return w
"dev": false,
"inBundle": false,
"deduped": false,
"overridden": false
"overridden": false,
"queryContext": {}
},
{
"name": "c",
Expand All @@ -69,7 +71,8 @@ exports[`test/lib/commands/query.js TAP include-workspace-root > should return w
"dev": false,
"inBundle": false,
"deduped": false,
"overridden": false
"overridden": false,
"queryContext": {}
}
]
`
Expand All @@ -90,7 +93,8 @@ exports[`test/lib/commands/query.js TAP linked node > should return linked node
"dev": false,
"inBundle": false,
"deduped": false,
"overridden": false
"overridden": false,
"queryContext": {}
}
]
`
Expand All @@ -116,7 +120,8 @@ exports[`test/lib/commands/query.js TAP recursive tree > should return everythin
"dev": false,
"inBundle": false,
"deduped": false,
"overridden": false
"overridden": false,
"queryContext": {}
},
{
"pkgid": "a@",
Expand All @@ -131,7 +136,8 @@ exports[`test/lib/commands/query.js TAP recursive tree > should return everythin
"dev": false,
"inBundle": false,
"deduped": false,
"overridden": false
"overridden": false,
"queryContext": {}
},
{
"pkgid": "b@",
Expand All @@ -146,7 +152,8 @@ exports[`test/lib/commands/query.js TAP recursive tree > should return everythin
"dev": false,
"inBundle": false,
"deduped": false,
"overridden": false
"overridden": false,
"queryContext": {}
}
]
`
Expand Down Expand Up @@ -175,7 +182,8 @@ exports[`test/lib/commands/query.js TAP simple query > should return root object
"dev": false,
"inBundle": false,
"deduped": false,
"overridden": false
"overridden": false,
"queryContext": {}
},
{
"pkgid": "a@",
Expand All @@ -190,7 +198,8 @@ exports[`test/lib/commands/query.js TAP simple query > should return root object
"dev": false,
"inBundle": false,
"deduped": false,
"overridden": false
"overridden": false,
"queryContext": {}
},
{
"pkgid": "b@",
Expand All @@ -205,7 +214,8 @@ exports[`test/lib/commands/query.js TAP simple query > should return root object
"dev": false,
"inBundle": false,
"deduped": false,
"overridden": false
"overridden": false,
"queryContext": {}
}
]
`
Expand All @@ -226,7 +236,8 @@ exports[`test/lib/commands/query.js TAP workspace query > should return workspac
"dev": false,
"inBundle": false,
"deduped": false,
"overridden": false
"overridden": false,
"queryContext": {}
}
]
`

0 comments on commit 6ee5b32

Please sign in to comment.