From 8e119b2b5b55b17b56dda504591c9575fda7bb0b Mon Sep 17 00:00:00 2001 From: Martin Fournier Date: Tue, 25 Jan 2022 16:24:09 -0500 Subject: [PATCH] Move cypress & netscript tests to ./test subfolder --- .eslintignore | 19 ++++++------ cypress.json | 12 +++++--- .../cypress}/integration/naviguation.spec.ts | 0 .../cypress}/integration/netscript.spec.ts | 0 .../cypress}/integration/tutorial.spec.ts | 0 {cypress => test/cypress}/plugins/index.js | 0 {cypress => test/cypress}/support/commands.ts | 0 .../cypress}/support/globalHooks.ts | 0 {cypress => test/cypress}/support/index.js | 0 .../Netscript/DynamicRamCalculation.test.js | 14 ++++----- .../Netscript/StaticRamCalculation.test.js | 6 ++-- test/{ => jest}/README.md | 0 test/{ => jest}/Script/Script.test.ts | 6 ++-- test/{ => jest}/StockMarket.test.ts | 30 +++++++++---------- test/{ => jest}/StringHelperFunctions.test.ts | 2 +- test/{ => jest}/Terminal/Directory.test.js | 2 +- ...neAllPossibilitiesForTabCompletion.test.ts | 12 ++++---- .../netscript}/tb_basic.script | 0 .../netscript}/tb_foo.script | 0 .../netscript}/tb_functions.script | 0 .../netscript}/tb_multiarray.script | 0 .../netscript}/tb_ports.script | 0 .../netscript}/tb_remote.script | 0 .../netscript}/tb_start.script | 0 24 files changed, 53 insertions(+), 50 deletions(-) rename {cypress => test/cypress}/integration/naviguation.spec.ts (100%) rename {cypress => test/cypress}/integration/netscript.spec.ts (100%) rename {cypress => test/cypress}/integration/tutorial.spec.ts (100%) rename {cypress => test/cypress}/plugins/index.js (100%) rename {cypress => test/cypress}/support/commands.ts (100%) rename {cypress => test/cypress}/support/globalHooks.ts (100%) rename {cypress => test/cypress}/support/index.js (100%) rename test/{ => jest}/Netscript/DynamicRamCalculation.test.js (98%) rename test/{ => jest}/Netscript/StaticRamCalculation.test.js (99%) rename test/{ => jest}/README.md (100%) rename test/{ => jest}/Script/Script.test.ts (88%) rename test/{ => jest}/StockMarket.test.ts (98%) rename test/{ => jest}/StringHelperFunctions.test.ts (92%) rename test/{ => jest}/Terminal/Directory.test.js (99%) rename test/{ => jest}/Terminal/determineAllPossibilitiesForTabCompletion.test.ts (94%) rename {netscript_tests => test/netscript}/tb_basic.script (100%) rename {netscript_tests => test/netscript}/tb_foo.script (100%) rename {netscript_tests => test/netscript}/tb_functions.script (100%) rename {netscript_tests => test/netscript}/tb_multiarray.script (100%) rename {netscript_tests => test/netscript}/tb_ports.script (100%) rename {netscript_tests => test/netscript}/tb_remote.script (100%) rename {netscript_tests => test/netscript}/tb_start.script (100%) diff --git a/.eslintignore b/.eslintignore index 716b1faae..9f6599e8c 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,27 +1,26 @@ node_modules/ -dist/ -input/ .dist .tmp .package - -assets/ -css/ +.build .cypress/ -cypress/ + +dist/ +input/ +assets/ doc/ markdown/ -netscript_tests/ -tools/engines-check/ + + +test/netscript/ electron/lib electron/greenworks.js src/ThirdParty/* src/JSInterpreter.js +tools/engines-check/ -test/*.bundle.* editor.main.js main.bundle.js webpack.config.js -webpack.config-test.js diff --git a/cypress.json b/cypress.json index 97707ced4..269aac154 100644 --- a/cypress.json +++ b/cypress.json @@ -1,10 +1,14 @@ { "baseUrl": "http://localhost:8000", - "fixturesFolder": false, "trashAssetsBeforeRuns": true, - "screenshotsFolder": ".cypress/screenshots", - "videosFolder": ".cypress/videos", "videoUploadOnPasses": false, "viewportWidth": 1980, - "viewportHeight": 1080 + "viewportHeight": 1080, + "fixturesFolder": "test/cypress/fixtures", + "integrationFolder": "test/cypress/integration", + "pluginsFile": "test/cypress/plugins/index.js", + "supportFile": "test/cypress/support/index.js", + "screenshotsFolder": ".cypress/screenshots", + "videosFolder": ".cypress/videos", + "downloadsFolder": ".cypress/downloads" } diff --git a/cypress/integration/naviguation.spec.ts b/test/cypress/integration/naviguation.spec.ts similarity index 100% rename from cypress/integration/naviguation.spec.ts rename to test/cypress/integration/naviguation.spec.ts diff --git a/cypress/integration/netscript.spec.ts b/test/cypress/integration/netscript.spec.ts similarity index 100% rename from cypress/integration/netscript.spec.ts rename to test/cypress/integration/netscript.spec.ts diff --git a/cypress/integration/tutorial.spec.ts b/test/cypress/integration/tutorial.spec.ts similarity index 100% rename from cypress/integration/tutorial.spec.ts rename to test/cypress/integration/tutorial.spec.ts diff --git a/cypress/plugins/index.js b/test/cypress/plugins/index.js similarity index 100% rename from cypress/plugins/index.js rename to test/cypress/plugins/index.js diff --git a/cypress/support/commands.ts b/test/cypress/support/commands.ts similarity index 100% rename from cypress/support/commands.ts rename to test/cypress/support/commands.ts diff --git a/cypress/support/globalHooks.ts b/test/cypress/support/globalHooks.ts similarity index 100% rename from cypress/support/globalHooks.ts rename to test/cypress/support/globalHooks.ts diff --git a/cypress/support/index.js b/test/cypress/support/index.js similarity index 100% rename from cypress/support/index.js rename to test/cypress/support/index.js diff --git a/test/Netscript/DynamicRamCalculation.test.js b/test/jest/Netscript/DynamicRamCalculation.test.js similarity index 98% rename from test/Netscript/DynamicRamCalculation.test.js rename to test/jest/Netscript/DynamicRamCalculation.test.js index 1a926ee37..55f69203d 100644 --- a/test/Netscript/DynamicRamCalculation.test.js +++ b/test/jest/Netscript/DynamicRamCalculation.test.js @@ -1,13 +1,13 @@ // eslint-disable-next-line @typescript-eslint/no-unused-vars import { jest, describe, expect, test } from "@jest/globals"; -import { Player } from "../../src/Player"; -import { NetscriptFunctions } from "../../src/NetscriptFunctions"; -import { getRamCost, RamCostConstants } from "../../src/Netscript/RamCostGenerator"; -import { Environment } from "../../src/Netscript/Environment"; -import { RunningScript } from "../../src/Script/RunningScript"; -import { Script } from "../../src/Script/Script"; -import { SourceFileFlags } from "../../src/SourceFile/SourceFileFlags"; +import { Player } from "../../../src/Player"; +import { NetscriptFunctions } from "../../../src/NetscriptFunctions"; +import { getRamCost, RamCostConstants } from "../../../src/Netscript/RamCostGenerator"; +import { Environment } from "../../../src/Netscript/Environment"; +import { RunningScript } from "../../../src/Script/RunningScript"; +import { Script } from "../../../src/Script/Script"; +import { SourceFileFlags } from "../../../src/SourceFile/SourceFileFlags"; jest.mock(`!!raw-loader!../NetscriptDefinitions.d.ts`, () => "", { virtual: true, diff --git a/test/Netscript/StaticRamCalculation.test.js b/test/jest/Netscript/StaticRamCalculation.test.js similarity index 99% rename from test/Netscript/StaticRamCalculation.test.js rename to test/jest/Netscript/StaticRamCalculation.test.js index 31bff7e1c..4e615100e 100644 --- a/test/Netscript/StaticRamCalculation.test.js +++ b/test/jest/Netscript/StaticRamCalculation.test.js @@ -1,9 +1,9 @@ // eslint-disable-next-line @typescript-eslint/no-unused-vars import { jest, describe, expect } from "@jest/globals"; -import { Player } from "../../src/Player"; -import { getRamCost, RamCostConstants } from "../../src/Netscript/RamCostGenerator"; -import { calculateRamUsage } from "../../src/Script/RamCalculations"; +import { Player } from "../../../src/Player"; +import { getRamCost, RamCostConstants } from "../../../src/Netscript/RamCostGenerator"; +import { calculateRamUsage } from "../../../src/Script/RamCalculations"; jest.mock(`!!raw-loader!../NetscriptDefinitions.d.ts`, () => "", { virtual: true, diff --git a/test/README.md b/test/jest/README.md similarity index 100% rename from test/README.md rename to test/jest/README.md diff --git a/test/Script/Script.test.ts b/test/jest/Script/Script.test.ts similarity index 88% rename from test/Script/Script.test.ts rename to test/jest/Script/Script.test.ts index f0914d3c8..82c6d3b11 100644 --- a/test/Script/Script.test.ts +++ b/test/jest/Script/Script.test.ts @@ -1,8 +1,8 @@ // eslint-disable-next-line @typescript-eslint/no-unused-vars import { jest, describe, expect, test } from "@jest/globals"; -import { Script } from "../../src/Script/Script"; -import { Player } from "../../src/Player"; +import { Script } from "../../../src/Script/Script"; +import { Player } from "../../../src/Player"; jest.mock(`!!raw-loader!../NetscriptDefinitions.d.ts`, () => "", { virtual: true, @@ -26,4 +26,4 @@ describe("Validate Save Script Works", function () { expect(script.code).toEqual(code) expect(script.server).toEqual(server) }); -}); \ No newline at end of file +}); diff --git a/test/StockMarket.test.ts b/test/jest/StockMarket.test.ts similarity index 98% rename from test/StockMarket.test.ts rename to test/jest/StockMarket.test.ts index 92c2d720f..2abc16ea9 100644 --- a/test/StockMarket.test.ts +++ b/test/jest/StockMarket.test.ts @@ -1,25 +1,25 @@ // eslint-disable-next-line @typescript-eslint/no-unused-vars import { jest, describe, expect, test } from '@jest/globals' -import { CONSTANTS } from "../src/Constants"; -import { Player } from "../src/Player"; -import { IMap } from "../src/types"; +import { CONSTANTS } from "../../src/Constants"; +import { Player } from "../../src/Player"; +import { IMap } from "../../src/types"; -import { Company } from "../src/Company/Company"; -import { Server } from "../src/Server/Server"; +import { Company } from "../../src/Company/Company"; +import { Server } from "../../src/Server/Server"; -import { buyStock, sellStock, shortStock, sellShort } from "../src/StockMarket/BuyingAndSelling"; -import { IStockMarket } from "../src/StockMarket/IStockMarket"; -import { Order } from "../src/StockMarket/Order"; +import { buyStock, sellStock, shortStock, sellShort } from "../../src/StockMarket/BuyingAndSelling"; +import { IStockMarket } from "../../src/StockMarket/IStockMarket"; +import { Order } from "../../src/StockMarket/Order"; import { forecastForecastChangeFromCompanyWork, forecastForecastChangeFromHack, influenceStockThroughCompanyWork, influenceStockThroughServerGrow, influenceStockThroughServerHack, -} from "../src/StockMarket/PlayerInfluencing"; -import { processOrders, IProcessOrderRefs } from "../src/StockMarket/OrderProcessing"; -import { Stock, StockForecastInfluenceLimit } from "../src/StockMarket/Stock"; +} from "../../src/StockMarket/PlayerInfluencing"; +import { processOrders, IProcessOrderRefs } from "../../src/StockMarket/OrderProcessing"; +import { Stock, StockForecastInfluenceLimit } from "../../src/StockMarket/Stock"; import { cancelOrder, deleteStockMarket, @@ -29,15 +29,15 @@ import { processStockPrices, StockMarket, SymbolToStockMap, -} from "../src/StockMarket/StockMarket"; +} from "../../src/StockMarket/StockMarket"; import { forecastChangePerPriceMovement, getBuyTransactionCost, getSellTransactionGain, processTransactionForecastMovement, -} from "../src/StockMarket/StockMarketHelpers"; -import { OrderTypes } from "../src/StockMarket/data/OrderTypes"; -import { PositionTypes } from "../src/StockMarket/data/PositionTypes"; +} from "../../src/StockMarket/StockMarketHelpers"; +import { OrderTypes } from "../../src/StockMarket/data/OrderTypes"; +import { PositionTypes } from "../../src/StockMarket/data/PositionTypes"; jest.mock(`!!raw-loader!../NetscriptDefinitions.d.ts`, () => '', { virtual: true, diff --git a/test/StringHelperFunctions.test.ts b/test/jest/StringHelperFunctions.test.ts similarity index 92% rename from test/StringHelperFunctions.test.ts rename to test/jest/StringHelperFunctions.test.ts index 637963c6a..ee6d21dec 100644 --- a/test/StringHelperFunctions.test.ts +++ b/test/jest/StringHelperFunctions.test.ts @@ -1,6 +1,6 @@ // eslint-disable-next-line @typescript-eslint/no-unused-vars import { jest, describe, expect, test } from '@jest/globals' -import { convertTimeMsToTimeElapsedString } from "../src/utils/StringHelperFunctions"; +import { convertTimeMsToTimeElapsedString } from "../../src/utils/StringHelperFunctions"; describe("StringHelperFunctions Tests", function () { it("transforms strings", () => { diff --git a/test/Terminal/Directory.test.js b/test/jest/Terminal/Directory.test.js similarity index 99% rename from test/Terminal/Directory.test.js rename to test/jest/Terminal/Directory.test.js index a054be567..6ecc529bf 100644 --- a/test/Terminal/Directory.test.js +++ b/test/jest/Terminal/Directory.test.js @@ -1,6 +1,6 @@ // eslint-disable-next-line @typescript-eslint/no-unused-vars import { jest, describe, expect, test } from '@jest/globals' -import * as dirHelpers from "../../src/Terminal/DirectoryHelpers"; +import * as dirHelpers from "../../../src/Terminal/DirectoryHelpers"; describe("Terminal Directory Tests", function () { describe("removeLeadingSlash()", function () { diff --git a/test/Terminal/determineAllPossibilitiesForTabCompletion.test.ts b/test/jest/Terminal/determineAllPossibilitiesForTabCompletion.test.ts similarity index 94% rename from test/Terminal/determineAllPossibilitiesForTabCompletion.test.ts rename to test/jest/Terminal/determineAllPossibilitiesForTabCompletion.test.ts index 513d0809c..52da0ad7a 100644 --- a/test/Terminal/determineAllPossibilitiesForTabCompletion.test.ts +++ b/test/jest/Terminal/determineAllPossibilitiesForTabCompletion.test.ts @@ -2,12 +2,12 @@ // eslint-disable-next-line @typescript-eslint/no-unused-vars import { jest, describe, expect, test } from "@jest/globals"; -import { Player } from "../../src/Player"; -import { determineAllPossibilitiesForTabCompletion } from "../../src/Terminal/determineAllPossibilitiesForTabCompletion"; -import { Server } from "../../src/Server/Server"; -import { AddToAllServers, prestigeAllServers } from "../../src/Server/AllServers"; -import { LocationName } from "../../src/Locations/data/LocationNames"; -import { CodingContract } from "../../src/CodingContracts"; +import { Player } from "../../../src/Player"; +import { determineAllPossibilitiesForTabCompletion } from "../../../src/Terminal/determineAllPossibilitiesForTabCompletion"; +import { Server } from "../../../src/Server/Server"; +import { AddToAllServers, prestigeAllServers } from "../../../src/Server/AllServers"; +import { LocationName } from "../../../src/Locations/data/LocationNames"; +import { CodingContract } from "../../../src/CodingContracts"; jest.mock(`!!raw-loader!../NetscriptDefinitions.d.ts`, () => "", { virtual: true, diff --git a/netscript_tests/tb_basic.script b/test/netscript/tb_basic.script similarity index 100% rename from netscript_tests/tb_basic.script rename to test/netscript/tb_basic.script diff --git a/netscript_tests/tb_foo.script b/test/netscript/tb_foo.script similarity index 100% rename from netscript_tests/tb_foo.script rename to test/netscript/tb_foo.script diff --git a/netscript_tests/tb_functions.script b/test/netscript/tb_functions.script similarity index 100% rename from netscript_tests/tb_functions.script rename to test/netscript/tb_functions.script diff --git a/netscript_tests/tb_multiarray.script b/test/netscript/tb_multiarray.script similarity index 100% rename from netscript_tests/tb_multiarray.script rename to test/netscript/tb_multiarray.script diff --git a/netscript_tests/tb_ports.script b/test/netscript/tb_ports.script similarity index 100% rename from netscript_tests/tb_ports.script rename to test/netscript/tb_ports.script diff --git a/netscript_tests/tb_remote.script b/test/netscript/tb_remote.script similarity index 100% rename from netscript_tests/tb_remote.script rename to test/netscript/tb_remote.script diff --git a/netscript_tests/tb_start.script b/test/netscript/tb_start.script similarity index 100% rename from netscript_tests/tb_start.script rename to test/netscript/tb_start.script