Differences from dependency-cruiser
The repository has a conformance task that compares Oxcruise with dependency-cruiser 18.7. This page explains what the task checks, the current result and the differences that are on purpose.
What the task does
Run just conformance (tasks/conformance/run.ts). For each target, the task:
- Generates a dependency-cruiser config and runs dependency-cruiser 18.7.0 with it.
- Runs
oxcruise --migrateon that config, to a.jsonfile, and then runsoxcruise -f jsonwith the migrated config. A script maps the output to the shape of dependency-cruiser. This tests the migration too. Fordepcruise-srcanddepcruise-tools, the script then replacesignorePatternsby hand, because theexcluderegexes of these targets do not convert to globs. The migration of these two targets is not fully tested.
Then it compares:
- the set of modules
- the set of dependencies (
from → resolved (specifier)) - the classification types of each dependency (
local,npm-dev,aliased-*,type-onlyand others) - the syntax types of each dependency (
import,require,dynamic-importand others) - the module system of each dependency
The task does not compare violations. The rule language of Oxcruise is much smaller.
migrate drops the rules that use conditions such as circular, orphan and dependencyTypes, with a warning.
The own tests of Oxcruise cover the behavior of the rules.
A difference that is not in tasks/conformance/deviations.json, with its reason, fails the run.
The targets are the test fixtures es6, cjs, amd, exotic-require, donotfollow and maxDepth of dependency-cruiser.
They also include its own src/ and tools/ with bin/ as real code.
Current result
All targets are conformant, with the documented differences below.
ok es6 modules 5/5 edges 3/3
ok cjs modules 36/36 edges 34/34
ok amd modules 24/25 edges 29/29 (+3 documented)
ok exotic-require modules 2/2 edges 1/1 (+1 documented)
ok donotfollow / max-depth-1
ok depcruise-src modules 229/271 edges 516/673 (+231 documented)
ok depcruise-tools modules 253/301 edges 592/727 (+215 documented)Intentional differences
- Dual ESM and CJS packages resolve by import syntax. The dependency exists in both tools. Only the file inside
node_modulesdiffers, for exampleacorn.mjsandacorn.js. - Merged syntax kinds.
importandexport … fromof the same module give[export, import]. dependency-cruiser keeps[import]. - AMD ids without
./do not resolve against a requirejsbaseUrlandpathsconfig. Oxcruise does not resolve the idsub/local-module-in-drag, but dependency-cruiser does. new URL(…, import.meta.url)dependencies are an addition of Oxcruise. Oxcruise always extracts them. The report lists them, and the modules that only they reach, asurl-dependency-only-in-oxcruise.- JSDoc imports are always extracted. dependency-cruiser detects them only with
detectJSDocImportsand an installedtypescript. The conformance run has notypescript, so they show asjsdoc-import-only-in-oxcruise. An import that is also a JSDoc import gets the extra kindsjsdocandtype-only. exoticRequireStringsis part ofcalls, with one kind:call. Oxcruise counts a function incallsas an ES import. The exception is a name that starts withrequire. dependency-cruiser treats every exotic require string as a CommonJS require. The report showsmodule-system-differs.
Found by the conformance run
The run found these problems. Each one now has a regression test.
- AMD
require([…])isamd-define, and notamd-require. - Oxcruise reported a cycle once for each dependency. It now reports a cycle once.
- A dependency in
dependencieswhose@types/*package was indevDependencieswasnpmandnpm-dev. This caused a falseduplicate-packagesviolation. - A package without
mainresolved toindex.d.tsand not toindex.js. new URL(".", import.meta.url)was a dependency on a directory.
Not covered
- The task skips the
ts,ts-typesandvuefixtures. dependency-cruiser needstypescriptand@vue/compiler-sfcto parse them, and the task does not install them. - Large real repositories, such as typescript-eslint and date-fns, were not run. This needs a clone and an install of third-party repositories.
- The task did not compare the migrated own config of dependency-cruiser (
.dependency-cruiser.mjs) with its own run. Most of its rules use conditions that Oxcruise drops on purpose.

