Skip to content

Commit

Permalink
test: Corriger d'autres tests sous Windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
regseb committed Jan 4, 2024
1 parent ef727cb commit ead0d7f
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 10 deletions.
40 changes: 32 additions & 8 deletions test/unit/core/wrapper/depcheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/

import assert from "node:assert/strict";
import path from "node:path";
import process from "node:process";
import Levels from "../../../../src/core/levels.js";
import Severities from "../../../../src/core/severities.js";
Expand Down Expand Up @@ -121,20 +122,43 @@ describe("src/core/wrapper/depcheck.js", function () {
// Donc les chemins vers les fichiers du répertoire
// "node_module" n'ont pas les sous-répertoires de la sandbox.
// https://github.com/stryker-mutator/stryker-js/issues/3978
const nodeModules =
context.root.replace(/\/\.stryker\/tmp\/sandbox\d+/u, "") +
"/node_modules";
const nodeModules = path.join(
context.root.replace(
/[/\\]\.stryker[/\\]tmp[/\\]sandbox\d+/u,
"",
),
"node_modules",
);
assert.deepEqual(notices, [
{
file,
linter: "depcheck",
severity: Severities.FATAL,
message:
`Cannot find module '${context.root}/foo` +
`/package.json'\nRequire stack:\n- ${nodeModules}` +
`/depcheck/dist/utils/index.js\n- ${nodeModules}` +
`/depcheck/dist/check.js\n- ${nodeModules}` +
"/depcheck/dist/index.js",
"Cannot find module '" +
path.join(context.root, "foo", "package.json") +
"'\nRequire stack:\n- " +
path.join(
nodeModules,
"depcheck",
"dist",
"utils",
"index.js",
) +
"\n- " +
path.join(
nodeModules,
"depcheck",
"dist",
"check.js",
) +
"\n- " +
path.join(
nodeModules,
"depcheck",
"dist",
"index.js",
),
},
]);
});
Expand Down
9 changes: 7 additions & 2 deletions test/unit/core/wrapper/publint.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,14 @@ describe("src/core/wrapper/publint.js", function () {
});

it("should return FATAL notice", async function () {
const root = await createTempFileSystem({
"foo/package.json": "<version>1.0.0</version>",
});

const context = {
level: Levels.FATAL,
fix: false,
root: process.cwd(),
root,
files: ["foo/package.json"],
};
const options = {};
Expand All @@ -145,7 +149,8 @@ describe("src/core/wrapper/publint.js", function () {
linter: "publint",
severity: Severities.FATAL,
message:
"ENOENT: no such file or directory, scandir 'foo'",
"Unexpected token '<', \"<version>1\"... is not" +
" valid JSON",
},
]);
});
Expand Down

0 comments on commit ead0d7f

Please sign in to comment.