Skip to content

Commit

Permalink
fix(test): ensures that by default subpath imports are used for local…
Browse files Browse the repository at this point in the history
… imports
  • Loading branch information
sverweij committed Nov 9, 2023
1 parent 2e47fe9 commit 6dc0632
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
27 changes: 27 additions & 0 deletions .dependency-cruiser.json
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,33 @@
"reachable": false
}
},
{
"name": "test-to-src-with-subpaths-only",
"severity": "error",
"from": {
"pathNot": [
"^src/",
"^test/api\\.spec\\.mjs",
"^test/report/mermaid/mermaid\\.spec\\.mjs"
]
},
"to": {
"path": "^src/",
"dependencyTypesNot": ["aliased-subpath-import"]
}
},
{
"name": "src-to-other-sub-paths-with-subpath-imports-only",
"severity": "error",
"from": {
"path": "(^src/[^/]+/)"
},
"to": {
"path": "^src/",
"pathNot": "$1",
"dependencyTypesNot": ["aliased-subpath-import"]
}
},
{
"name": "not-unreachable-from-test",
"comment": "This module in src is not reachable by any test. Please provide a test that covers this (poor man's test coverage - this task is better suited for a proper test coverage tool :-) )",
Expand Down
2 changes: 1 addition & 1 deletion test/report/baseline/baseline.spec.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { deepEqual, equal } from "node:assert/strict";
import Ajv from "ajv";
import { createRequireJSON } from "../../backwards.utl.mjs";
import baselineSchema from "../../../src/schema/baseline-violations.schema.mjs";
import baselineSchema from "#schema/baseline-violations.schema.mjs";
import baseline from "#report/baseline.mjs";

const requireJSON = createRequireJSON(import.meta.url);
Expand Down
2 changes: 1 addition & 1 deletion test/utl/path-to-posix.spec.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { win32, posix } from "node:path";
import { equal } from "node:assert/strict";
import pathToPosix from "../../src/utl/path-to-posix.mjs";
import pathToPosix from "#utl/path-to-posix.mjs";

describe("[U] utl/pathToPosix on win32", () => {
it('transforms win32 style paths to posix ones: ""', () => {
Expand Down

0 comments on commit 6dc0632

Please sign in to comment.