From 58aca7bc84134ef869c902e3f4909229b0849c77 Mon Sep 17 00:00:00 2001 From: Jonas Kello Date: Sat, 19 Oct 2019 22:51:38 +0200 Subject: [PATCH 01/21] Move files --- .../__test__}/data/property-filter-ast-parse.ts | 0 .../data/property-filter-is-syntax-valid.ts | 0 .../__test__}/data/property-filter-isvalid.ts | 0 .../src => src/__test__}/property-filter-ast.test.ts | 0 .../src => src/__test__}/property-filter.test.ts | 0 .../src => src/__test__}/property-value-set.test.ts | 0 .../src => src/__test__}/property-value.test.ts | 0 packages/property/test/tsconfig.json | 12 ------------ 8 files changed, 12 deletions(-) rename packages/property/{test/src => src/__test__}/data/property-filter-ast-parse.ts (100%) rename packages/property/{test/src => src/__test__}/data/property-filter-is-syntax-valid.ts (100%) rename packages/property/{test/src => src/__test__}/data/property-filter-isvalid.ts (100%) rename packages/property/{test/src => src/__test__}/property-filter-ast.test.ts (100%) rename packages/property/{test/src => src/__test__}/property-filter.test.ts (100%) rename packages/property/{test/src => src/__test__}/property-value-set.test.ts (100%) rename packages/property/{test/src => src/__test__}/property-value.test.ts (100%) delete mode 100644 packages/property/test/tsconfig.json diff --git a/packages/property/test/src/data/property-filter-ast-parse.ts b/packages/property/src/__test__/data/property-filter-ast-parse.ts similarity index 100% rename from packages/property/test/src/data/property-filter-ast-parse.ts rename to packages/property/src/__test__/data/property-filter-ast-parse.ts diff --git a/packages/property/test/src/data/property-filter-is-syntax-valid.ts b/packages/property/src/__test__/data/property-filter-is-syntax-valid.ts similarity index 100% rename from packages/property/test/src/data/property-filter-is-syntax-valid.ts rename to packages/property/src/__test__/data/property-filter-is-syntax-valid.ts diff --git a/packages/property/test/src/data/property-filter-isvalid.ts b/packages/property/src/__test__/data/property-filter-isvalid.ts similarity index 100% rename from packages/property/test/src/data/property-filter-isvalid.ts rename to packages/property/src/__test__/data/property-filter-isvalid.ts diff --git a/packages/property/test/src/property-filter-ast.test.ts b/packages/property/src/__test__/property-filter-ast.test.ts similarity index 100% rename from packages/property/test/src/property-filter-ast.test.ts rename to packages/property/src/__test__/property-filter-ast.test.ts diff --git a/packages/property/test/src/property-filter.test.ts b/packages/property/src/__test__/property-filter.test.ts similarity index 100% rename from packages/property/test/src/property-filter.test.ts rename to packages/property/src/__test__/property-filter.test.ts diff --git a/packages/property/test/src/property-value-set.test.ts b/packages/property/src/__test__/property-value-set.test.ts similarity index 100% rename from packages/property/test/src/property-value-set.test.ts rename to packages/property/src/__test__/property-value-set.test.ts diff --git a/packages/property/test/src/property-value.test.ts b/packages/property/src/__test__/property-value.test.ts similarity index 100% rename from packages/property/test/src/property-value.test.ts rename to packages/property/src/__test__/property-value.test.ts diff --git a/packages/property/test/tsconfig.json b/packages/property/test/tsconfig.json deleted file mode 100644 index b2d73cf2..00000000 --- a/packages/property/test/tsconfig.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": "../../tsconfig.settings.json", - "include": ["src"], - "compilerOptions": { - "outDir": "lib", - "rootDir": "src", - "lib": ["dom", "es2015", "es2017.object", "esnext.asynciterable"], - // If we do not specify this we get clashes in global types - "types": ["node", "jest"] - }, - "references": [{ "path": "../../property" }] -} From 93d791f3389aa897191ba5e0c5556587565ef92d Mon Sep 17 00:00:00 2001 From: Jonas Kello Date: Sat, 19 Oct 2019 23:55:53 +0200 Subject: [PATCH 02/21] Remove project --- .eslintrc.js | 1 - 1 file changed, 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index e302b451..2ff8ba61 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -4,7 +4,6 @@ module.exports = { project: [ "./packages/_stories/tsconfig.json", "./packages/property/tsconfig.json", - "./packages/property/test/tsconfig.json", "./packages/property-filter-pretty/tsconfig.json", "./packages/property-filter-pretty/test/tsconfig.json", "./packages/react-properties-selector/tsconfig.json", From 7a51d25837a651de85e85ffca22e28e3153c614f Mon Sep 17 00:00:00 2001 From: Jonas Kello Date: Sun, 20 Oct 2019 00:25:04 +0200 Subject: [PATCH 03/21] Fix build --- .../src/__test__/data/property-filter-ast-parse.ts | 2 +- .../property/src/__test__/data/property-filter-isvalid.ts | 4 ++-- .../property/src/__test__/property-filter-ast.test.ts | 8 +++----- packages/property/src/__test__/property-filter.test.ts | 3 ++- packages/property/src/__test__/property-value-set.test.ts | 3 ++- packages/property/src/__test__/property-value.test.ts | 2 +- packages/property/tsconfig.json | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/property/src/__test__/data/property-filter-ast-parse.ts b/packages/property/src/__test__/data/property-filter-ast-parse.ts index 1c55cc03..e701a362 100644 --- a/packages/property/src/__test__/data/property-filter-ast-parse.ts +++ b/packages/property/src/__test__/data/property-filter-ast-parse.ts @@ -1,4 +1,4 @@ -import { PropertyFilterAst } from "@promaster-sdk/property"; +import * as PropertyFilterAst from "../../property-filter-ast"; const { newIdentifierExpr, diff --git a/packages/property/src/__test__/data/property-filter-isvalid.ts b/packages/property/src/__test__/data/property-filter-isvalid.ts index db3e246a..4d59d2ae 100644 --- a/packages/property/src/__test__/data/property-filter-isvalid.ts +++ b/packages/property/src/__test__/data/property-filter-isvalid.ts @@ -1,6 +1,6 @@ import { Amount } from "uom"; -import { PropertyValue } from "@promaster-sdk/property"; -import { compareNumbers } from "@promaster-sdk/property/lib/utils/compare-utils"; +import * as PropertyValue from "../../property-value"; +import { compareNumbers } from "../../utils/compare-utils"; export const tests = [ { diff --git a/packages/property/src/__test__/property-filter-ast.test.ts b/packages/property/src/__test__/property-filter-ast.test.ts index c2f8e3f7..5858af8f 100644 --- a/packages/property/src/__test__/property-filter-ast.test.ts +++ b/packages/property/src/__test__/property-filter-ast.test.ts @@ -1,8 +1,6 @@ -import { - PropertyFilterAst as Ast, - PropertyValueSet, - PropertyValue -} from "@promaster-sdk/property"; +import * as Ast from "../property-filter-ast"; +import * as PropertyValueSet from "../property-value-set"; +import * as PropertyValue from "../property-value"; import * as ParseData from "./data/property-filter-ast-parse"; import * as IsValidData from "./data/property-filter-isvalid"; diff --git a/packages/property/src/__test__/property-filter.test.ts b/packages/property/src/__test__/property-filter.test.ts index 5286403c..464e1a61 100644 --- a/packages/property/src/__test__/property-filter.test.ts +++ b/packages/property/src/__test__/property-filter.test.ts @@ -1,4 +1,5 @@ -import { PropertyFilter, PropertyValueSet } from "@promaster-sdk/property"; +import * as PropertyFilter from "../property-filter"; +import * as PropertyValueSet from "../property-value-set"; import * as IsValidData from "./data/property-filter-isvalid"; import * as IsSyntaxValidData from "./data/property-filter-is-syntax-valid"; diff --git a/packages/property/src/__test__/property-value-set.test.ts b/packages/property/src/__test__/property-value-set.test.ts index cfb5acf3..f0bfd30d 100644 --- a/packages/property/src/__test__/property-value-set.test.ts +++ b/packages/property/src/__test__/property-value-set.test.ts @@ -1,5 +1,6 @@ -import { PropertyValueSet, PropertyValue } from "@promaster-sdk/property"; import { Units, Amount } from "uom"; +import * as PropertyValueSet from "../property-value-set"; +import * as PropertyValue from "../property-value"; describe("PropertyValueSet", () => { describe("getValue", () => { diff --git a/packages/property/src/__test__/property-value.test.ts b/packages/property/src/__test__/property-value.test.ts index 80dd2382..21847745 100644 --- a/packages/property/src/__test__/property-value.test.ts +++ b/packages/property/src/__test__/property-value.test.ts @@ -1,5 +1,5 @@ import { Units, Amount, Quantity } from "uom"; -import { PropertyValue } from "@promaster-sdk/property"; +import * as PropertyValue from "../property-value"; describe("PropertyValue", () => { it("should_parse_amount_with_decimal_dot", () => { diff --git a/packages/property/tsconfig.json b/packages/property/tsconfig.json index f1c150ec..59be3aba 100644 --- a/packages/property/tsconfig.json +++ b/packages/property/tsconfig.json @@ -6,7 +6,7 @@ "rootDir": "src", "lib": ["dom", "es2015", "es2017.object", "esnext.asynciterable"], // If we do not specify this we get clashes in global types - "types": ["node"] + "types": ["node", "jest"] }, "references": [] } From 1b91bc8c7199d734f413d7934a9a96b9044858ef Mon Sep 17 00:00:00 2001 From: Jonas Kello Date: Sun, 20 Oct 2019 00:48:41 +0200 Subject: [PATCH 04/21] Move tests --- .eslintrc.js | 3 +-- packages/property/tsconfig.json | 1 - .../{test/src => src/__test__}/functions.test.ts | 4 ++-- .../{test => src/__test__}/test-data/cfc.json | 3 +-- .../{test => src/__test__}/test-data/cfc_mini.json | 0 packages/variant-listing/test/tsconfig.json | 11 ----------- packages/variant-listing/tsconfig.json | 2 +- 7 files changed, 5 insertions(+), 19 deletions(-) rename packages/variant-listing/{test/src => src/__test__}/functions.test.ts (97%) rename packages/variant-listing/{test => src/__test__}/test-data/cfc.json (98%) rename packages/variant-listing/{test => src/__test__}/test-data/cfc_mini.json (100%) delete mode 100644 packages/variant-listing/test/tsconfig.json diff --git a/.eslintrc.js b/.eslintrc.js index 2ff8ba61..6bdbae64 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -10,8 +10,7 @@ module.exports = { "./packages/react-properties-selector/test/tsconfig.json", "./packages/react-property-selectors/tsconfig.json", "./packages/react-property-selectors/test/tsconfig.json", - "./packages/variant-listing/tsconfig.json", - "./packages/variant-listing/test/tsconfig.json" + "./packages/variant-listing/tsconfig.json" ] }, rules: { diff --git a/packages/property/tsconfig.json b/packages/property/tsconfig.json index 59be3aba..54f6aa28 100644 --- a/packages/property/tsconfig.json +++ b/packages/property/tsconfig.json @@ -5,7 +5,6 @@ "outDir": "lib", "rootDir": "src", "lib": ["dom", "es2015", "es2017.object", "esnext.asynciterable"], - // If we do not specify this we get clashes in global types "types": ["node", "jest"] }, "references": [] diff --git a/packages/variant-listing/test/src/functions.test.ts b/packages/variant-listing/src/__test__/functions.test.ts similarity index 97% rename from packages/variant-listing/test/src/functions.test.ts rename to packages/variant-listing/src/__test__/functions.test.ts index dec740a6..4695a68a 100644 --- a/packages/variant-listing/test/src/functions.test.ts +++ b/packages/variant-listing/src/__test__/functions.test.ts @@ -1,8 +1,8 @@ -import { buildAllPropertyValueSetsExtended } from "@promaster-sdk/variant-listing"; import * as fs from "fs"; import * as Path from "path"; -import { PropertyFilter } from "@promaster-sdk/property"; import * as R from "ramda"; +import { PropertyFilter } from "@promaster-sdk/property"; +import { buildAllPropertyValueSetsExtended } from "../functions"; describe("buildAllPropertyValueSets", () => { it(`should work with CFC`, () => { diff --git a/packages/variant-listing/test/test-data/cfc.json b/packages/variant-listing/src/__test__/test-data/cfc.json similarity index 98% rename from packages/variant-listing/test/test-data/cfc.json rename to packages/variant-listing/src/__test__/test-data/cfc.json index 455dfa58..0cec4053 100644 --- a/packages/variant-listing/test/test-data/cfc.json +++ b/packages/variant-listing/src/__test__/test-data/cfc.json @@ -344,8 +344,7 @@ "type": "integer", "value": 200 }, - "property_filter": - "design_type=1,2,3&filter_dimension=2,4,6,8,10|design_type=3&filter_dimension=5|design_type=5&filter_dimension=13", + "property_filter": "design_type=1,2,3&filter_dimension=2,4,6,8,10|design_type=3&filter_dimension=5|design_type=5&filter_dimension=13", "description": "200" }, { diff --git a/packages/variant-listing/test/test-data/cfc_mini.json b/packages/variant-listing/src/__test__/test-data/cfc_mini.json similarity index 100% rename from packages/variant-listing/test/test-data/cfc_mini.json rename to packages/variant-listing/src/__test__/test-data/cfc_mini.json diff --git a/packages/variant-listing/test/tsconfig.json b/packages/variant-listing/test/tsconfig.json deleted file mode 100644 index 04d1cecf..00000000 --- a/packages/variant-listing/test/tsconfig.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "extends": "../../tsconfig.settings.json", - "include": ["src"], - "compilerOptions": { - "outDir": "lib", - "rootDir": "src", - "lib": ["dom", "es2015", "es2017.object", "esnext.asynciterable"], - "types": ["node", "jest"] - }, - "references": [{ "path": "../../variant-listing" }] -} diff --git a/packages/variant-listing/tsconfig.json b/packages/variant-listing/tsconfig.json index b3b8e8e7..69abbe98 100644 --- a/packages/variant-listing/tsconfig.json +++ b/packages/variant-listing/tsconfig.json @@ -5,7 +5,7 @@ "outDir": "lib", "rootDir": "src", "lib": ["dom", "es2015", "es2017.object", "esnext.asynciterable"], - "types": ["node"] + "types": ["node", "jest"] }, "references": [{ "path": "../property" }] } From a4358d23879185deb37e1132e798facf86bd0547 Mon Sep 17 00:00:00 2001 From: Jonas Kello Date: Sun, 20 Oct 2019 01:00:40 +0200 Subject: [PATCH 05/21] Move test --- .eslintrc.js | 1 - .../src => src/__test__}/pretty-printing.test.ts | 2 +- packages/property-filter-pretty/test/jest.config.js | 3 --- packages/property-filter-pretty/test/tsconfig.json | 11 ----------- packages/property-filter-pretty/tsconfig.json | 2 +- .../variant-listing/src/__test__/functions.test.ts | 6 +++++- 6 files changed, 7 insertions(+), 18 deletions(-) rename packages/property-filter-pretty/{test/src => src/__test__}/pretty-printing.test.ts (98%) delete mode 100644 packages/property-filter-pretty/test/jest.config.js delete mode 100644 packages/property-filter-pretty/test/tsconfig.json diff --git a/.eslintrc.js b/.eslintrc.js index 6bdbae64..90015bee 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -5,7 +5,6 @@ module.exports = { "./packages/_stories/tsconfig.json", "./packages/property/tsconfig.json", "./packages/property-filter-pretty/tsconfig.json", - "./packages/property-filter-pretty/test/tsconfig.json", "./packages/react-properties-selector/tsconfig.json", "./packages/react-properties-selector/test/tsconfig.json", "./packages/react-property-selectors/tsconfig.json", diff --git a/packages/property-filter-pretty/test/src/pretty-printing.test.ts b/packages/property-filter-pretty/src/__test__/pretty-printing.test.ts similarity index 98% rename from packages/property-filter-pretty/test/src/pretty-printing.test.ts rename to packages/property-filter-pretty/src/__test__/pretty-printing.test.ts index d1941c42..aade8bde 100644 --- a/packages/property-filter-pretty/test/src/pretty-printing.test.ts +++ b/packages/property-filter-pretty/src/__test__/pretty-printing.test.ts @@ -1,5 +1,5 @@ import { PropertyFilter } from "@promaster-sdk/property"; -import * as PrettyPrinting from "@promaster-sdk/property-filter-pretty"; +import * as PrettyPrinting from "../index"; describe("filterPrettyPrintSimple", () => { it("should print a must be 1", () => { diff --git a/packages/property-filter-pretty/test/jest.config.js b/packages/property-filter-pretty/test/jest.config.js deleted file mode 100644 index b26c36b2..00000000 --- a/packages/property-filter-pretty/test/jest.config.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - snapshotResolver: "../../../jest.snapshot.resolver.js" -}; diff --git a/packages/property-filter-pretty/test/tsconfig.json b/packages/property-filter-pretty/test/tsconfig.json deleted file mode 100644 index 2cc59ab2..00000000 --- a/packages/property-filter-pretty/test/tsconfig.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "extends": "../../tsconfig.settings.json", - "include": ["src"], - "compilerOptions": { - "outDir": "lib", - "rootDir": "src", - "lib": ["dom", "es2015", "es2017.object", "esnext.asynciterable"], - "types": ["node", "jest"] - }, - "references": [{ "path": "../../property-filter-pretty" }] -} diff --git a/packages/property-filter-pretty/tsconfig.json b/packages/property-filter-pretty/tsconfig.json index b3b8e8e7..69abbe98 100644 --- a/packages/property-filter-pretty/tsconfig.json +++ b/packages/property-filter-pretty/tsconfig.json @@ -5,7 +5,7 @@ "outDir": "lib", "rootDir": "src", "lib": ["dom", "es2015", "es2017.object", "esnext.asynciterable"], - "types": ["node"] + "types": ["node", "jest"] }, "references": [{ "path": "../property" }] } diff --git a/packages/variant-listing/src/__test__/functions.test.ts b/packages/variant-listing/src/__test__/functions.test.ts index 4695a68a..ae074431 100644 --- a/packages/variant-listing/src/__test__/functions.test.ts +++ b/packages/variant-listing/src/__test__/functions.test.ts @@ -7,7 +7,11 @@ import { buildAllPropertyValueSetsExtended } from "../functions"; describe("buildAllPropertyValueSets", () => { it(`should work with CFC`, () => { const cfcDataRaw = JSON.parse( - fs.readFileSync(Path.join(__dirname, "../test-data/cfc.json")).toString() + fs + .readFileSync( + Path.join(__dirname, "../../src/__test__/test-data/cfc.json") + ) + .toString() ); const explicitPropertyValueSet = R.map(item => { return { From cc846245f667200973180a997e4586fa52eaae45 Mon Sep 17 00:00:00 2001 From: Jonas Kello Date: Sun, 20 Oct 2019 01:03:52 +0200 Subject: [PATCH 06/21] Move tests --- .eslintrc.js | 1 - .../__test__}/properties-selector.test.tsx | 2 +- .../properties-selector.test.tsx.snap | 370 ------------------ .../test/tsconfig.json | 11 - .../react-properties-selector/tsconfig.json | 2 +- 5 files changed, 2 insertions(+), 384 deletions(-) rename packages/react-properties-selector/{test/src => src/__test__}/properties-selector.test.tsx (97%) delete mode 100644 packages/react-properties-selector/test/src/__snapshots__/properties-selector.test.tsx.snap delete mode 100644 packages/react-properties-selector/test/tsconfig.json diff --git a/.eslintrc.js b/.eslintrc.js index 90015bee..6047199f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -6,7 +6,6 @@ module.exports = { "./packages/property/tsconfig.json", "./packages/property-filter-pretty/tsconfig.json", "./packages/react-properties-selector/tsconfig.json", - "./packages/react-properties-selector/test/tsconfig.json", "./packages/react-property-selectors/tsconfig.json", "./packages/react-property-selectors/test/tsconfig.json", "./packages/variant-listing/tsconfig.json" diff --git a/packages/react-properties-selector/test/src/properties-selector.test.tsx b/packages/react-properties-selector/src/__test__/properties-selector.test.tsx similarity index 97% rename from packages/react-properties-selector/test/src/properties-selector.test.tsx rename to packages/react-properties-selector/src/__test__/properties-selector.test.tsx index 9dd6f229..0297bf85 100644 --- a/packages/react-properties-selector/test/src/properties-selector.test.tsx +++ b/packages/react-properties-selector/src/__test__/properties-selector.test.tsx @@ -1,11 +1,11 @@ import React from "react"; import * as renderer from "react-test-renderer"; -import * as PropertiesSelector from "@promaster-sdk/react-properties-selector"; import { PropertyFilter, PropertyValue, PropertyValueSet } from "@promaster-sdk/property"; +import * as PropertiesSelector from "../index"; test("Simple PropertiesSelector", () => { const productProperties = exampleProductProperties(); diff --git a/packages/react-properties-selector/test/src/__snapshots__/properties-selector.test.tsx.snap b/packages/react-properties-selector/test/src/__snapshots__/properties-selector.test.tsx.snap deleted file mode 100644 index cb328c93..00000000 --- a/packages/react-properties-selector/test/src/__snapshots__/properties-selector.test.tsx.snap +++ /dev/null @@ -1,370 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Simple PropertiesSelector 1`] = ` -
-
- - - - - - - - -
- - - - - - - - -
-
-
-
- - Group1 -
- - - - - - - - - - - - - - - - - - - -
- - - -
- - - -
- - -
-
- d_1 -
-
- d_2 -
-
- d_3 -
-
-
- - -
- -
- e_1 -
-
-
-
-
-
-`; diff --git a/packages/react-properties-selector/test/tsconfig.json b/packages/react-properties-selector/test/tsconfig.json deleted file mode 100644 index 85e9074d..00000000 --- a/packages/react-properties-selector/test/tsconfig.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "extends": "../../tsconfig.settings.json", - "include": ["src"], - "compilerOptions": { - "outDir": "lib", - "rootDir": "src", - "lib": ["dom", "es2015", "es2017.object", "esnext.asynciterable"], - "types": ["node", "jest"] - }, - "references": [{ "path": "../../react-properties-selector" }] -} diff --git a/packages/react-properties-selector/tsconfig.json b/packages/react-properties-selector/tsconfig.json index 9ab47051..a54bfcd6 100644 --- a/packages/react-properties-selector/tsconfig.json +++ b/packages/react-properties-selector/tsconfig.json @@ -5,7 +5,7 @@ "outDir": "lib", "rootDir": "src", "lib": ["dom", "es2015", "es2017.object", "esnext.asynciterable"], - "types": ["node"] + "types": ["node", "jest"] }, "references": [ { "path": "../property" }, From 4a84f966fa91f9565b94eb9ddddac1c7484ab158 Mon Sep 17 00:00:00 2001 From: Jonas Kello Date: Sun, 20 Oct 2019 01:05:37 +0200 Subject: [PATCH 07/21] Move tests --- .eslintrc.js | 1 - .../checkbox-property-selector.test.tsx | 2 +- .../checkbox-property-selector.test.tsx.snap | 35 ------------------- .../test/tsconfig.json | 11 ------ .../react-property-selectors/tsconfig.json | 2 +- 5 files changed, 2 insertions(+), 49 deletions(-) rename packages/react-property-selectors/{test/src => src/__test__}/checkbox-property-selector.test.tsx (96%) delete mode 100644 packages/react-property-selectors/test/src/__snapshots__/checkbox-property-selector.test.tsx.snap delete mode 100644 packages/react-property-selectors/test/tsconfig.json diff --git a/.eslintrc.js b/.eslintrc.js index 6047199f..cc652a15 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -7,7 +7,6 @@ module.exports = { "./packages/property-filter-pretty/tsconfig.json", "./packages/react-properties-selector/tsconfig.json", "./packages/react-property-selectors/tsconfig.json", - "./packages/react-property-selectors/test/tsconfig.json", "./packages/variant-listing/tsconfig.json" ] }, diff --git a/packages/react-property-selectors/test/src/checkbox-property-selector.test.tsx b/packages/react-property-selectors/src/__test__/checkbox-property-selector.test.tsx similarity index 96% rename from packages/react-property-selectors/test/src/checkbox-property-selector.test.tsx rename to packages/react-property-selectors/src/__test__/checkbox-property-selector.test.tsx index 6ec1af0f..de816765 100644 --- a/packages/react-property-selectors/test/src/checkbox-property-selector.test.tsx +++ b/packages/react-property-selectors/src/__test__/checkbox-property-selector.test.tsx @@ -8,7 +8,7 @@ import { import { createCheckboxPropertySelector, CheckboxPropertyValueItem -} from "@promaster-sdk/react-property-selectors"; +} from "../index"; const CheckboxPropertySelector = createCheckboxPropertySelector({}); diff --git a/packages/react-property-selectors/test/src/__snapshots__/checkbox-property-selector.test.tsx.snap b/packages/react-property-selectors/test/src/__snapshots__/checkbox-property-selector.test.tsx.snap deleted file mode 100644 index 32e14f5f..00000000 --- a/packages/react-property-selectors/test/src/__snapshots__/checkbox-property-selector.test.tsx.snap +++ /dev/null @@ -1,35 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Simple CheckboxPropertySelector 1`] = ` -
-
- checked (1) -
-
-
-`; diff --git a/packages/react-property-selectors/test/tsconfig.json b/packages/react-property-selectors/test/tsconfig.json deleted file mode 100644 index 8d2b3efd..00000000 --- a/packages/react-property-selectors/test/tsconfig.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "extends": "../../tsconfig.settings.json", - "include": ["src"], - "compilerOptions": { - "outDir": "lib", - "rootDir": "src", - "lib": ["dom", "es2015", "es2017.object", "esnext.asynciterable"], - "types": ["node", "jest"] - }, - "references": [{ "path": "../../react-property-selectors" }] -} diff --git a/packages/react-property-selectors/tsconfig.json b/packages/react-property-selectors/tsconfig.json index 6ec32987..bb828336 100644 --- a/packages/react-property-selectors/tsconfig.json +++ b/packages/react-property-selectors/tsconfig.json @@ -5,7 +5,7 @@ "outDir": "lib", "rootDir": "src", "lib": ["dom", "es2015", "es2017.object", "esnext.asynciterable"], - "types": ["node"] + "types": ["node", "jest"] }, "references": [ { "path": "../property" }, From 402ccbb0b5e5242d0bb946efd17878f3646a4302 Mon Sep 17 00:00:00 2001 From: Jonas Kello Date: Sun, 20 Oct 2019 01:06:22 +0200 Subject: [PATCH 08/21] Add snapshots --- .../properties-selector.test.tsx.snap | 370 ++++++++++++++++++ .../checkbox-property-selector.test.tsx.snap | 35 ++ 2 files changed, 405 insertions(+) create mode 100644 packages/react-properties-selector/src/__test__/__snapshots__/properties-selector.test.tsx.snap create mode 100644 packages/react-property-selectors/src/__test__/__snapshots__/checkbox-property-selector.test.tsx.snap diff --git a/packages/react-properties-selector/src/__test__/__snapshots__/properties-selector.test.tsx.snap b/packages/react-properties-selector/src/__test__/__snapshots__/properties-selector.test.tsx.snap new file mode 100644 index 00000000..cb328c93 --- /dev/null +++ b/packages/react-properties-selector/src/__test__/__snapshots__/properties-selector.test.tsx.snap @@ -0,0 +1,370 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Simple PropertiesSelector 1`] = ` +
+
+ + + + + + + + +
+ + + + + + + + +
+
+
+
+ + Group1 +
+ + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+ + +
+
+ d_1 +
+
+ d_2 +
+
+ d_3 +
+
+
+ + +
+ +
+ e_1 +
+
+
+
+
+
+`; diff --git a/packages/react-property-selectors/src/__test__/__snapshots__/checkbox-property-selector.test.tsx.snap b/packages/react-property-selectors/src/__test__/__snapshots__/checkbox-property-selector.test.tsx.snap new file mode 100644 index 00000000..32e14f5f --- /dev/null +++ b/packages/react-property-selectors/src/__test__/__snapshots__/checkbox-property-selector.test.tsx.snap @@ -0,0 +1,35 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Simple CheckboxPropertySelector 1`] = ` +
+
+ checked (1) +
+
+
+`; From a44774b74d065763eaf27a8acd9ae81cdc166756 Mon Sep 17 00:00:00 2001 From: Jonas Kello Date: Sun, 20 Oct 2019 01:19:48 +0200 Subject: [PATCH 09/21] Rename to tests --- .../src/{__test__ => __tests__}/pretty-printing.test.ts | 0 packages/property/.npmignore | 5 +++++ packages/property/package.json | 7 ------- .../data/property-filter-ast-parse.ts | 0 .../data/property-filter-is-syntax-valid.ts | 0 .../data/property-filter-isvalid.ts | 0 .../{__test__ => __tests__}/property-filter-ast.test.ts | 0 .../src/{__test__ => __tests__}/property-filter.test.ts | 0 .../src/{__test__ => __tests__}/property-value-set.test.ts | 0 .../src/{__test__ => __tests__}/property-value.test.ts | 0 .../__snapshots__/properties-selector.test.tsx.snap | 0 .../{__test__ => __tests__}/properties-selector.test.tsx | 0 .../__snapshots__/checkbox-property-selector.test.tsx.snap | 0 .../checkbox-property-selector.test.tsx | 0 .../src/{__test__ => __tests__}/functions.test.ts | 0 .../src/{__test__ => __tests__}/test-data/cfc.json | 0 .../src/{__test__ => __tests__}/test-data/cfc_mini.json | 0 17 files changed, 5 insertions(+), 7 deletions(-) rename packages/property-filter-pretty/src/{__test__ => __tests__}/pretty-printing.test.ts (100%) create mode 100644 packages/property/.npmignore rename packages/property/src/{__test__ => __tests__}/data/property-filter-ast-parse.ts (100%) rename packages/property/src/{__test__ => __tests__}/data/property-filter-is-syntax-valid.ts (100%) rename packages/property/src/{__test__ => __tests__}/data/property-filter-isvalid.ts (100%) rename packages/property/src/{__test__ => __tests__}/property-filter-ast.test.ts (100%) rename packages/property/src/{__test__ => __tests__}/property-filter.test.ts (100%) rename packages/property/src/{__test__ => __tests__}/property-value-set.test.ts (100%) rename packages/property/src/{__test__ => __tests__}/property-value.test.ts (100%) rename packages/react-properties-selector/src/{__test__ => __tests__}/__snapshots__/properties-selector.test.tsx.snap (100%) rename packages/react-properties-selector/src/{__test__ => __tests__}/properties-selector.test.tsx (100%) rename packages/react-property-selectors/src/{__test__ => __tests__}/__snapshots__/checkbox-property-selector.test.tsx.snap (100%) rename packages/react-property-selectors/src/{__test__ => __tests__}/checkbox-property-selector.test.tsx (100%) rename packages/variant-listing/src/{__test__ => __tests__}/functions.test.ts (100%) rename packages/variant-listing/src/{__test__ => __tests__}/test-data/cfc.json (100%) rename packages/variant-listing/src/{__test__ => __tests__}/test-data/cfc_mini.json (100%) diff --git a/packages/property-filter-pretty/src/__test__/pretty-printing.test.ts b/packages/property-filter-pretty/src/__tests__/pretty-printing.test.ts similarity index 100% rename from packages/property-filter-pretty/src/__test__/pretty-printing.test.ts rename to packages/property-filter-pretty/src/__tests__/pretty-printing.test.ts diff --git a/packages/property/.npmignore b/packages/property/.npmignore new file mode 100644 index 00000000..3ee5d55b --- /dev/null +++ b/packages/property/.npmignore @@ -0,0 +1,5 @@ +**/__mocks__/** +**/__tests__/** +src +tsconfig.json +tsconfig.tsbuildinfo diff --git a/packages/property/package.json b/packages/property/package.json index 1222bce7..4efb9b85 100644 --- a/packages/property/package.json +++ b/packages/property/package.json @@ -20,13 +20,6 @@ "promaster", "promaster-sdk" ], - "files": [ - "/lib", - "package.json", - "CHANGELOG.md", - "LICENSE", - "README.md" - ], "dependencies": { "uom": "^2.3.0" } diff --git a/packages/property/src/__test__/data/property-filter-ast-parse.ts b/packages/property/src/__tests__/data/property-filter-ast-parse.ts similarity index 100% rename from packages/property/src/__test__/data/property-filter-ast-parse.ts rename to packages/property/src/__tests__/data/property-filter-ast-parse.ts diff --git a/packages/property/src/__test__/data/property-filter-is-syntax-valid.ts b/packages/property/src/__tests__/data/property-filter-is-syntax-valid.ts similarity index 100% rename from packages/property/src/__test__/data/property-filter-is-syntax-valid.ts rename to packages/property/src/__tests__/data/property-filter-is-syntax-valid.ts diff --git a/packages/property/src/__test__/data/property-filter-isvalid.ts b/packages/property/src/__tests__/data/property-filter-isvalid.ts similarity index 100% rename from packages/property/src/__test__/data/property-filter-isvalid.ts rename to packages/property/src/__tests__/data/property-filter-isvalid.ts diff --git a/packages/property/src/__test__/property-filter-ast.test.ts b/packages/property/src/__tests__/property-filter-ast.test.ts similarity index 100% rename from packages/property/src/__test__/property-filter-ast.test.ts rename to packages/property/src/__tests__/property-filter-ast.test.ts diff --git a/packages/property/src/__test__/property-filter.test.ts b/packages/property/src/__tests__/property-filter.test.ts similarity index 100% rename from packages/property/src/__test__/property-filter.test.ts rename to packages/property/src/__tests__/property-filter.test.ts diff --git a/packages/property/src/__test__/property-value-set.test.ts b/packages/property/src/__tests__/property-value-set.test.ts similarity index 100% rename from packages/property/src/__test__/property-value-set.test.ts rename to packages/property/src/__tests__/property-value-set.test.ts diff --git a/packages/property/src/__test__/property-value.test.ts b/packages/property/src/__tests__/property-value.test.ts similarity index 100% rename from packages/property/src/__test__/property-value.test.ts rename to packages/property/src/__tests__/property-value.test.ts diff --git a/packages/react-properties-selector/src/__test__/__snapshots__/properties-selector.test.tsx.snap b/packages/react-properties-selector/src/__tests__/__snapshots__/properties-selector.test.tsx.snap similarity index 100% rename from packages/react-properties-selector/src/__test__/__snapshots__/properties-selector.test.tsx.snap rename to packages/react-properties-selector/src/__tests__/__snapshots__/properties-selector.test.tsx.snap diff --git a/packages/react-properties-selector/src/__test__/properties-selector.test.tsx b/packages/react-properties-selector/src/__tests__/properties-selector.test.tsx similarity index 100% rename from packages/react-properties-selector/src/__test__/properties-selector.test.tsx rename to packages/react-properties-selector/src/__tests__/properties-selector.test.tsx diff --git a/packages/react-property-selectors/src/__test__/__snapshots__/checkbox-property-selector.test.tsx.snap b/packages/react-property-selectors/src/__tests__/__snapshots__/checkbox-property-selector.test.tsx.snap similarity index 100% rename from packages/react-property-selectors/src/__test__/__snapshots__/checkbox-property-selector.test.tsx.snap rename to packages/react-property-selectors/src/__tests__/__snapshots__/checkbox-property-selector.test.tsx.snap diff --git a/packages/react-property-selectors/src/__test__/checkbox-property-selector.test.tsx b/packages/react-property-selectors/src/__tests__/checkbox-property-selector.test.tsx similarity index 100% rename from packages/react-property-selectors/src/__test__/checkbox-property-selector.test.tsx rename to packages/react-property-selectors/src/__tests__/checkbox-property-selector.test.tsx diff --git a/packages/variant-listing/src/__test__/functions.test.ts b/packages/variant-listing/src/__tests__/functions.test.ts similarity index 100% rename from packages/variant-listing/src/__test__/functions.test.ts rename to packages/variant-listing/src/__tests__/functions.test.ts diff --git a/packages/variant-listing/src/__test__/test-data/cfc.json b/packages/variant-listing/src/__tests__/test-data/cfc.json similarity index 100% rename from packages/variant-listing/src/__test__/test-data/cfc.json rename to packages/variant-listing/src/__tests__/test-data/cfc.json diff --git a/packages/variant-listing/src/__test__/test-data/cfc_mini.json b/packages/variant-listing/src/__tests__/test-data/cfc_mini.json similarity index 100% rename from packages/variant-listing/src/__test__/test-data/cfc_mini.json rename to packages/variant-listing/src/__tests__/test-data/cfc_mini.json From c56fb678e9861c27e0decd8ee0af7402e3ebc7c1 Mon Sep 17 00:00:00 2001 From: Jonas Kello Date: Sun, 20 Oct 2019 01:22:44 +0200 Subject: [PATCH 10/21] Use .npmignore instead of files --- packages/property-filter-pretty/.npmignore | 5 +++++ packages/property-filter-pretty/package.json | 7 ------- packages/react-properties-selector/.npmignore | 5 +++++ packages/react-properties-selector/package.json | 7 ------- packages/react-property-selectors/.npmignore | 5 +++++ packages/react-property-selectors/package.json | 7 ------- packages/variant-listing/.npmignore | 5 +++++ packages/variant-listing/package.json | 7 ------- 8 files changed, 20 insertions(+), 28 deletions(-) create mode 100644 packages/property-filter-pretty/.npmignore create mode 100644 packages/react-properties-selector/.npmignore create mode 100644 packages/react-property-selectors/.npmignore create mode 100644 packages/variant-listing/.npmignore diff --git a/packages/property-filter-pretty/.npmignore b/packages/property-filter-pretty/.npmignore new file mode 100644 index 00000000..3ee5d55b --- /dev/null +++ b/packages/property-filter-pretty/.npmignore @@ -0,0 +1,5 @@ +**/__mocks__/** +**/__tests__/** +src +tsconfig.json +tsconfig.tsbuildinfo diff --git a/packages/property-filter-pretty/package.json b/packages/property-filter-pretty/package.json index 511c18c8..4b86f79f 100644 --- a/packages/property-filter-pretty/package.json +++ b/packages/property-filter-pretty/package.json @@ -20,13 +20,6 @@ "promaster", "promaster-sdk" ], - "files": [ - "/lib", - "package.json", - "CHANGELOG.md", - "LICENSE", - "README.md" - ], "dependencies": { "@promaster-sdk/property": "^2.4.0", "ts-exhaustive-check": "^1.0.0", diff --git a/packages/react-properties-selector/.npmignore b/packages/react-properties-selector/.npmignore new file mode 100644 index 00000000..3ee5d55b --- /dev/null +++ b/packages/react-properties-selector/.npmignore @@ -0,0 +1,5 @@ +**/__mocks__/** +**/__tests__/** +src +tsconfig.json +tsconfig.tsbuildinfo diff --git a/packages/react-properties-selector/package.json b/packages/react-properties-selector/package.json index a4850a60..886391ca 100644 --- a/packages/react-properties-selector/package.json +++ b/packages/react-properties-selector/package.json @@ -20,13 +20,6 @@ "promaster", "promaster-sdk" ], - "files": [ - "/lib", - "package.json", - "CHANGELOG.md", - "LICENSE", - "README.md" - ], "dependencies": { "@promaster-sdk/property": "^2.4.0", "@promaster-sdk/property-filter-pretty": "^2.5.0", diff --git a/packages/react-property-selectors/.npmignore b/packages/react-property-selectors/.npmignore new file mode 100644 index 00000000..3ee5d55b --- /dev/null +++ b/packages/react-property-selectors/.npmignore @@ -0,0 +1,5 @@ +**/__mocks__/** +**/__tests__/** +src +tsconfig.json +tsconfig.tsbuildinfo diff --git a/packages/react-property-selectors/package.json b/packages/react-property-selectors/package.json index 4a2dfc01..79a7c430 100644 --- a/packages/react-property-selectors/package.json +++ b/packages/react-property-selectors/package.json @@ -20,13 +20,6 @@ "promaster", "promaster-sdk" ], - "files": [ - "/lib", - "package.json", - "CHANGELOG.md", - "LICENSE", - "README.md" - ], "dependencies": { "@promaster-sdk/property": "^2.4.0", "@promaster-sdk/property-filter-pretty": "^2.5.0", diff --git a/packages/variant-listing/.npmignore b/packages/variant-listing/.npmignore new file mode 100644 index 00000000..3ee5d55b --- /dev/null +++ b/packages/variant-listing/.npmignore @@ -0,0 +1,5 @@ +**/__mocks__/** +**/__tests__/** +src +tsconfig.json +tsconfig.tsbuildinfo diff --git a/packages/variant-listing/package.json b/packages/variant-listing/package.json index 90808867..f78f9b26 100644 --- a/packages/variant-listing/package.json +++ b/packages/variant-listing/package.json @@ -20,13 +20,6 @@ "promaster", "promaster-sdk" ], - "files": [ - "/lib", - "package.json", - "CHANGELOG.md", - "LICENSE", - "README.md" - ], "dependencies": { "@promaster-sdk/property": "^2.4.0", "uom": "^2.3.0", From f219279338358a5e6dfa1b1cac5de442e2f7543a Mon Sep 17 00:00:00 2001 From: Jonas Kello Date: Sun, 20 Oct 2019 10:48:15 +0200 Subject: [PATCH 11/21] Run compiled tests --- jest.config.js | 12 ++++-------- package.json | 3 ++- packages/property/jest.config.js | 7 +++++++ .../variant-listing/src/__tests__/functions.test.ts | 2 +- 4 files changed, 14 insertions(+), 10 deletions(-) create mode 100644 packages/property/jest.config.js diff --git a/jest.config.js b/jest.config.js index a3b75356..46b1b81e 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,12 +1,8 @@ module.exports = { - projects: ["/packages/test/*"], - preset: "ts-jest", + // projects: ["/packages/*/lib/*"], coverageDirectory: "/coverage/", - collectCoverageFrom: ["/packages/*/src/**/*.{ts,tsx}"], + collectCoverageFrom: ["/packages/*/lib/**/*.{js,jsx}"], coverageReporters: ["text-summary", "lcov"], - globals: { - "ts-jest": { - tsConfig: "/packages/tsconfig.settings.json" - } - } + // Run only compiled tests (by default typescript files are matched) + testMatch: ["**/?(*.)+(spec|test).[j]s?(x)"] }; diff --git a/package.json b/package.json index 737375c7..24d4504d 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,8 @@ "storybook": "yarn build && run-p -l start storybook:start", "storybook:start": "start-storybook -p 6006", "build-storybook": "build-storybook", - "test": "jest", + "test": "run-s build test-all", + "test-all": "jest", "test:property": "jest --projects packages/property", "test:property-filter-pretty": "jest --projects packages/property-filter-pretty", "test:react-property-selectors": "jest --projects packages/react-property-selectors", diff --git a/packages/property/jest.config.js b/packages/property/jest.config.js new file mode 100644 index 00000000..9b7e28f8 --- /dev/null +++ b/packages/property/jest.config.js @@ -0,0 +1,7 @@ +module.exports = { + // coverageDirectory: "/coverage/", + // collectCoverageFrom: ["/packages/*/lib/**/*.{js,jsx}"], + // coverageReporters: ["text-summary", "lcov"] + // testMatch: ["**/__tests__/**/*.[jt]s?(x)", "**/?(*.)+(spec|test).[jt]s?(x)"] + testMatch: ["**/?(*.)+(spec|test).[j]s?(x)"] +}; diff --git a/packages/variant-listing/src/__tests__/functions.test.ts b/packages/variant-listing/src/__tests__/functions.test.ts index ae074431..e260774f 100644 --- a/packages/variant-listing/src/__tests__/functions.test.ts +++ b/packages/variant-listing/src/__tests__/functions.test.ts @@ -9,7 +9,7 @@ describe("buildAllPropertyValueSets", () => { const cfcDataRaw = JSON.parse( fs .readFileSync( - Path.join(__dirname, "../../src/__test__/test-data/cfc.json") + Path.join(__dirname, "../../src/__tests__/test-data/cfc.json") ) .toString() ); From ce3a55673735ac910ed15b1e5d8459c02c4acf74 Mon Sep 17 00:00:00 2001 From: Jonas Kello Date: Sun, 20 Oct 2019 11:03:25 +0200 Subject: [PATCH 12/21] Remove snapshots --- .../properties-selector.test.tsx.snap | 370 ------------------ .../checkbox-property-selector.test.tsx.snap | 35 -- 2 files changed, 405 deletions(-) delete mode 100644 packages/react-properties-selector/src/__tests__/__snapshots__/properties-selector.test.tsx.snap delete mode 100644 packages/react-property-selectors/src/__tests__/__snapshots__/checkbox-property-selector.test.tsx.snap diff --git a/packages/react-properties-selector/src/__tests__/__snapshots__/properties-selector.test.tsx.snap b/packages/react-properties-selector/src/__tests__/__snapshots__/properties-selector.test.tsx.snap deleted file mode 100644 index cb328c93..00000000 --- a/packages/react-properties-selector/src/__tests__/__snapshots__/properties-selector.test.tsx.snap +++ /dev/null @@ -1,370 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Simple PropertiesSelector 1`] = ` -
-
- - - - - - - - -
- - - - - - - - -
-
-
-
- - Group1 -
- - - - - - - - - - - - - - - - - - - -
- - - -
- - - -
- - -
-
- d_1 -
-
- d_2 -
-
- d_3 -
-
-
- - -
- -
- e_1 -
-
-
-
-
-
-`; diff --git a/packages/react-property-selectors/src/__tests__/__snapshots__/checkbox-property-selector.test.tsx.snap b/packages/react-property-selectors/src/__tests__/__snapshots__/checkbox-property-selector.test.tsx.snap deleted file mode 100644 index 32e14f5f..00000000 --- a/packages/react-property-selectors/src/__tests__/__snapshots__/checkbox-property-selector.test.tsx.snap +++ /dev/null @@ -1,35 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Simple CheckboxPropertySelector 1`] = ` -
-
- checked (1) -
-
-
-`; From dc4161f48ab627732096d5e1aa6c85ff9a1a0f9f Mon Sep 17 00:00:00 2001 From: Jonas Kello Date: Sun, 20 Oct 2019 11:37:21 +0200 Subject: [PATCH 13/21] Use snapshot resolver --- .eslintignore | 4 + jest-snapshot-resolver.js | 25 ++ jest.config.js | 3 +- .../properties-selector.test.js.snap | 370 ++++++++++++++++++ .../checkbox-property-selector.test.js.snap | 35 ++ 5 files changed, 436 insertions(+), 1 deletion(-) create mode 100644 jest-snapshot-resolver.js create mode 100644 packages/react-properties-selector/src/__snapshots__/properties-selector.test.js.snap create mode 100644 packages/react-property-selectors/src/__snapshots__/checkbox-property-selector.test.js.snap diff --git a/.eslintignore b/.eslintignore index cee89f3f..a0195512 100644 --- a/.eslintignore +++ b/.eslintignore @@ -5,3 +5,7 @@ node_modules/ # Don't lint build-output in test folders (test/lib) lib/ + +# Root files +jest-snapshot-resolver.js +jest.config.js diff --git a/jest-snapshot-resolver.js b/jest-snapshot-resolver.js new file mode 100644 index 00000000..102f7201 --- /dev/null +++ b/jest-snapshot-resolver.js @@ -0,0 +1,25 @@ +// We need this so that we can run the compiled tests in lib/ folder but +// have the snapshots written/read from the src/ folder so they can be +// checked into source control +module.exports = { + // resolves from test to snapshot path + resolveSnapshotPath: (testPath, snapshotExtension) => { + // console.log("testPath", testPath); + return ( + testPath.replace("/lib/", "/src/").replace("__tests__", "__snapshots__") + + snapshotExtension + ); + }, + + // resolves from snapshot to test path + resolveTestPath: (snapshotFilePath, snapshotExtension) => { + // console.log("snapshotFilePath", snapshotFilePath); + return snapshotFilePath + .replace("/src/", "/lib/") + .replace("__snapshots__", "__tests__") + .slice(0, -snapshotExtension.length); + }, + + // Example test path, used for preflight consistency check of the implementation above + testPathForConsistencyCheck: "some/__tests__/example.test.js" +}; diff --git a/jest.config.js b/jest.config.js index 46b1b81e..27d6b120 100644 --- a/jest.config.js +++ b/jest.config.js @@ -4,5 +4,6 @@ module.exports = { collectCoverageFrom: ["/packages/*/lib/**/*.{js,jsx}"], coverageReporters: ["text-summary", "lcov"], // Run only compiled tests (by default typescript files are matched) - testMatch: ["**/?(*.)+(spec|test).[j]s?(x)"] + testMatch: ["**/?(*.)+(spec|test).[j]s?(x)"], + snapshotResolver: "./jest-snapshot-resolver.js" }; diff --git a/packages/react-properties-selector/src/__snapshots__/properties-selector.test.js.snap b/packages/react-properties-selector/src/__snapshots__/properties-selector.test.js.snap new file mode 100644 index 00000000..cb328c93 --- /dev/null +++ b/packages/react-properties-selector/src/__snapshots__/properties-selector.test.js.snap @@ -0,0 +1,370 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Simple PropertiesSelector 1`] = ` +
+
+ + + + + + + + +
+ + + + + + + + +
+
+
+
+ + Group1 +
+ + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+ + +
+
+ d_1 +
+
+ d_2 +
+
+ d_3 +
+
+
+ + +
+ +
+ e_1 +
+
+
+
+
+
+`; diff --git a/packages/react-property-selectors/src/__snapshots__/checkbox-property-selector.test.js.snap b/packages/react-property-selectors/src/__snapshots__/checkbox-property-selector.test.js.snap new file mode 100644 index 00000000..32e14f5f --- /dev/null +++ b/packages/react-property-selectors/src/__snapshots__/checkbox-property-selector.test.js.snap @@ -0,0 +1,35 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Simple CheckboxPropertySelector 1`] = ` +
+
+ checked (1) +
+
+
+`; From 8c4eed68b71d64022efb3ad867fff04a1ed0923e Mon Sep 17 00:00:00 2001 From: Jonas Kello Date: Sun, 20 Oct 2019 11:40:21 +0200 Subject: [PATCH 14/21] Remove ts-jest since we don't use it anymore --- package.json | 1 - yarn.lock | 67 +++++++++++++--------------------------------------- 2 files changed, 16 insertions(+), 52 deletions(-) diff --git a/package.json b/package.json index 24d4504d..1d092a9d 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,6 @@ "react-scripts": "^2.1.8", "react-test-renderer": "^16.6.1", "shelljs": "^0.8.3", - "ts-jest": "^24.1.0", "ts-node": "^4.1.0", "typescript": "^3.6.4", "uglify-js": "^3.4.9", diff --git a/yarn.lock b/yarn.lock index d8630bd3..20ba6512 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3535,20 +3535,13 @@ browserslist@^4.0.0, browserslist@^4.3.4, browserslist@^4.3.5, browserslist@^4.4 electron-to-chromium "^1.3.113" node-releases "^1.1.8" -bs-logger@0.x: - version "0.2.6" - resolved "https://registry.yarnpkg.com/bs-logger/-/bs-logger-0.2.6.tgz#eb7d365307a72cf974cc6cda76b68354ad336bd8" - integrity sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog== - dependencies: - fast-json-stable-stringify "2.x" - bser@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/bser/-/bser-2.0.0.tgz#9ac78d3ed5d915804fd87acb158bc797147a1719" dependencies: node-int64 "^0.4.0" -buffer-from@1.x, buffer-from@^1.0.0: +buffer-from@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" @@ -6257,7 +6250,7 @@ fast-glob@^2.0.2: merge2 "^1.2.3" micromatch "^3.1.10" -fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.0.0: +fast-json-stable-stringify@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" @@ -9218,13 +9211,6 @@ json3@^3.3.2: version "3.3.2" resolved "https://registry.yarnpkg.com/json3/-/json3-3.3.2.tgz#3c0434743df93e2f5c42aee7b19bcb483575f4e1" -json5@2.x: - version "2.1.1" - resolved "https://registry.yarnpkg.com/json5/-/json5-2.1.1.tgz#81b6cb04e9ba496f1c7005d07b4368a2638f90b6" - integrity sha512-l+3HXD0GEI3huGq1njuqtzYK8OYJyXMkOLtQ53pjWh89tvWS2h6l+1zMkYWqlb57+SiQodKZyvMEFb2X+KrFhQ== - dependencies: - minimist "^1.2.0" - json5@^0.5.0, json5@^0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821" @@ -9630,7 +9616,7 @@ lodash.isplainobject@^4.0.6: version "4.0.6" resolved "https://registry.yarnpkg.com/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz#7c526a52d89b45c45cc690b88163be0497f550cb" -lodash.memoize@4.x, lodash.memoize@^4.1.2: +lodash.memoize@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" integrity sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4= @@ -9839,14 +9825,14 @@ make-dir@^2.0.0: pify "^4.0.1" semver "^5.6.0" -make-error@1.x, make-error@^1.3.5: - version "1.3.5" - resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.5.tgz#efe4e81f6db28cadd605c70f29c831b58ef776c8" - make-error@^1.1.1: version "1.3.3" resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.3.tgz#a97ae14ffd98b05f543e83ddc395e1b2b6e4cc6a" +make-error@^1.3.5: + version "1.3.5" + resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.5.tgz#efe4e81f6db28cadd605c70f29c831b58ef776c8" + makeerror@1.0.x: version "1.0.11" resolved "https://registry.yarnpkg.com/makeerror/-/makeerror-1.0.11.tgz#e01a5c9109f2af79660e4e8b9587790184f5a96c" @@ -10215,7 +10201,7 @@ mkdirp@0.3.x: version "0.3.5" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.3.5.tgz#de3e5f8961c88c787ee1368df849ac4413eca8d7" -mkdirp@0.5.1, mkdirp@0.5.x, mkdirp@0.x, mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0, mkdirp@~0.5.1: +mkdirp@0.5.1, mkdirp@0.5.x, mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0, mkdirp@~0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" dependencies: @@ -13176,19 +13162,19 @@ resolve@1.10.0, resolve@^1.10.0, resolve@^1.5.0, resolve@^1.6.0, resolve@^1.8.1, dependencies: path-parse "^1.0.6" -resolve@1.x, resolve@^1.11.0: - version "1.12.0" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.12.0.tgz#3fc644a35c84a48554609ff26ec52b66fa577df6" - integrity sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w== - dependencies: - path-parse "^1.0.6" - resolve@^1.1.6, resolve@^1.1.7, resolve@^1.3.2: version "1.5.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.5.0.tgz#1f09acce796c9a762579f31b2c1cc4c3cddf9f36" dependencies: path-parse "^1.0.5" +resolve@^1.11.0: + version "1.12.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.12.0.tgz#3fc644a35c84a48554609ff26ec52b66fa577df6" + integrity sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w== + dependencies: + path-parse "^1.0.6" + restore-cursor@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-1.0.1.tgz#34661f46886327fed2991479152252df92daa541" @@ -13441,11 +13427,6 @@ semver@5.4.1: version "5.4.1" resolved "https://registry.yarnpkg.com/semver/-/semver-5.4.1.tgz#e059c09d8571f0540823733433505d3a2f00b18e" -semver@^5.5: - version "5.7.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" - integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== - semver@^5.5.0, semver@^5.5.1, semver@^5.6.0: version "5.6.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.6.0.tgz#7e74256fbaa49c75aa7c7a205cc22799cac80004" @@ -14632,22 +14613,6 @@ ts-exhaustive-check@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/ts-exhaustive-check/-/ts-exhaustive-check-1.0.0.tgz#8048c81eccd3b4da45ebd10f01529ad0be7924c7" -ts-jest@^24.1.0: - version "24.1.0" - resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-24.1.0.tgz#2eaa813271a2987b7e6c3fefbda196301c131734" - integrity sha512-HEGfrIEAZKfu1pkaxB9au17b1d9b56YZSqz5eCVE8mX68+5reOvlM93xGOzzCREIov9mdH7JBG+s0UyNAqr0tQ== - dependencies: - bs-logger "0.x" - buffer-from "1.x" - fast-json-stable-stringify "2.x" - json5 "2.x" - lodash.memoize "4.x" - make-error "1.x" - mkdirp "0.x" - resolve "1.x" - semver "^5.5" - yargs-parser "10.x" - ts-node@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-4.1.0.tgz#36d9529c7b90bb993306c408cd07f7743de20712" @@ -15656,7 +15621,7 @@ yallist@^3.0.0, yallist@^3.0.2: resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.0.3.tgz#b4b049e314be545e3ce802236d6cd22cd91c3de9" integrity sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A== -yargs-parser@10.x, yargs-parser@^10.1.0: +yargs-parser@^10.1.0: version "10.1.0" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-10.1.0.tgz#7202265b89f7e9e9f2e5765e0fe735a905edbaa8" dependencies: From e9233319c714ca648323fa194889f9258ab7b65b Mon Sep 17 00:00:00 2001 From: Jonas Kello Date: Sun, 20 Oct 2019 12:07:54 +0200 Subject: [PATCH 15/21] wip projects --- jest.config.js | 36 ++++++++-- package.json | 1 + packages/property/jest.config.js | 12 ++-- .../react-properties-selector/jest.config.js | 5 ++ .../properties-selector.test.tsx.snap} | 2 +- .../checkbox-property-selector.test.js.snap | 35 ---------- .../checkbox/checkbox-property-selector.tsx | 2 +- yarn.lock | 67 ++++++++++++++----- 8 files changed, 93 insertions(+), 67 deletions(-) create mode 100644 packages/react-properties-selector/jest.config.js rename packages/react-properties-selector/src/{__snapshots__/properties-selector.test.js.snap => __tests__/__snapshots__/properties-selector.test.tsx.snap} (99%) delete mode 100644 packages/react-property-selectors/src/__snapshots__/checkbox-property-selector.test.js.snap diff --git a/jest.config.js b/jest.config.js index 27d6b120..6bdc22d1 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,9 +1,31 @@ module.exports = { - // projects: ["/packages/*/lib/*"], - coverageDirectory: "/coverage/", - collectCoverageFrom: ["/packages/*/lib/**/*.{js,jsx}"], - coverageReporters: ["text-summary", "lcov"], - // Run only compiled tests (by default typescript files are matched) - testMatch: ["**/?(*.)+(spec|test).[j]s?(x)"], - snapshotResolver: "./jest-snapshot-resolver.js" + preset: "ts-jest", + // projects: ["/packages/property/jest.config.js"] + + projects: [ + { + displayName: "property", + preset: "ts-jest", + testMatch: ["/packages/property/**/*.test.ts"] + } + // { + // displayName: "module2", + // testMatch: ["/httpdocs/modules/module2/**/*.test.js"] + // } + ] + + // coverageDirectory: "/coverage/", + // collectCoverageFrom: ["/packages/*/lib/**/*.{js,jsx}"], + // coverageReporters: ["text-summary", "lcov"], + // // Run only compiled tests (by default typescript files are matched) + // // testMatch: ["**/?(*.)+(spec|test).[j]s?(x)"], + // testMatch: ["**/?(*.)+(spec|test).ts?(x)"], + // // snapshotResolver: "./jest-snapshot-resolver.js", + // roots: [ + // "/packages/property/src", + // "/packages/property-filter-pretty/src", + // "/packages/react-properties-selector/src", + // "/packages/react-property-selectors/src", + // "/packages/variant-listing/src" + // ] }; diff --git a/package.json b/package.json index 1d092a9d..24d4504d 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "react-scripts": "^2.1.8", "react-test-renderer": "^16.6.1", "shelljs": "^0.8.3", + "ts-jest": "^24.1.0", "ts-node": "^4.1.0", "typescript": "^3.6.4", "uglify-js": "^3.4.9", diff --git a/packages/property/jest.config.js b/packages/property/jest.config.js index 9b7e28f8..4d9fc0b0 100644 --- a/packages/property/jest.config.js +++ b/packages/property/jest.config.js @@ -1,7 +1,5 @@ -module.exports = { - // coverageDirectory: "/coverage/", - // collectCoverageFrom: ["/packages/*/lib/**/*.{js,jsx}"], - // coverageReporters: ["text-summary", "lcov"] - // testMatch: ["**/__tests__/**/*.[jt]s?(x)", "**/?(*.)+(spec|test).[jt]s?(x)"] - testMatch: ["**/?(*.)+(spec|test).[j]s?(x)"] -}; +// module.exports = { +// preset: "ts-jest", +// testMatch: ["**/?(*.)+(spec|test).ts?(x)"], +// roots: ["src"] +// }; diff --git a/packages/react-properties-selector/jest.config.js b/packages/react-properties-selector/jest.config.js new file mode 100644 index 00000000..15813515 --- /dev/null +++ b/packages/react-properties-selector/jest.config.js @@ -0,0 +1,5 @@ +module.exports = { + preset: "ts-jest", + testMatch: ["**/?(*.)+(spec|test).ts?(x)"], + roots: ["src"] +}; diff --git a/packages/react-properties-selector/src/__snapshots__/properties-selector.test.js.snap b/packages/react-properties-selector/src/__tests__/__snapshots__/properties-selector.test.tsx.snap similarity index 99% rename from packages/react-properties-selector/src/__snapshots__/properties-selector.test.js.snap rename to packages/react-properties-selector/src/__tests__/__snapshots__/properties-selector.test.tsx.snap index cb328c93..f434716c 100644 --- a/packages/react-properties-selector/src/__snapshots__/properties-selector.test.js.snap +++ b/packages/react-properties-selector/src/__tests__/__snapshots__/properties-selector.test.tsx.snap @@ -354,7 +354,7 @@ exports[`Simple PropertiesSelector 1`] = ` "background": "green", "backgroundColor": "#ccc", "height": "22px", - "marginTop": "5px", + "marginTop": "6px", "position": "relative", "width": "22px", } diff --git a/packages/react-property-selectors/src/__snapshots__/checkbox-property-selector.test.js.snap b/packages/react-property-selectors/src/__snapshots__/checkbox-property-selector.test.js.snap deleted file mode 100644 index 32e14f5f..00000000 --- a/packages/react-property-selectors/src/__snapshots__/checkbox-property-selector.test.js.snap +++ /dev/null @@ -1,35 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Simple CheckboxPropertySelector 1`] = ` -
-
- checked (1) -
-
-
-`; diff --git a/packages/react-property-selectors/src/checkbox/checkbox-property-selector.tsx b/packages/react-property-selectors/src/checkbox/checkbox-property-selector.tsx index 81ae6362..d8b785c4 100644 --- a/packages/react-property-selectors/src/checkbox/checkbox-property-selector.tsx +++ b/packages/react-property-selectors/src/checkbox/checkbox-property-selector.tsx @@ -64,7 +64,7 @@ const defaultCheckbox = (props: CheckboxProps): JSX.Element => (
Date: Sun, 20 Oct 2019 13:18:08 +0200 Subject: [PATCH 16/21] projects --- jest.config.js | 34 +++++++----------- .../checkbox-property-selector.test.tsx.snap | 35 +++++++++++++++++++ 2 files changed, 47 insertions(+), 22 deletions(-) create mode 100644 packages/react-property-selectors/src/__tests__/__snapshots__/checkbox-property-selector.test.tsx.snap diff --git a/jest.config.js b/jest.config.js index 6bdc22d1..e4537fb7 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,31 +1,21 @@ module.exports = { - preset: "ts-jest", - // projects: ["/packages/property/jest.config.js"] - projects: [ { displayName: "property", preset: "ts-jest", testMatch: ["/packages/property/**/*.test.ts"] + }, + { + displayName: "react-property-selectors", + preset: "ts-jest", + testMatch: [ + "/packages/react-property-selectors/**/*.test.ts?(x)" + ], + globals: { + "ts-jest": { + tsConfig: "/packages/react-property-selectors/tsconfig.json" + } + } } - // { - // displayName: "module2", - // testMatch: ["/httpdocs/modules/module2/**/*.test.js"] - // } ] - - // coverageDirectory: "/coverage/", - // collectCoverageFrom: ["/packages/*/lib/**/*.{js,jsx}"], - // coverageReporters: ["text-summary", "lcov"], - // // Run only compiled tests (by default typescript files are matched) - // // testMatch: ["**/?(*.)+(spec|test).[j]s?(x)"], - // testMatch: ["**/?(*.)+(spec|test).ts?(x)"], - // // snapshotResolver: "./jest-snapshot-resolver.js", - // roots: [ - // "/packages/property/src", - // "/packages/property-filter-pretty/src", - // "/packages/react-properties-selector/src", - // "/packages/react-property-selectors/src", - // "/packages/variant-listing/src" - // ] }; diff --git a/packages/react-property-selectors/src/__tests__/__snapshots__/checkbox-property-selector.test.tsx.snap b/packages/react-property-selectors/src/__tests__/__snapshots__/checkbox-property-selector.test.tsx.snap new file mode 100644 index 00000000..575407aa --- /dev/null +++ b/packages/react-property-selectors/src/__tests__/__snapshots__/checkbox-property-selector.test.tsx.snap @@ -0,0 +1,35 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Simple CheckboxPropertySelector 1`] = ` +
+
+ checked (1) +
+
+
+`; From ec88df418ddedb29c9918f08e7360b04c825fb73 Mon Sep 17 00:00:00 2001 From: Jonas Kello Date: Sun, 20 Oct 2019 13:30:46 +0200 Subject: [PATCH 17/21] Use ts-jest and projects --- jest-snapshot-resolver.js | 25 ----------------------- jest.config.js | 43 ++++++++++++++++++++++++++++++++++++--- 2 files changed, 40 insertions(+), 28 deletions(-) delete mode 100644 jest-snapshot-resolver.js diff --git a/jest-snapshot-resolver.js b/jest-snapshot-resolver.js deleted file mode 100644 index 102f7201..00000000 --- a/jest-snapshot-resolver.js +++ /dev/null @@ -1,25 +0,0 @@ -// We need this so that we can run the compiled tests in lib/ folder but -// have the snapshots written/read from the src/ folder so they can be -// checked into source control -module.exports = { - // resolves from test to snapshot path - resolveSnapshotPath: (testPath, snapshotExtension) => { - // console.log("testPath", testPath); - return ( - testPath.replace("/lib/", "/src/").replace("__tests__", "__snapshots__") + - snapshotExtension - ); - }, - - // resolves from snapshot to test path - resolveTestPath: (snapshotFilePath, snapshotExtension) => { - // console.log("snapshotFilePath", snapshotFilePath); - return snapshotFilePath - .replace("/src/", "/lib/") - .replace("__snapshots__", "__tests__") - .slice(0, -snapshotExtension.length); - }, - - // Example test path, used for preflight consistency check of the implementation above - testPathForConsistencyCheck: "some/__tests__/example.test.js" -}; diff --git a/jest.config.js b/jest.config.js index e4537fb7..3c838a80 100644 --- a/jest.config.js +++ b/jest.config.js @@ -3,19 +3,56 @@ module.exports = { { displayName: "property", preset: "ts-jest", + globals: { + "ts-jest": { + tsConfig: "/packages/property/tsconfig.json" + } + }, testMatch: ["/packages/property/**/*.test.ts"] }, + { + displayName: "property-filter-pretty", + preset: "ts-jest", + globals: { + "ts-jest": { + tsConfig: "/packages/property-filter-pretty/tsconfig.json" + } + }, + testMatch: ["/packages/property-filter-pretty/**/*.test.ts?(x)"] + }, + { + displayName: "react-properties-selector", + preset: "ts-jest", + globals: { + "ts-jest": { + tsConfig: "/packages/react-properties-selector/tsconfig.json" + } + }, + testMatch: [ + "/packages/react-properties-selector/**/*.test.ts?(x)" + ] + }, { displayName: "react-property-selectors", preset: "ts-jest", + globals: { + "ts-jest": { + tsConfig: "/packages/react-property-selectors/tsconfig.json" + } + }, testMatch: [ "/packages/react-property-selectors/**/*.test.ts?(x)" - ], + ] + }, + { + displayName: "variant-listing", + preset: "ts-jest", globals: { "ts-jest": { - tsConfig: "/packages/react-property-selectors/tsconfig.json" + tsConfig: "/packages/variant-listing/tsconfig.json" } - } + }, + testMatch: ["/packages/variant-listing/**/*.test.ts?(x)"] } ] }; From db00891cd63e2fe8f9ce957781bb01397a6c71cc Mon Sep 17 00:00:00 2001 From: Jonas Kello Date: Sun, 20 Oct 2019 13:38:50 +0200 Subject: [PATCH 18/21] Match tsx --- jest.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jest.config.js b/jest.config.js index 3c838a80..43e768cd 100644 --- a/jest.config.js +++ b/jest.config.js @@ -8,7 +8,7 @@ module.exports = { tsConfig: "/packages/property/tsconfig.json" } }, - testMatch: ["/packages/property/**/*.test.ts"] + testMatch: ["/packages/property/**/*.test.ts?(x)"] }, { displayName: "property-filter-pretty", From 0d7ae361386937933ef974dbdc2f4832674e8d7f Mon Sep 17 00:00:00 2001 From: Jonas Kello Date: Sun, 20 Oct 2019 14:01:52 +0200 Subject: [PATCH 19/21] Code coverage for all projects --- jest.config.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/jest.config.js b/jest.config.js index 43e768cd..c949a2a6 100644 --- a/jest.config.js +++ b/jest.config.js @@ -54,5 +54,11 @@ module.exports = { }, testMatch: ["/packages/variant-listing/**/*.test.ts?(x)"] } + ], + coverageDirectory: "/coverage/", + collectCoverageFrom: [ + "/packages/*/src/**/*.ts?(x)", + "!/packages/_stories/**/*", + "!/packages/*/src/**/*.test.ts?(x)" ] }; From bdbc050b47a03d96e5d29b46d9f7a9c6b7825528 Mon Sep 17 00:00:00 2001 From: Jonas Kello Date: Sun, 20 Oct 2019 14:25:06 +0200 Subject: [PATCH 20/21] Use separate config file for each project --- jest.config.js | 113 +++++++++--------- .../property-filter-pretty/jest.config.js | 10 ++ packages/property/jest.config.js | 15 ++- .../react-properties-selector/jest.config.js | 9 +- .../react-property-selectors/jest.config.js | 10 ++ packages/variant-listing/jest.config.js | 10 ++ 6 files changed, 104 insertions(+), 63 deletions(-) create mode 100644 packages/property-filter-pretty/jest.config.js create mode 100644 packages/react-property-selectors/jest.config.js create mode 100644 packages/variant-listing/jest.config.js diff --git a/jest.config.js b/jest.config.js index c949a2a6..7deaac89 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,60 +1,61 @@ module.exports = { - projects: [ - { - displayName: "property", - preset: "ts-jest", - globals: { - "ts-jest": { - tsConfig: "/packages/property/tsconfig.json" - } - }, - testMatch: ["/packages/property/**/*.test.ts?(x)"] - }, - { - displayName: "property-filter-pretty", - preset: "ts-jest", - globals: { - "ts-jest": { - tsConfig: "/packages/property-filter-pretty/tsconfig.json" - } - }, - testMatch: ["/packages/property-filter-pretty/**/*.test.ts?(x)"] - }, - { - displayName: "react-properties-selector", - preset: "ts-jest", - globals: { - "ts-jest": { - tsConfig: "/packages/react-properties-selector/tsconfig.json" - } - }, - testMatch: [ - "/packages/react-properties-selector/**/*.test.ts?(x)" - ] - }, - { - displayName: "react-property-selectors", - preset: "ts-jest", - globals: { - "ts-jest": { - tsConfig: "/packages/react-property-selectors/tsconfig.json" - } - }, - testMatch: [ - "/packages/react-property-selectors/**/*.test.ts?(x)" - ] - }, - { - displayName: "variant-listing", - preset: "ts-jest", - globals: { - "ts-jest": { - tsConfig: "/packages/variant-listing/tsconfig.json" - } - }, - testMatch: ["/packages/variant-listing/**/*.test.ts?(x)"] - } - ], + // projects: [ + // { + // displayName: "property", + // preset: "ts-jest", + // globals: { + // "ts-jest": { + // tsConfig: "/packages/property/tsconfig.json" + // } + // }, + // testMatch: ["/packages/property/**/*.test.ts?(x)"] + // }, + // { + // displayName: "property-filter-pretty", + // preset: "ts-jest", + // globals: { + // "ts-jest": { + // tsConfig: "/packages/property-filter-pretty/tsconfig.json" + // } + // }, + // testMatch: ["/packages/property-filter-pretty/**/*.test.ts?(x)"] + // }, + // { + // displayName: "react-properties-selector", + // preset: "ts-jest", + // globals: { + // "ts-jest": { + // tsConfig: "/packages/react-properties-selector/tsconfig.json" + // } + // }, + // testMatch: [ + // "/packages/react-properties-selector/**/*.test.ts?(x)" + // ] + // }, + // { + // displayName: "react-property-selectors", + // preset: "ts-jest", + // globals: { + // "ts-jest": { + // tsConfig: "/packages/react-property-selectors/tsconfig.json" + // } + // }, + // testMatch: [ + // "/packages/react-property-selectors/**/*.test.ts?(x)" + // ] + // }, + // { + // displayName: "variant-listing", + // preset: "ts-jest", + // globals: { + // "ts-jest": { + // tsConfig: "/packages/variant-listing/tsconfig.json" + // } + // }, + // testMatch: ["/packages/variant-listing/**/*.test.ts?(x)"] + // } + // ], + projects: ["/packages/*/jest.config.js"], coverageDirectory: "/coverage/", collectCoverageFrom: [ "/packages/*/src/**/*.ts?(x)", diff --git a/packages/property-filter-pretty/jest.config.js b/packages/property-filter-pretty/jest.config.js new file mode 100644 index 00000000..5d8d0334 --- /dev/null +++ b/packages/property-filter-pretty/jest.config.js @@ -0,0 +1,10 @@ +module.exports = { + displayName: "property-filter-pretty", + preset: "ts-jest", + globals: { + "ts-jest": { + tsConfig: "/tsconfig.json" + } + }, + testMatch: ["/src/**/*.test.ts?(x)"] +}; diff --git a/packages/property/jest.config.js b/packages/property/jest.config.js index 4d9fc0b0..523ded6d 100644 --- a/packages/property/jest.config.js +++ b/packages/property/jest.config.js @@ -1,5 +1,10 @@ -// module.exports = { -// preset: "ts-jest", -// testMatch: ["**/?(*.)+(spec|test).ts?(x)"], -// roots: ["src"] -// }; +module.exports = { + displayName: "property", + preset: "ts-jest", + globals: { + "ts-jest": { + tsConfig: "/tsconfig.json" + } + }, + testMatch: ["/src/**/*.test.ts?(x)"] +}; diff --git a/packages/react-properties-selector/jest.config.js b/packages/react-properties-selector/jest.config.js index 15813515..cbe39c7d 100644 --- a/packages/react-properties-selector/jest.config.js +++ b/packages/react-properties-selector/jest.config.js @@ -1,5 +1,10 @@ module.exports = { + displayName: "react-properties-selector", preset: "ts-jest", - testMatch: ["**/?(*.)+(spec|test).ts?(x)"], - roots: ["src"] + globals: { + "ts-jest": { + tsConfig: "/tsconfig.json" + } + }, + testMatch: ["/src/**/*.test.ts?(x)"] }; diff --git a/packages/react-property-selectors/jest.config.js b/packages/react-property-selectors/jest.config.js new file mode 100644 index 00000000..17364dd7 --- /dev/null +++ b/packages/react-property-selectors/jest.config.js @@ -0,0 +1,10 @@ +module.exports = { + displayName: "react-property-selectors", + preset: "ts-jest", + globals: { + "ts-jest": { + tsConfig: "/tsconfig.json" + } + }, + testMatch: ["/src/**/*.test.ts?(x)"] +}; diff --git a/packages/variant-listing/jest.config.js b/packages/variant-listing/jest.config.js new file mode 100644 index 00000000..af959742 --- /dev/null +++ b/packages/variant-listing/jest.config.js @@ -0,0 +1,10 @@ +module.exports = { + displayName: "variant-listing", + preset: "ts-jest", + globals: { + "ts-jest": { + tsConfig: "/tsconfig.json" + } + }, + testMatch: ["/src/**/*.test.ts?(x)"] +}; From 2778a9824d17d4d57138f7e0ae618f65a8ed1cac Mon Sep 17 00:00:00 2001 From: Jonas Kello Date: Sun, 20 Oct 2019 14:31:54 +0200 Subject: [PATCH 21/21] Remove explicit tsconfig config --- packages/property-filter-pretty/jest.config.js | 5 ----- packages/property/jest.config.js | 5 ----- packages/react-properties-selector/jest.config.js | 5 ----- packages/react-property-selectors/jest.config.js | 5 ----- packages/variant-listing/jest.config.js | 5 ----- 5 files changed, 25 deletions(-) diff --git a/packages/property-filter-pretty/jest.config.js b/packages/property-filter-pretty/jest.config.js index 5d8d0334..a851de22 100644 --- a/packages/property-filter-pretty/jest.config.js +++ b/packages/property-filter-pretty/jest.config.js @@ -1,10 +1,5 @@ module.exports = { displayName: "property-filter-pretty", preset: "ts-jest", - globals: { - "ts-jest": { - tsConfig: "/tsconfig.json" - } - }, testMatch: ["/src/**/*.test.ts?(x)"] }; diff --git a/packages/property/jest.config.js b/packages/property/jest.config.js index 523ded6d..32f29f2c 100644 --- a/packages/property/jest.config.js +++ b/packages/property/jest.config.js @@ -1,10 +1,5 @@ module.exports = { displayName: "property", preset: "ts-jest", - globals: { - "ts-jest": { - tsConfig: "/tsconfig.json" - } - }, testMatch: ["/src/**/*.test.ts?(x)"] }; diff --git a/packages/react-properties-selector/jest.config.js b/packages/react-properties-selector/jest.config.js index cbe39c7d..077f562c 100644 --- a/packages/react-properties-selector/jest.config.js +++ b/packages/react-properties-selector/jest.config.js @@ -1,10 +1,5 @@ module.exports = { displayName: "react-properties-selector", preset: "ts-jest", - globals: { - "ts-jest": { - tsConfig: "/tsconfig.json" - } - }, testMatch: ["/src/**/*.test.ts?(x)"] }; diff --git a/packages/react-property-selectors/jest.config.js b/packages/react-property-selectors/jest.config.js index 17364dd7..9cba7345 100644 --- a/packages/react-property-selectors/jest.config.js +++ b/packages/react-property-selectors/jest.config.js @@ -1,10 +1,5 @@ module.exports = { displayName: "react-property-selectors", preset: "ts-jest", - globals: { - "ts-jest": { - tsConfig: "/tsconfig.json" - } - }, testMatch: ["/src/**/*.test.ts?(x)"] }; diff --git a/packages/variant-listing/jest.config.js b/packages/variant-listing/jest.config.js index af959742..8c4bd917 100644 --- a/packages/variant-listing/jest.config.js +++ b/packages/variant-listing/jest.config.js @@ -1,10 +1,5 @@ module.exports = { displayName: "variant-listing", preset: "ts-jest", - globals: { - "ts-jest": { - tsConfig: "/tsconfig.json" - } - }, testMatch: ["/src/**/*.test.ts?(x)"] };