1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Try to fix tests on Windows again.

Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com>
This commit is contained in:
Panu Horsmalahti 2020-12-08 15:05:23 +02:00
parent 9bb72c4fa2
commit b8f1dcc848
2 changed files with 3 additions and 6 deletions

View File

@ -1,5 +1,5 @@
import { watch } from "chokidar";
import { join } from "path";
import { join, normalize } from "path";
import { ExtensionDiscovery, InstalledExtension } from "../extension-discovery";
jest.mock("../../common/ipc");
@ -46,13 +46,13 @@ describe("ExtensionDiscovery", () => {
extensionDiscovery.events.on("add", (extension: InstalledExtension) => {
expect(extension).toEqual({
absolutePath: expect.any(String),
id: "node_modules/my-extension/package.json",
id: normalize("node_modules/my-extension/package.json"),
isBundled: false,
isEnabled: false,
manifest: {
name: "my-extension",
},
manifestPath: "node_modules/my-extension/package.json",
manifestPath: normalize("node_modules/my-extension/package.json"),
});
done();
});

View File

@ -156,7 +156,6 @@ export class ExtensionDiscovery {
}
handleWatchFileAdd = async (filePath: string) => {
logger.info(`${logModule} handleWatchFileAdd ${filePath}`);
// e.g. "foo/package.json"
const relativePath = path.relative(this.localFolderPath, filePath);
@ -165,8 +164,6 @@ export class ExtensionDiscovery {
// This safeguards against a file watch being triggered under a sub-directory which is not an extension.
const isUnderLocalFolderPath = relativePath.split(path.sep).length === 2;
logger.info(`${logModule} relativePath ${relativePath} isUnderLocalFolderPath ${isUnderLocalFolderPath}`);
if (path.basename(filePath) === manifestFilename && isUnderLocalFolderPath) {
try {
const absPath = path.dirname(filePath);