2021-05-14 02:25:30 +02:00
|
|
|
import TagSpec from "./Tag.spec";
|
|
|
|
import ImageAttributionSpec from "./ImageAttribution.spec";
|
|
|
|
import GeoOperationsSpec from "./GeoOperations.spec";
|
|
|
|
import ImageSearcherSpec from "./ImageSearcher.spec";
|
|
|
|
import ThemeSpec from "./Theme.spec";
|
|
|
|
import UtilsSpec from "./Utils.spec";
|
2021-06-28 18:06:54 +02:00
|
|
|
import OsmObjectSpec from "./OsmObject.spec";
|
|
|
|
import ScriptUtils from "../scripts/ScriptUtils";
|
2021-07-04 20:36:19 +02:00
|
|
|
import UnitsSpec from "./Units.spec";
|
2021-09-22 05:02:09 +02:00
|
|
|
import RelationSplitHandlerSpec from "./RelationSplitHandler.spec";
|
2021-06-28 18:06:54 +02:00
|
|
|
|
|
|
|
|
2021-05-14 02:25:30 +02:00
|
|
|
|
2021-06-28 18:06:54 +02:00
|
|
|
ScriptUtils.fixUtils()
|
2021-05-14 02:25:30 +02:00
|
|
|
const allTests = [
|
2021-06-28 18:06:54 +02:00
|
|
|
new OsmObjectSpec(),
|
2021-05-14 02:25:30 +02:00
|
|
|
new TagSpec(),
|
|
|
|
new ImageAttributionSpec(),
|
|
|
|
new GeoOperationsSpec(),
|
|
|
|
new ImageSearcherSpec(),
|
|
|
|
new ThemeSpec(),
|
2021-07-04 20:36:19 +02:00
|
|
|
new UtilsSpec(),
|
2021-09-22 05:02:09 +02:00
|
|
|
new UnitsSpec(),
|
|
|
|
new RelationSplitHandlerSpec()
|
2021-06-22 00:29:07 +02:00
|
|
|
]
|
2021-05-14 02:25:30 +02:00
|
|
|
|
2021-09-22 05:02:09 +02:00
|
|
|
let args = [...process.argv]
|
|
|
|
args.splice(0, 2)
|
|
|
|
args = args.map(a => a.toLowerCase())
|
|
|
|
|
|
|
|
const allFailures: { testsuite: string, name: string, msg: string } [] = []
|
|
|
|
let testsToRun = allTests
|
|
|
|
if (args.length > 0) {
|
|
|
|
testsToRun = allTests.filter(t => args.indexOf(t.name) >= 0)
|
|
|
|
}
|
|
|
|
|
|
|
|
if(testsToRun.length == 0){
|
|
|
|
throw "No tests found"
|
|
|
|
}
|
|
|
|
|
|
|
|
for (let i = 0; i < testsToRun.length; i++){
|
|
|
|
const test = testsToRun[i];
|
|
|
|
ScriptUtils.erasableLog(" Running test", i, "/", allTests.length)
|
|
|
|
allFailures.push(...(test.Run() ?? []))
|
2021-06-08 16:52:31 +02:00
|
|
|
|
2021-09-22 05:02:09 +02:00
|
|
|
}
|
|
|
|
if (allFailures.length > 0) {
|
|
|
|
for (const failure of allFailures) {
|
|
|
|
console.error(" !! " + failure.testsuite + "." + failure.name + " failed due to: " + failure.msg)
|
2021-05-14 02:25:30 +02:00
|
|
|
}
|
2021-09-22 05:02:09 +02:00
|
|
|
throw "Some test failed"
|
|
|
|
}
|
|
|
|
console.log("All tests successful: ", allTests.map(t => t.name).join(", "))
|