Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test file locations #4

Merged
merged 22 commits into from
Oct 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 1 addition & 6 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,10 @@ 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",
"./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: {
Expand Down
71 changes: 62 additions & 9 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,65 @@
module.exports = {
projects: ["<rootDir>/packages/test/*"],
preset: "ts-jest",
// projects: [
// {
// displayName: "property",
// preset: "ts-jest",
// globals: {
// "ts-jest": {
// tsConfig: "<rootDir>/packages/property/tsconfig.json"
// }
// },
// testMatch: ["<rootDir>/packages/property/**/*.test.ts?(x)"]
// },
// {
// displayName: "property-filter-pretty",
// preset: "ts-jest",
// globals: {
// "ts-jest": {
// tsConfig: "<rootDir>/packages/property-filter-pretty/tsconfig.json"
// }
// },
// testMatch: ["<rootDir>/packages/property-filter-pretty/**/*.test.ts?(x)"]
// },
// {
// displayName: "react-properties-selector",
// preset: "ts-jest",
// globals: {
// "ts-jest": {
// tsConfig: "<rootDir>/packages/react-properties-selector/tsconfig.json"
// }
// },
// testMatch: [
// "<rootDir>/packages/react-properties-selector/**/*.test.ts?(x)"
// ]
// },
// {
// displayName: "react-property-selectors",
// preset: "ts-jest",
// globals: {
// "ts-jest": {
// tsConfig: "<rootDir>/packages/react-property-selectors/tsconfig.json"
// }
// },
// testMatch: [
// "<rootDir>/packages/react-property-selectors/**/*.test.ts?(x)"
// ]
// },
// {
// displayName: "variant-listing",
// preset: "ts-jest",
// globals: {
// "ts-jest": {
// tsConfig: "<rootDir>/packages/variant-listing/tsconfig.json"
// }
// },
// testMatch: ["<rootDir>/packages/variant-listing/**/*.test.ts?(x)"]
// }
// ],
projects: ["<rootDir>/packages/*/jest.config.js"],
coverageDirectory: "<rootDir>/coverage/",
collectCoverageFrom: ["<rootDir>/packages/*/src/**/*.{ts,tsx}"],
coverageReporters: ["text-summary", "lcov"],
globals: {
"ts-jest": {
tsConfig: "<rootDir>/packages/tsconfig.settings.json"
}
}
collectCoverageFrom: [
"<rootDir>/packages/*/src/**/*.ts?(x)",
"!<rootDir>/packages/_stories/**/*",
"!<rootDir>/packages/*/src/**/*.test.ts?(x)"
]
};
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 5 additions & 0 deletions packages/property-filter-pretty/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
**/__mocks__/**
**/__tests__/**
src
tsconfig.json
tsconfig.tsbuildinfo
5 changes: 5 additions & 0 deletions packages/property-filter-pretty/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
displayName: "property-filter-pretty",
preset: "ts-jest",
testMatch: ["<rootDir>/src/**/*.test.ts?(x)"]
};
7 changes: 0 additions & 7 deletions packages/property-filter-pretty/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -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", () => {
Expand Down
3 changes: 0 additions & 3 deletions packages/property-filter-pretty/test/jest.config.js

This file was deleted.

11 changes: 0 additions & 11 deletions packages/property-filter-pretty/test/tsconfig.json

This file was deleted.

2 changes: 1 addition & 1 deletion packages/property-filter-pretty/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"outDir": "lib",
"rootDir": "src",
"lib": ["dom", "es2015", "es2017.object", "esnext.asynciterable"],
"types": ["node"]
"types": ["node", "jest"]
},
"references": [{ "path": "../property" }]
}
5 changes: 5 additions & 0 deletions packages/property/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
**/__mocks__/**
**/__tests__/**
src
tsconfig.json
tsconfig.tsbuildinfo
5 changes: 5 additions & 0 deletions packages/property/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
displayName: "property",
preset: "ts-jest",
testMatch: ["<rootDir>/src/**/*.test.ts?(x)"]
};
7 changes: 0 additions & 7 deletions packages/property/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,6 @@
"promaster",
"promaster-sdk"
],
"files": [
"/lib",
"package.json",
"CHANGELOG.md",
"LICENSE",
"README.md"
],
"dependencies": {
"uom": "^2.3.0"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PropertyFilterAst } from "@promaster-sdk/property";
import * as PropertyFilterAst from "../../property-filter-ast";

const {
newIdentifierExpr,
Expand Down
Original file line number Diff line number Diff line change
@@ -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 = [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -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";

Expand Down
Original file line number Diff line number Diff line change
@@ -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";

Expand Down
Original file line number Diff line number Diff line change
@@ -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", () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -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", () => {
Expand Down
12 changes: 0 additions & 12 deletions packages/property/test/tsconfig.json

This file was deleted.

3 changes: 1 addition & 2 deletions packages/property/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"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"]
"types": ["node", "jest"]
},
"references": []
}
5 changes: 5 additions & 0 deletions packages/react-properties-selector/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
**/__mocks__/**
**/__tests__/**
src
tsconfig.json
tsconfig.tsbuildinfo
5 changes: 5 additions & 0 deletions packages/react-properties-selector/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
displayName: "react-properties-selector",
preset: "ts-jest",
testMatch: ["<rootDir>/src/**/*.test.ts?(x)"]
};
7 changes: 0 additions & 7 deletions packages/react-properties-selector/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ exports[`Simple PropertiesSelector 1`] = `
"background": "green",
"backgroundColor": "#ccc",
"height": "22px",
"marginTop": "5px",
"marginTop": "6px",
"position": "relative",
"width": "22px",
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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();
Expand Down
11 changes: 0 additions & 11 deletions packages/react-properties-selector/test/tsconfig.json

This file was deleted.

2 changes: 1 addition & 1 deletion packages/react-properties-selector/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"outDir": "lib",
"rootDir": "src",
"lib": ["dom", "es2015", "es2017.object", "esnext.asynciterable"],
"types": ["node"]
"types": ["node", "jest"]
},
"references": [
{ "path": "../property" },
Expand Down
5 changes: 5 additions & 0 deletions packages/react-property-selectors/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
**/__mocks__/**
**/__tests__/**
src
tsconfig.json
tsconfig.tsbuildinfo
5 changes: 5 additions & 0 deletions packages/react-property-selectors/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
displayName: "react-property-selectors",
preset: "ts-jest",
testMatch: ["<rootDir>/src/**/*.test.ts?(x)"]
};
7 changes: 0 additions & 7 deletions packages/react-property-selectors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ exports[`Simple CheckboxPropertySelector 1`] = `
"background": "green",
"backgroundColor": "#ccc",
"height": "22px",
"marginTop": "5px",
"marginTop": "6px",
"position": "relative",
"width": "22px",
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
import {
createCheckboxPropertySelector,
CheckboxPropertyValueItem
} from "@promaster-sdk/react-property-selectors";
} from "../index";

const CheckboxPropertySelector = createCheckboxPropertySelector({});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const defaultCheckbox = (props: CheckboxProps): JSX.Element => (
<div
{...props}
style={{
marginTop: "5px",
marginTop: "6px",
position: "relative",
backgroundColor: "#ccc",
width: "22px",
Expand Down
11 changes: 0 additions & 11 deletions packages/react-property-selectors/test/tsconfig.json

This file was deleted.