Try to fix tests on Windows again.

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

No files matched your search

@@ -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();
});
-3
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);