Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

arborist test coverage #6022

Merged
merged 3 commits into from
Jan 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions workspaces/arborist/lib/arborist/load-virtual.js
@@ -1,5 +1,6 @@
// mixin providing the loadVirtual method
const localeCompare = require('@isaacs/string-locale-compare')('en')
const mapWorkspaces = require('@npmcli/map-workspaces')

const { resolve } = require('path')

Expand All @@ -21,7 +22,6 @@ const loadRoot = Symbol('loadRoot')
const loadNode = Symbol('loadVirtualNode')
const loadLink = Symbol('loadVirtualLink')
const loadWorkspaces = Symbol.for('loadWorkspaces')
const loadWorkspacesVirtual = Symbol.for('loadWorkspacesVirtual')
const flagsSuspect = Symbol.for('flagsSuspect')
const reCalcDepFlags = Symbol('reCalcDepFlags')
const checkRootEdges = Symbol('checkRootEdges')
Expand Down Expand Up @@ -157,7 +157,7 @@ module.exports = cls => class VirtualLoader extends cls {
}

const lockWS = []
const workspaces = this[loadWorkspacesVirtual]({
const workspaces = mapWorkspaces.virtual({
cwd: this.path,
lockfile: s.data,
})
Expand Down
22 changes: 4 additions & 18 deletions workspaces/arborist/lib/arborist/load-workspaces.js
@@ -1,33 +1,19 @@
const mapWorkspaces = require('@npmcli/map-workspaces')

const _appendWorkspaces = Symbol('appendWorkspaces')
// shared ref used by other mixins/Arborist
const _loadWorkspaces = Symbol.for('loadWorkspaces')
const _loadWorkspacesVirtual = Symbol.for('loadWorkspacesVirtual')

module.exports = cls => class MapWorkspaces extends cls {
[_appendWorkspaces] (node, workspaces) {
if (node && workspaces.size) {
node.workspaces = workspaces
}

return node
}

async [_loadWorkspaces] (node) {
if (node.workspaces) {
return node
}

const workspaces = await mapWorkspaces({
cwd: node.path,
pkg: node.package,
})

return this[_appendWorkspaces](node, workspaces)
}
if (node && workspaces.size) {
node.workspaces = workspaces
}

[_loadWorkspacesVirtual] (opts) {
return mapWorkspaces.virtual(opts)
return node
}
}
2 changes: 1 addition & 1 deletion workspaces/arborist/lib/override-resolves.js
@@ -1,4 +1,4 @@
function overrideResolves (resolved, opts = {}) {
function overrideResolves (resolved, opts) {
const { omitLockfileRegistryResolved = false } = opts

if (omitLockfileRegistryResolved) {
Expand Down
1 change: 0 additions & 1 deletion workspaces/arborist/map.js

This file was deleted.

1 change: 0 additions & 1 deletion workspaces/arborist/package.json
Expand Up @@ -81,7 +81,6 @@
"tap": {
"color": true,
"after": "test/fixtures/cleanup.js",
"coverage-map": "map.js",
"test-env": [
"NODE_OPTIONS=--no-warnings",
"LC_ALL=sk"
Expand Down