-
Notifications
You must be signed in to change notification settings - Fork 343
Open
Description
- I have searched for similar issues
Steps to Reproduce
git clone [email protected]:raineorshine/npm-check-updates.git
cd npm-check-updates
npm ci
npm run test
Current Behavior
I get this error:
$ npm run test
> [email protected] test
> npm run test:unit && npm run test:e2e
> [email protected] test:unit
> mocha test test/package-managers/*
✔ do not colorize unchanged versions
✔ colorize changed patch versions
✔ colorize changed minor versions
✔ colorize changed major versions
✔ colorize whole parts
✔ do not include the leading ^ or ~ if the same
✔ colorize changed versions before 1.0.0 as breaking
bin
✔ fetch latest version from registry (not stubbed) (617ms)
✔ output only upgraded with --jsonUpgraded (176ms)
✔ --loglevel verbose (219ms)
✔ --verbose (218ms)
✔ accept stdin (188ms)
✔ reject out-of-date stdin with errorLevel 2 (178ms)
✔ fall back to package.json search when receiving empty content on stdin (224ms)
✔ use package.json in cwd by default (174ms)
✔ throw error if there is no package (169ms)
✔ throw error if there is no package in --cwd (170ms)
✔ throw error if --cwd does not exist (164ms)
✔ read --packageFile (182ms)
✔ write to --packageFile (200ms)
✔ write to --packageFile if errorLevel=2 and upgrades (189ms)
✔ write to --packageFile with jsonUpgraded flag (193ms)
✔ ignore stdin if --packageFile is specified (194ms)
✔ suppress stdout when --silent is provided (222ms)
✔ quote arguments with spaces in upgrade hint (197ms)
✔ ignore file: and link: protocols (174ms)
✔ combine boolean flags with arguments (175ms)
✔ combine short boolean options with long options (175ms)
embedded versions
✔ strip url from Github url in "to" output (643ms)
✔ strip prefix from npm alias in "to" output (178ms)
option-specific help
✔ long option (153ms)
✔ long option without "--" prefix (162ms)
✔ short option (158ms)
✔ short option without "-" prefix (162ms)
✔ option with default (161ms)
✔ option with extended help (168ms)
✔ -h (165ms)
✔ unknown option (162ms)
✔ multiple options (159ms)
✔ --version (163ms)
✔ -V (159ms)
✔ -v (165ms)
special --help help
✔ --help --help (157ms)
✔ --help help (157ms)
✔ --help -h (164ms)
✔ --help h (158ms)
✔ -h --help (159ms)
✔ -h help (167ms)
✔ -h -h (159ms)
✔ -h h (163ms)
cache
✔ cache latest versions
✔ use different cache key for different target
✔ clears the cache file
cli-options
✔ require long and description properties
--deep
✔ do not allow --packageFile and --deep together
✔ output json with --jsonAll (204ms)
✔ ignore stdin if --packageFile glob is specified (193ms)
✔ update multiple packages (198ms)
--deep with nested ncurc files
✔ use ncurc of nested packages (213ms)
✔ use ncurc of nested packages with --mergeConfig option (204ms)
mergeOptions
✔ merge options
--dep
✔ do not upgrade peerDependencies by default
✔ only upgrade devDependencies with --dep dev
✔ only upgrade devDependencies and peerDependencies with --dep dev,peer
section isolation
✔ do not overwrite the same package in peerDependencies when upgrading devDependencies
✔ do not overwrite the same package in devDependencies when upgrading peerDependencies
(node:13608) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 exit listeners added to [process]. MaxListeners is 10. Use emitter.setMaxListeners() to increase limit
at genericNodeError (node:internal/errors:983:15)
at wrappedFn (node:internal/errors:537:14)
at _addListener (node:events:593:17)
at process.addListener (node:events:611:10)
at run (D:\Repositories\npm-check-updates\src\index.ts:316:11)
at async Context.<anonymous> (D:\Repositories\npm-check-updates\test\dep.test.ts:172:9)
✔ do not overwrite the same package in devDependencies when upgrading dependencies and peerDependencies
packageManager field
✔ upgrade packageManager field by default
✔ do not upgrade packageManager field if missing from --dep
✔ do nothing if no packageManager field is present
✔ upgrade packageManager field if specified in --dep
✔ do nothing if packageManager is up-to-date
determinePackageManager
✔ returns bun if bun.lockb exists in cwd
✔ returns bun if bun.lock exists in cwd
✔ returns bun if bun.lockb exists in an ancestor directory
✔ returns yarn if yarn.lock exists in cwd
✔ returns yarn if yarn.lock exists in an ancestor directory
✔ returns npm if package-lock.json found before yarn.lock
✔ does not loop infinitely if no lockfile found
global
✔ detects bun
✔ detects yarn
✔ detects pnpm
✔ defaults to npm
doctor
npm
✔ print instructions when -u is not specified (169ms)
✔ throw an error if there is no package file (165ms)
✔ throw an error if there is no test script (179ms)
✔ throw an error if --packageData or --packageFile are supplied (189ms)
✔ upgrade dependencies when tests pass (2996ms)
✔ identify broken upgrade (10493ms)
✔ pass through options (3086ms)
✔ custom install script with --doctorInstall (1271ms)
✔ custom test script with --doctorTest (2994ms)
✔ custom test script with --doctorTest command that includes spaced words wrapped in quotes (2215ms)
✔ handle failed prepare script (8335ms)
yarn
✔ upgrade dependencies when tests pass (1439ms)
✔ identify broken upgrade (4618ms)
enginesNode
✔ update packages that satisfy the project's engines.node (207ms)
✔ do not update packages with incompatible engines.node (83ms)
✔ update packages that do not have engines.node (38ms)
filter
module
✔ filter by package name with one arg
✔ filter by package name with multiple args
✔ filter with wildcard
✔ filter with wildcard for scoped package
✔ filter with negated wildcard
✔ filter with regex string
✔ filter with array of strings
✔ filter with array of regex
✔ filter with array of mixed strings and regex
✔ filter with array of regex strings
✔ trim and ignore empty array
✔ empty string is invalid
cli
✔ filter by package name with --filter (186ms)
✔ filter by package name with -f (192ms)
✔ do not allow non-matching --filter and arguments (163ms)
✔ allow matching --filter and arguments (179ms)
✔ trim and ignore empty args (187ms)
✔ allow multiple --filter options (182ms)
reject
cli
✔ reject by package name with --reject (179ms)
✔ reject by package name with -x (184ms)
✔ reject with empty string should not reject anything (187ms)
✔ allow multiple --reject options (175ms)
filterResults
✔ should return only major versions updated
filterVersion
module
✔ filter by package version with string
✔ filter by package version with space-delimited list of strings (417ms)
✔ filter by package version with comma-delimited list of strings (47ms)
✔ filter by package version with RegExp (43ms)
✔ filter by package version with RegExp string (45ms)
cli
✔ allow multiple --filterVersion options (184ms)
rejectVersion
cli
✔ allow multiple --rejectVersion options (177ms)
format
✔ --format time (304ms)
✔ --format repo (2075ms)
✔ --format lines (181ms)
✔ disallow --format lines with --jsonUpgraded (161ms)
✔ disallow --format lines with --jsonAll (159ms)
✔ disallow --format lines with other format options (162ms)
getAllPackages
✔ returns default package without cwd
basic npm package
✔ handles tradition flat npm project
✔ errors in non-workspace project with --workspaces option
✔ errors in non-workspace project with --workspace=<name> option
basic workspace project
✔ handles simple workspace without --workspaces option
✔ handles simple workspace with --workspaces option
✔ handles simple workspace with --workspaces and --root option
✔ handles simple workspace with --workspaces=false
--workspace="<string>"
✔ handles simple workspace with --workspace="basic-sub-package"
✔ handles simple workspace with --workspaces and --workspace="basic-sub-package"
✔ handles simple workspace with --workspaces, --workspace="basic-sub-package", and --root option
✔ handles simple workspace with --workspaces and --workspace=<empty>
✔ handles simple workspace with --workspaces=false and --workspace="basic-sub-package"
empty workspace project
package.workspaces is empty array
✔ should return empty data for empty workspaces
package.workspaces is object and package.workspaces.packages is empty array
✔ should return empty data for empty workspaces
sub-package-names
- --workspaces should return all packages not just ones that dir-names-match
- --workspace should return all named packages not just ones that dir-names-match
getCurrentDependencies
✔ return an empty object for an empty package.json and handle default options
✔ get dependencies, devDependencies, and optionalDependencies by default
dep
✔ only get dependencies with --dep prod
✔ only get devDependencies with --dep dev
✔ only get optionalDependencies with --dep optional
✔ only get peerDependencies with --dep peer
✔ only get devDependencies and peerDependencies with --dep dev,peer
filter
✔ filter dependencies by package name
✔ filter dependencies by @org/package name
✔ do not filter out dependencies with a partial package name
✔ filter dependencies by multiple packages
✔ filter dependencies by regex
- should filter org dependencies by regex
✔ filter dependencies by name with a filter function
✔ filter dependencies by version spec with a filter function
filterVersion
✔ filter dependency versions by pinned version
✔ filter dependency versions by caret version
✔ filter dependencies by multiple versions (comma-or-space-delimited)
✔ filter dependency versions by regex
✔ filter dependencies by version spec with a filterVersion function
reject
✔ reject dependencies by package name
✔ do not reject dependencies with a partial package name
✔ reject dependencies by multiple packages
✔ reject dependencies by regex
✔ reject dependencies by function
✔ filter and reject
rejectVersion
✔ reject dependency versions by pinned version
✔ reject dependency versions by caret version
✔ reject dependencies by multiple versions (comma-or-space-delimited)
✔ reject dependency versions by regex
✔ reject dependency versions by function
getEnginesNodeFromRegistry
[====================] 1/1 100%
✔ single package (187ms)
[====================] 1/1 100%
✔ single package empty (195ms)
[====================] 3/3 100%
✔ multiple packages (164ms)
getIgnoredUpgradesDueToEnginesNode
- ncu-test-peer-update
getIgnoredUpgradesDueToPeerDeps
[====================] 1/1 100%
✔ ncu-test-peer-update (873ms)
[====================] 3/3 100%
✔ ignored peer after upgrade (718ms)
getInstalledPackages
✔ execute npm ls (955ms)
getPeerDependenciesFromRegistry
[====================] 1/1 100%
✔ single package (827ms)
[====================] 1/1 100%
✔ single package empty (596ms)
[====================] 2/2 100%
✔ multiple packages (619ms)
getPreferredWildcard
✔ identify ^ when it is preferred
✔ identify ~ when it is preferred
✔ identify .x when it is preferred
✔ identify .* when it is preferred
✔ do not allow wildcards to be outnumbered by non-wildcards
✔ use the first wildcard if there is a tie
✔ return null when it cannot be determined from other dependencies
getRepoUrl
✔ return null if package is not installed
✔ return null repository field is undefined
✔ return null repository field is unknown type
✔ return url directly from repository field if valid https url
✔ return url directly from repository field if valid http url
✔ return url constructed from github shortcut syntax string
✔ return url constructed from repository specific shortcut syntax string
✔ return url directly from url field if not a known git host
✔ return url constructed from git-https protocol
✔ return url constructed from git protocol
✔ return url constructed from http protocol
✔ return url with directory path
github urls
✔ upgrade github https urls (344ms)
✔ upgrade short github urls (518ms)
✔ upgrade shortest github urls (525ms)
✔ upgrade github http urls with semver (312ms)
- upgrade github git+ssh urls with semver
global
- global should run
--format group
✔ group upgrades by type (193ms)
✔ preserve version ranges (195ms)
✔ moves package to major group (192ms)
✔ moves package to minor group (191ms)
✔ moves package to patch group (195ms)
✔ moves package to majorVersionZero group (195ms)
✔ creates custom groups (199ms)
run
✔ return jsonUpgraded by default
✔ pass object as packageData
✔ do not suggest upgrades to versions within the specified version range if jsonUpgraded is true and minimal is true
✔ write to --packageFile and output jsonUpgraded
✔ exclude -alpha, -beta, -rc (353ms)
✔ upgrade prereleases to newer prereleases (284ms)
✔ do not upgrade prereleases to newer prereleases with --pre 0 (75ms)
✔ include -alpha, -beta, -rc with --pre option (59ms)
✔ ignore non-string versions (sometimes used as comments)
✔ update devDependency when duplicate dependency is up-to-date
✔ update dependency when duplicate devDependency is up-to-date
✔ ignore invalid semver version (351ms)
✔ ignore file: and link: protocols
deprecated
✔ deprecated included by default (271ms)
✔ deprecated included with --deprecated
✔ deprecated excluded with --no-deprecated (79ms)
overrides
✔ upgrade overrides
✔ upgrade self override
✔ upgrade child override
✔ upgrade nested override
install
non-interactive
✔ print install hint without --install (195ms)
1) install packages and do not print install hint with --install always
✔ do not print install hint with --install never (208ms)
interactive
2) install when responding yes to prompt without --install
✔ do not install when responding no to prompt without --install (187ms)
3) install with --install always
✔ do not install with --install never (191ms)
--interactive
✔ prompt for each upgraded dependency (935ms)
✔ with --format group (692ms)
✔ with --format group and custom group function (656ms)
✔ with --format repo (2227ms)
isUpgradeable
✔ do not upgrade pure wildcards
✔ upgrade versions that do not satisfy latest versions
✔ do not upgrade invalid versions
✔ do not upgrade versions beyond the latest
✔ handle comparison constraints
✔ upgrade simple versions
parseJson
✔ handles valid json strings
✔ handles valid jsonc strings
✔ shows descriptive and helpful error messages
✔ shows a snippet of code surrounded by 4 surrounding lines
✔ show an empty line hint
peer dependencies
✔ peer dependencies are ignored by default (57ms)
✔ peer dependencies are checked when using option peer (1367ms)
✔ peer dependencies are checked iteratively when using option peer (2549ms)
✔ circular peer dependencies are ignored (2311ms)
✔ git urls are ignored (457ms)
✔ ignores if post upgrade peers are unmet (2024ms)
✔ ignores if post upgrade peers are unmet - no upgrades (1258ms)
queryVersions
✔ valid single package
✔ valid packages
✔ unavailable packages should be ignored (282ms)
✔ error while querying version should be handled
✔ local file urls should be ignored
✔ set the target explicitly to latest
✔ set the target to greatest
✔ return an error for an unsupported target
✔ npm aliases should upgrade the installed package (44ms)
github urls
✔ github urls should upgrade the embedded version tag (325ms)
✔ short github urls should be ignored
✔ git+https urls should upgrade the embedded version tag (305ms)
✔ ignore tags that are not valid versions (836ms)
✔ support simple, non-semver tags in the format "v1" (313ms)
✔ ignore repos with no tags (324ms)
✔ valid but non-existent github urls with tags should be ignored (768ms)
✔ github urls should upgrade the embedded semver version range (333ms)
✔ github urls should support --target greatest (331ms)
✔ github urls should support --target newest (337ms)
✔ github urls should support --target minor (374ms)
✔ github urls should support --target patch (311ms)
✔ github urls should not upgrade embedded semver version ranges to prereleases by default (336ms)
✔ github urls should upgrade embedded semver version ranges to prereleases with --target greatest and newest (707ms)
rc-config
✔ print rcConfigPath when there is a non-empty rc config file (200ms)
✔ do not print rcConfigPath when there is no rc config file (202ms)
✔ do not print rcConfigPath when there is an empty rc config file (212ms)
✔ error on missing --configFileName (162ms)
✔ read --configFilePath (183ms)
✔ read --configFileName (181ms)
✔ override config with arguments (184ms)
✔ override true in config with false in the cli (203ms)
✔ handle boolean arguments (183ms)
✔ auto detect .ncurc.json (193ms)
✔ auto detect .ncurc.cjs (194ms)
✔ should not crash if because of $schema property (190ms)
config functions
✔ filter function (200ms)
✔ filterVersion function (191ms)
✔ filterResults function (191ms)
✔ reject function (189ms)
✔ rejectVersion function (187ms)
staticRegistry
✔ upgrade to the version specified in the static registry file
✔ ignore dependencies that are not in the static registry
✔ fetch static registry from a url (306ms)
✔ infer registryType json when --registry file path ends in .json
✔ infer registryType json when --registry url ends in .json
target
minor
✔ do not update major versions with --target minor (43ms)
✔ update minor versions with --target minor (62ms)
✔ update patch versions with --target minor (39ms)
patch
✔ do not update major versions with --target patch (40ms)
✔ do not update minor versions with --target patch (54ms)
✔ update patch versions with --target patch (43ms)
✔ skip non-semver versions with --target patch
newest
✔ do not require --pre with --target newest (285ms)
✔ allow --pre 0 with --target newest to exclude prereleases
✔ work with --target newest with any invalid or wildcard range (38ms)
greatest
✔ do not require --pre with --target greatest (40ms)
semver
^
✔ highest minor for post-1.0 version (355ms)
✔ highest patch for pre-1.0 version (332ms)
- alpha
~
✔ highest patch for post-1.0 version (38ms)
✔ highest patch for pre-1.0 version (42ms)
exact version
✔ ignore exact version range (38ms)
explicit ranges
✔ ignore inclusive range (38ms)
✔ ignore >
✔ ignore >=
✔ ignore < (67ms)
✔ ignore <= (44ms)
✔ ignore ||
custom
✔ custom target function to mimic semver (318ms)
✔ custom target and filter function to mimic semver
tags
✔ upgrade nonprerelease version to specific tag (43ms)
✔ upgrade prerelease version without preid to nonprerelease (47ms)
✔ upgrade prerelease version with preid to higher version on a specific tag (42ms)
✔ upgrade from prerelease without preid to prerelease with preid at a specific tag if major.minor.patch is the same
✔ upgrade from prerelease with preid to prerelease without preid at a specific tag if major.minor.patch is the same
✔ downgrade to tag with a non-matching preid and lower patch
✔ downgrade to tag with a non-matching preid and lower minor
✔ do not downgrade nonprerelease version to lower version with specific tag
✔ do not downgrade to latest with lower version by default
✔ do not downgrade to latest with lower version with --target latest
✔ downgrade to latest with lower version with explicit --target @latest
✔ downgrade to latest with lower version with target function returning @latest
timeout
✔ throw an exception instead of printing to the console when timeout is exceeded
✔ exit with error when timeout is exceeded (188ms)
✔ completes successfully with timeout (230ms)
upgradeDependencies
✔ upgrade simple, non-semver versions
✔ upgrade github dependencies
✔ upgrade latest versions that already satisfy the specified version
✔ do not downgrade
✔ allow to update to latest via @latest tag
✔ use the preferred wildcard when converting <, closed, or mixed ranges
✔ convert closed ranges to caret (^) when preferred wildcard is unknown
✔ ignore packages with empty values
version-util
upgradeDependencyDeclaration
✔ numeric upgrades
✔ wildcard upgrades
✔ convert < to ^
✔ preserve >=
✔ convert > to >=
✔ preserve ^ and ~
✔ preserve prerelease versions
✔ replace multiple ranges with ^
✔ handle ||
✔ hyphen (-) range
✔ use the range with the fewest parts if there are multiple ranges
✔ preserve wildcards in comparisons
✔ use the first operator if a comparison has mixed operators
✔ maintain 'unclean' semantic versions
✔ maintain 'unclean' semantic versions
✔ maintain existing version if new version is unknown
✔ remove semver range if removeRange option is specified
numParts
✔ count the number of parts in a version
getPrecision
✔ detect versions as precise as "major"
✔ detect versions as precise as "minor"
✔ detect versions as precise as "patch"
✔ detect versions as precise as "release"
✔ detect versions as precise as "build"
stringify
✔ build a version string of the given parts
✔ pad the version with an optional precison argument
✔ truncate the version when a precision is provided
setPrecision
✔ set the precision of a version at "major"
✔ set the precision of a version at "minor"
✔ add 0 to minor if needed
✔ set the precision of a version at "patch"
✔ add 0 to patch if needed
✔ set the precision of a version at "release"
✔ set the precision of a version at "build"
isComparable
✔ a version without a preid is comparable to any version
✔ versions with non-matching preids are not comparable
✔ versions with matching preids are comparable
precisionAdd
✔ handle precision increase/decrease of base precisions
✔ handle precision decrease of added precisions (release, build)
addWildCard
✔ add ~
✔ add ^
✔ add .*
✔ add .x
isWildCard
✔ return true for ~
✔ return true for ^
✔ return true for ^*
✔ return true for *
✔ return true for x
✔ return true for x.x
✔ return true for x.x.x
✔ return false for strings that more than a wildcard
isWildPart
✔ return true for *
✔ return true for x
✔ return false for anything other than * or x
partChanged
✔ nothing changed
✔ patch changed
✔ minor changed
✔ major changed
✔ major version zero changed
findGreatestByLevel
✔ find the greatest version at the given semantic versioning level
✔ find the greatest prerelease version
✔ handle wildcards
✔ sort version list
isPre
✔ return false for non-prerelease versions
✔ return true for prerelease versions
npm aliases
createNpmAlias
✔ create an npm alias from a name and version
parseNpmAlias
✔ parse an npm alias into [name, version]
✔ return null if given a non-alias
isNpmAlias
✔ return true if an npm alias
✔ return false if not an npm alias
upgradeNpmAlias
✔ replace embedded version
github urls
isGithubUrl
✔ return true if a declaration is a Github url with a semver tag and false otherwise
getGithubUrlTag
✔ return an embedded tag in a Github URL, or null if not valid
upgradeGithubUrl
✔ replace embedded version
workspaces
stubbed
--workspaces
✔ do not allow --workspaces and --deep together
✔ update workspaces with --workspaces (213ms)
✔ update workspaces glob (205ms)
✔ update workspaces with -ws (209ms)
✔ do not update non-workspace subpackages (209ms)
✔ update workspaces/packages (206ms)
✔ ignore local workspace packages (207ms)
✔ ignore local workspace packages with different names than their folders (204ms)
--workspace
✔ do not allow --workspace and --deep together
✔ do not allow --workspace and --workspaces together
✔ update single workspace with --workspace (197ms)
✔ update single workspace with -w (210ms)
✔ update more than one workspace (214ms)
✔ update single workspace with --cwd and --workspace (207ms)
✔ update namespaced workspace (195ms)
--root/--no-root
✔ update root project by default (205ms)
✔ do not update the root project with --no-root (199ms)
✔ update root project and workspaces if errorLevel=2 (208ms)
✔ do not update non-workspace subpackages (222ms)
--workspace should include --root by default
✔ update root project and single workspace (200ms)
✔ update more than one workspace (212ms)
pnpm
✔ read packages from pnpm-workspace.yaml (213ms)
✔ update pnpm catalog dependencies from pnpm-workspace.yaml (201ms)
bun
✔ update bun catalog dependencies from package.json (top-level) (200ms)
✔ update bun catalog dependencies from package.json (workspaces object) (191ms)
not stubbed
- merge local npm config with pnpm workspace npm config
deno
✔ handle import map (305ms)
✔ auto detect deno.json (332ms)
✔ rewrite deno.json (309ms)
✔ auto detect deno.jsonc (318ms)
✔ rewrite deno.jsonc (309ms)
npm
✔ list (542ms)
✔ latest (62ms)
✔ greatest (257ms)
✔ ownerChanged (333ms)
✔ getPeerDependencies (1182ms)
✔ getEngines (410ms)
yarn
✔ list (43ms)
✔ latest
✔ greatest (46ms)
✔ avoids deprecated (42ms)
✔ "No lockfile" error should be thrown on list command when there is no lockfile (202ms)
✔ getPeerDependencies v1 (2361ms)
✔ getPeerDependencies v4 (1826ms)
npmAuthTokenKeyValue
✔ npmRegistryServer with trailing slash
✔ npmRegistryServer without trailing slash
✔ returns null when no npmAlwaysAuth
✔ returns null when no registry server
getPathToLookForLocalYarnrc
✔ returns the correct path when using Yarn workspaces
478 passing (2m)
8 pending
3 failing
1) install
non-interactive
install packages and do not print install hint with --install always:
AssertionError: expected false to be true
+ expected - actual
-false
+true
at Context.<anonymous> (test\install.test.ts:59:76)
2) install
interactive
install when responding yes to prompt without --install:
AssertionError: expected false to be true
+ expected - actual
-false
+true
at Context.<anonymous> (test\install.test.ts:118:76)
3) install
interactive
install with --install always:
AssertionError: expected false to be true
+ expected - actual
-false
+true
at Context.<anonymous> (test\install.test.ts:184:76)
Expected Behavior
I expect the tests to pass.
I think the issue is probably because I am on Windows.
Context: I am trying to do a pull request, but before I can do that, I don't want to change anything before the actual tests are passing.
Metadata
Metadata
Assignees
Labels
No labels