From fcdc7ecee1b36800b21f79919163fd31421aa463 Mon Sep 17 00:00:00 2001 From: Glenn Eggleton Date: Wed, 14 Sep 2022 11:20:56 -0400 Subject: [PATCH 1/2] fix import statement, add jetbrains gitignore --- .gitignore | 2 ++ src/RemoteFileAPI/MessageHandlers.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 84671db69..7ffbc4168 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,5 @@ Netburner.txt # editor files .vscode + +.idea/ diff --git a/src/RemoteFileAPI/MessageHandlers.ts b/src/RemoteFileAPI/MessageHandlers.ts index a9e3dc3fc..091ba340c 100644 --- a/src/RemoteFileAPI/MessageHandlers.ts +++ b/src/RemoteFileAPI/MessageHandlers.ts @@ -13,7 +13,7 @@ import { isFileData, } from "./MessageDefinitions"; -import libSource from "!!raw-loader!../ScriptEditor/NetscriptDefinitions.d.ts"; +import libSource from "../ScriptEditor/NetscriptDefinitions.d.ts"; function error(errorMsg: string, { id }: RFAMessage): RFAMessage { return new RFAMessage({ error: errorMsg, id: id }); From 19ad9be8aad9aa2b164f01ae5ced07fed33fcbd3 Mon Sep 17 00:00:00 2001 From: Glenn Eggleton Date: Wed, 14 Sep 2022 13:05:55 -0400 Subject: [PATCH 2/2] add raw-loader to jest config --- jest.config.js | 1 + src/RemoteFileAPI/MessageHandlers.ts | 2 +- test/__mocks__/rawLoader.js | 0 3 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 test/__mocks__/rawLoader.js diff --git a/jest.config.js b/jest.config.js index 22f371dcd..25c9858c2 100644 --- a/jest.config.js +++ b/jest.config.js @@ -9,5 +9,6 @@ module.exports = { "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "/test/__mocks__/fileMock.js", "\\.(css|less)$": "/test/__mocks__/styleMock.js", + "\\!!raw-loader!.*$": "/test/__mocks__/rawLoader.js", }, }; diff --git a/src/RemoteFileAPI/MessageHandlers.ts b/src/RemoteFileAPI/MessageHandlers.ts index 091ba340c..a9e3dc3fc 100644 --- a/src/RemoteFileAPI/MessageHandlers.ts +++ b/src/RemoteFileAPI/MessageHandlers.ts @@ -13,7 +13,7 @@ import { isFileData, } from "./MessageDefinitions"; -import libSource from "../ScriptEditor/NetscriptDefinitions.d.ts"; +import libSource from "!!raw-loader!../ScriptEditor/NetscriptDefinitions.d.ts"; function error(errorMsg: string, { id }: RFAMessage): RFAMessage { return new RFAMessage({ error: errorMsg, id: id }); diff --git a/test/__mocks__/rawLoader.js b/test/__mocks__/rawLoader.js new file mode 100644 index 000000000..e69de29bb