Skip to content

Commit

Permalink
test(cli): makes integration test case easier to manually veriry
Browse files Browse the repository at this point in the history
  • Loading branch information
sverweij committed Dec 9, 2023
1 parent 709e520 commit a995d26
Show file tree
Hide file tree
Showing 10 changed files with 132 additions and 63 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import aap from "../../libs/aap";

console.log(aap);
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import subPathImport from "#mies/index.js";

console.log(subPathImport);
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import tsConfigBasePath from "libs/wim";

console.log(tsConfigBasePath);
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import tsConfigPathStar from "@modules/zus/index.js";

console.log(tsConfigPathStar);
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import tsConfigPath from "@sister";

console.log(tsConfigPath);
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import workspace from "noot/index.js";

console.log(workspace);

This file was deleted.

158 changes: 111 additions & 47 deletions test/cli/__fixtures__/workspaces-mono-repo-aliases/expected.json
Original file line number Diff line number Diff line change
@@ -1,46 +1,37 @@
{
"modules": [
{
"source": "apps/admin/typescript-though.ts",
"source": "apps/admin/direct-relative-import.ts",
"dependencies": [
{
"dynamic": false,
"module": "@schwester/index.js",
"module": "../../libs/aap",
"moduleSystem": "es6",
"exoticallyRequired": false,
"resolved": "libs/zus/index.js",
"coreModule": false,
"followable": true,
"couldNotResolve": false,
"dependencyTypes": [
"aliased",
"aliased-tsconfig",
"aliased-tsconfig-paths",
"local"
],
"matchesDoNotFollow": false,
"circular": false,
"valid": true
},
{
"dynamic": false,
"module": "@sister",
"moduleSystem": "es6",
"exoticallyRequired": false,
"resolved": "libs/zus/index.js",
"resolved": "libs/aap/index.js",
"coreModule": false,
"followable": true,
"couldNotResolve": false,
"dependencyTypes": [
"aliased",
"aliased-tsconfig",
"aliased-tsconfig-paths",
"local"
],
"dependencyTypes": ["local"],
"matchesDoNotFollow": false,
"circular": false,
"valid": true
},
}
],
"dependents": [],
"orphan": false,
"valid": true
},
{
"source": "libs/aap/index.js",
"dependencies": [],
"dependents": ["apps/admin/direct-relative-import.ts"],
"orphan": false,
"valid": true
},
{
"source": "apps/admin/from-subpath-import.ts",
"dependencies": [
{
"dynamic": false,
"module": "#mies/index.js",
Expand All @@ -54,13 +45,28 @@
"matchesDoNotFollow": false,
"circular": false,
"valid": true
},
}
],
"dependents": [],
"orphan": false,
"valid": true
},
{
"source": "libs/mies/index.js",
"dependencies": [],
"dependents": ["apps/admin/from-subpath-import.ts"],
"orphan": false,
"valid": true
},
{
"source": "apps/admin/from-tsconfig-base-url.ts",
"dependencies": [
{
"dynamic": false,
"module": "libs/aap",
"module": "libs/wim",
"moduleSystem": "es6",
"exoticallyRequired": false,
"resolved": "libs/aap/index.js",
"resolved": "libs/wim/index.js",
"coreModule": false,
"followable": true,
"couldNotResolve": false,
Expand All @@ -73,17 +79,37 @@
"matchesDoNotFollow": false,
"circular": false,
"valid": true
},
}
],
"dependents": [],
"orphan": false,
"valid": true
},
{
"source": "libs/wim/index.js",
"dependencies": [],
"dependents": ["apps/admin/from-tsconfig-base-url.ts"],
"orphan": false,
"valid": true
},
{
"source": "apps/admin/from-tsconfig-path-star.ts",
"dependencies": [
{
"dynamic": false,
"module": "noot/index.js",
"module": "@modules/zus/index.js",
"moduleSystem": "es6",
"exoticallyRequired": false,
"resolved": "libs/noot/index.js",
"resolved": "libs/zus/index.js",
"coreModule": false,
"followable": true,
"couldNotResolve": false,
"dependencyTypes": ["aliased", "aliased-workspace", "local"],
"dependencyTypes": [
"aliased",
"aliased-tsconfig",
"aliased-tsconfig-paths",
"local"
],
"matchesDoNotFollow": false,
"circular": false,
"valid": true
Expand All @@ -96,28 +122,66 @@
{
"source": "libs/zus/index.js",
"dependencies": [],
"dependents": ["apps/admin/typescript-though.ts"],
"dependents": [
"apps/admin/from-tsconfig-path-star.ts",
"apps/admin/from-tsconfig-path.ts"
],
"orphan": false,
"valid": true
},
{
"source": "libs/mies/index.js",
"dependencies": [],
"dependents": ["apps/admin/typescript-though.ts"],
"source": "apps/admin/from-tsconfig-path.ts",
"dependencies": [
{
"dynamic": false,
"module": "@sister",
"moduleSystem": "es6",
"exoticallyRequired": false,
"resolved": "libs/zus/index.js",
"coreModule": false,
"followable": true,
"couldNotResolve": false,
"dependencyTypes": [
"aliased",
"aliased-tsconfig",
"aliased-tsconfig-paths",
"local"
],
"matchesDoNotFollow": false,
"circular": false,
"valid": true
}
],
"dependents": [],
"orphan": false,
"valid": true
},
{
"source": "libs/aap/index.js",
"dependencies": [],
"dependents": ["apps/admin/typescript-though.ts"],
"source": "apps/admin/from-workspace.ts",
"dependencies": [
{
"dynamic": false,
"module": "noot/index.js",
"moduleSystem": "es6",
"exoticallyRequired": false,
"resolved": "libs/noot/index.js",
"coreModule": false,
"followable": true,
"couldNotResolve": false,
"dependencyTypes": ["aliased", "aliased-workspace", "local"],
"matchesDoNotFollow": false,
"circular": false,
"valid": true
}
],
"dependents": [],
"orphan": false,
"valid": true
},
{
"source": "libs/noot/index.js",
"dependencies": [],
"dependents": ["apps/admin/typescript-though.ts"],
"dependents": ["apps/admin/from-workspace.ts"],
"orphan": false,
"valid": true
}
Expand All @@ -128,8 +192,8 @@
"warn": 0,
"info": 0,
"ignore": 0,
"totalCruised": 5,
"totalDependenciesCruised": 5,
"totalCruised": 11,
"totalDependenciesCruised": 6,
"optionsUsed": {
"baseDir": ".",
"cache": false,
Expand All @@ -149,7 +213,7 @@
"fileName": "tsconfig.json"
},
"tsPreCompilationDeps": true,
"args": "apps/admin/typescript-though.ts"
"args": "apps/admin/"
},
"ruleSetUsed": {
"forbidden": []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"module": "commonjs",
"baseUrl": "./",
"paths": {
"@schwester/*": ["./libs/zus/*"],
"@modules/*": ["./libs/*"],
"@sister": ["./libs/zus/*"]
},
"noEmit": true,
Expand Down
4 changes: 2 additions & 2 deletions test/cli/index.spec.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { readFileSync, unlinkSync } from "node:fs";
import { doesNotThrow, equal, throws } from "node:assert/strict";
// path.posix instead of path because otherwise on win32 the resulting
// outputTo would contain \\ instead of / which for this unit test doesn't matter
import { doesNotThrow, equal, throws } from "node:assert/strict";
import { join, posix as path } from "node:path";
import chalk from "chalk";
import intercept from "intercept-stdout";
Expand Down Expand Up @@ -506,7 +506,7 @@ describe("[E] cli/index", () => {
const lOutputTo = path.join("../../__output__", lOutputFileName);
process.chdir("./test/cli/__fixtures__/workspaces-mono-repo-aliases");

const lExitCode = await cli(["apps/admin/typescript-though.ts"], {
const lExitCode = await cli(["apps/admin/"], {
config: ".dependency-cruiser.js",
outputType: "json",
outputTo: lOutputTo,
Expand Down

0 comments on commit a995d26

Please sign in to comment.