Switch to doctest-ts-improved
This commit is contained in:
parent
9af6608f63
commit
676787eaf7
5 changed files with 84 additions and 603 deletions
|
@ -2,12 +2,6 @@ import {TagsFilter} from "./TagsFilter";
|
|||
import {Or} from "./Or";
|
||||
import {TagUtils} from "./TagUtils";
|
||||
|
||||
|
||||
// @ts-ignore
|
||||
import {Tag} from "./Tag";// needed for tests
|
||||
// @ts-ignore
|
||||
import {RegexTag} from "./RegexTag";// needed for tests
|
||||
|
||||
export class And extends TagsFilter {
|
||||
public and: TagsFilter[]
|
||||
constructor(and: TagsFilter[]) {
|
||||
|
@ -46,6 +40,10 @@ export class And extends TagsFilter {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* import {Tag} from "./Tag";
|
||||
* import {RegexTag} from "./RegexTag";
|
||||
*
|
||||
* const and = new And([new Tag("boundary","protected_area"), new RegexTag("protect_class","98",true)])
|
||||
* and.asOverpass() // => [ "[\"boundary\"=\"protected_area\"][\"protect_class\"!~\"^98$\"]" ]
|
||||
*/
|
||||
|
|
|
@ -2,10 +2,6 @@ import {TagsFilter} from "./TagsFilter";
|
|||
import {TagUtils} from "./TagUtils";
|
||||
import {And} from "./And";
|
||||
|
||||
// @ts-ignore
|
||||
import {Tag} from "./Tag";// needed for tests
|
||||
// @ts-ignore
|
||||
import {RegexTag} from "./RegexTag";// needed for tests
|
||||
|
||||
export class Or extends TagsFilter {
|
||||
public or: TagsFilter[]
|
||||
|
@ -26,6 +22,10 @@ export class Or extends TagsFilter {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* import {Tag} from "./Tag";
|
||||
* import {RegexTag} from "./RegexTag";
|
||||
*
|
||||
* const and = new And([new Tag("boundary","protected_area"), new RegexTag("protect_class","98",true)])
|
||||
* const or = new Or([and, new Tag("leisure", "nature_reserve"])
|
||||
* or.asOverpass() // => [ "[\"boundary\"=\"protected_area\"][\"protect_class\"!~\"^98$\"]", "[\"leisure\"=\"nature_reserve\"]" ]
|
||||
|
|
|
@ -100,7 +100,7 @@ class ValidateTheme extends DesugaringStep<LayoutConfigJson> {
|
|||
|
||||
if(Svg.All[image + ".svg"] !== undefined){
|
||||
// This is a builtin img, e.g. 'checkmark' or 'crosshair'
|
||||
continue;
|
||||
continue;// =>
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -250,8 +250,7 @@ export class DetectShadowedMappings extends DesugaringStep<QuestionableTagRender
|
|||
* DetectShadowedMappings.extractCalculatedTagNames({calculatedTags: ["_abc:=js()"]}) // => ["_abc"]
|
||||
* DetectShadowedMappings.extractCalculatedTagNames({calculatedTags: ["_abc=js()"]}) // => ["_abc"]
|
||||
*/
|
||||
public static extractCalculatedTagNames(layerConfig?: LayerConfigJson | {calculatedTags : string []}){
|
||||
// TODO make private again when doctests support this
|
||||
private static extractCalculatedTagNames(layerConfig?: LayerConfigJson | {calculatedTags : string []}){
|
||||
return layerConfig?.calculatedTags?.map(ct => {
|
||||
if(ct.indexOf(':=') >= 0){
|
||||
return ct.split(':=')[0]
|
||||
|
|
658
package-lock.json
generated
658
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -12,9 +12,9 @@
|
|||
"strttest": "export NODE_OPTIONS=--max_old_space_size=8364 && parcel serve test.html",
|
||||
"watch:css": "tailwindcss -i index.css -o css/index-tailwind-output.css --watch",
|
||||
"generate:css": "tailwindcss -i index.css -o css/index-tailwind-output.css",
|
||||
"generate:doctests": "doctest-ts --mocha Logic/**/*.ts && doctest-ts --mocha Logic/*.ts && doctest-ts --mocha UI/**/*.ts && doctest-ts --mocha UI/*.ts && doctest-ts --mocha *.ts && doctest-ts --mocha Models/**/*.ts && doctest-ts --mocha Models/ThemeConfig/**/*.ts && doctest-ts --mocha Models/*.ts",
|
||||
"generate:doctests": "doctest-ts-improved .",
|
||||
"test:run-only": "mocha --require ts-node/register --require tests/testhooks.ts \"./**/*.doctest.ts\" \"tests/*\" \"tests/**/*.ts\"",
|
||||
"test": "(npm run generate:doctests 2>&1 | grep -v \"No doctests found in\") && npm run test:run-only",
|
||||
"test": "(npm run generate:doctests 2>&1 | grep -v \"No doctests found in\") && npm run test:run-only && npm run clean:tests",
|
||||
"init": "npm ci && npm run generate && npm run generate:editor-layer-index && npm run generate:layouts && npm run clean",
|
||||
"add-weblate-upstream": "git remote add weblate-layers https://hosted.weblate.org/git/mapcomplete/layer-translations/ ; git remote add weblate-core https://hosted.weblate.org/git/mapcomplete/layer-core/; git remote add weblate-themes https://hosted.weblate.org/git/mapcomplete/layer-themes/; git remote add weblate-github git@github.com:weblate/MapComplete.git",
|
||||
"fix-weblate": "git remote update weblate-layers; git merge weblate-layers/master",
|
||||
|
@ -72,7 +72,7 @@
|
|||
"@types/wikidata-sdk": "^6.1.0",
|
||||
"@types/xml2js": "^0.4.9",
|
||||
"country-language": "^0.1.7",
|
||||
"doctest-ts": "^0.5.0",
|
||||
"doctest-ts-improved": "^0.8.4",
|
||||
"email-validator": "^2.0.4",
|
||||
"escape-html": "^1.0.3",
|
||||
"geojson2svg": "^1.3.1",
|
||||
|
|
Loading…
Reference in a new issue