Skip to content

Commit

Permalink
Lift common to a true workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
Jym77 committed Sep 2, 2024
1 parent d8c3d04 commit 236df67
Show file tree
Hide file tree
Showing 24 changed files with 43 additions and 24 deletions.
4 changes: 4 additions & 0 deletions common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
"$schema": "http://json.schemastore.org/package",
"private": true,
"name": "common",
"exports": {
"./persist": "./persist.js",
"./persist.js": "./persist.js"
},
"devDependencies": {
"@siteimprove/alfa-act": "^0.81.0",
"@siteimprove/alfa-assert": "^0.65.2",
Expand Down
6 changes: 1 addition & 5 deletions config/knip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ const project = ["**/*.ts", "**/*.tsx"];

const config: KnipConfig = {
workspaces: {
".": {
entry: ["common/*.ts"],
project: ["common/**/*.ts"],
ignoreDependencies: ["prettier"],
},
common: { entry: "persist.ts", project },
"custom-testing/*": { entry, project },
"custom-testing/crawling": { entry: ["crawling.ts"], project },
"custom-testing/measuring-performances": {
Expand Down
1 change: 1 addition & 0 deletions custom-testing/adding-rules/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"@types/chai": "^4.2.3",
"@types/mocha": "^5.2.7",
"chai": "^4.3.4",
"common": "workspace:^",
"mocha": "^8.3.2",
"playwright": "^1.10.0"
}
Expand Down
2 changes: 1 addition & 1 deletion custom-testing/adding-rules/test/page.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import * as alfa from "@siteimprove/alfa-chai";

import rules from "@siteimprove/alfa-rules";

import { persist } from "../../../common/persist";
import { persist } from "common/persist";

const { and } = Refinement;

Expand Down
1 change: 1 addition & 0 deletions custom-testing/answering/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@types/chai": "^4.2.3",
"@types/mocha": "^5.2.7",
"chai": "^4.3.4",
"common": "workspace:^",
"mocha": "^8.3.2",
"playwright": "^1.10.0"
}
Expand Down
9 changes: 4 additions & 5 deletions custom-testing/answering/test/answering.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,29 @@
/// <reference types="mocha" />

import * as act from "@siteimprove/alfa-act";
import { Color, RGB } from "@siteimprove/alfa-css";
import { Color } from "@siteimprove/alfa-css";
import { Element, Text } from "@siteimprove/alfa-dom";
import { Future } from "@siteimprove/alfa-future";
import { Hashable } from "@siteimprove/alfa-hash";
import { None, Some } from "@siteimprove/alfa-option";
import { Playwright } from "@siteimprove/alfa-playwright";
import { Refinement } from "@siteimprove/alfa-refinement";
import rules, { Question, Scope } from "@siteimprove/alfa-rules";
import { Resolver } from "@siteimprove/alfa-style";
import rules, { Question } from "@siteimprove/alfa-rules";

import * as chai from "chai";
import * as playwright from "playwright";

import * as alfa from "@siteimprove/alfa-chai";

import { persist } from "../../../common/persist";
import { persist } from "common/persist";

const { and } = Refinement;

// Creating a Chai plugin which uses all rules.
chai.use(
alfa.Chai.createPlugin(
(value: Playwright.Type) => Future.from(Playwright.toPage(value)),
rules.filter(rule => !rule.uri.includes("r111")),
rules.filter((rule) => !rule.uri.includes("r111")),
[persist(() => "test/outcomes/page.spec.json")]
)
);
Expand Down
1 change: 1 addition & 0 deletions custom-testing/filtering/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"@types/chai": "^4.2.3",
"@types/mocha": "^5.2.7",
"chai": "^4.3.4",
"common": "workspace:^",
"mocha": "^8.3.2",
"playwright": "^1.10.0"
}
Expand Down
4 changes: 2 additions & 2 deletions custom-testing/filtering/test/filtering.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ import * as alfa from "@siteimprove/alfa-chai";

import rules, { Scope } from "@siteimprove/alfa-rules";

import { persist } from "../../../common/persist";
import { persist } from "common/persist";

const { and } = Refinement;

// Creating a Chai plugin which uses all rules.
chai.use(
alfa.Chai.createPlugin(
(value: Playwright.Type) => Future.from(Playwright.toPage(value)),
rules.filter(rule => !rule.uri.includes("r111")),
rules.filter((rule) => !rule.uri.includes("r111")),
[persist(() => "test/outcomes/filtering.spec.json")]
)
);
Expand Down
1 change: 1 addition & 0 deletions custom-testing/interacting/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"@types/chai": "^4.2.3",
"@types/mocha": "^5.2.7",
"chai": "^4.3.4",
"common": "workspace:^",
"mocha": "^8.3.2",
"playwright": "^1.10.0"
}
Expand Down
2 changes: 1 addition & 1 deletion custom-testing/interacting/test/interacting.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import * as alfa from "@siteimprove/alfa-chai";
import { Rules } from "@siteimprove/alfa-rules";
const R69 = Rules.get("R69").getUnsafe();

import { persist } from "../../../common/persist";
import { persist } from "common/persist";

chai.use(
alfa.Chai.createPlugin(
Expand Down
2 changes: 0 additions & 2 deletions custom-testing/navigating/test/navigating.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import * as alfa from "@siteimprove/alfa-chai";
import { Rules } from "@siteimprove/alfa-rules";
const R69 = Rules.get("R69").getUnsafe();

import { persist } from "../../../common/persist";

// Creating a Chai plugin which only uses R69.
chai.use(
alfa.Chai.createPlugin(
Expand Down
1 change: 1 addition & 0 deletions end-to-end-testing/playwright/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"@types/chai": "^4.2.3",
"@types/mocha": "^5.2.7",
"chai": "^4.3.4",
"common": "workspace:^",
"mocha": "^8.3.2",
"playwright": "^1.10.0"
}
Expand Down
4 changes: 2 additions & 2 deletions end-to-end-testing/playwright/test/page.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import { Playwright } from "@siteimprove/alfa-playwright";
import * as alfa from "@siteimprove/alfa-chai";
import rules from "@siteimprove/alfa-rules";

import { persist } from "../../../common/persist";
import { persist } from "common/persist";

chai.use(
alfa.Chai.createPlugin(
(value: Playwright.Type) => Future.from(Playwright.toPage(value)),
rules.filter(rule => !rule.uri.includes("r111")),
rules.filter((rule) => !rule.uri.includes("r111")),
[persist(() => "test/outcomes/page.spec.json")]
)
);
Expand Down
1 change: 1 addition & 0 deletions end-to-end-testing/puppeteer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"@types/chai": "^4.2.3",
"@types/mocha": "^5.2.7",
"chai": "^4.3.4",
"common": "workspace:^",
"mocha": "^8.3.2",
"puppeteer": "^8.0.0"
}
Expand Down
2 changes: 1 addition & 1 deletion end-to-end-testing/puppeteer/test/page.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Puppeteer } from "@siteimprove/alfa-puppeteer";
import * as alfa from "@siteimprove/alfa-chai";
import rules from "@siteimprove/alfa-rules";

import { persist } from "../../../common/persist";
import { persist } from "common/persist";

chai.use(
alfa.Chai.createPlugin(
Expand Down
1 change: 1 addition & 0 deletions end-to-end-testing/webdriver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"@wdio/spec-reporter": "^7.1.1",
"chai": "^4.3.4",
"chromedriver": "^119.0.1",
"common": "workspace:^",
"mocha": "^8.3.2",
"ts-node": "^9.1.1",
"wdio-chromedriver-service": "^7.0.0",
Expand Down
2 changes: 1 addition & 1 deletion end-to-end-testing/webdriver/test/page.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { WebElement } from "@siteimprove/alfa-webdriver";
import * as alfa from "@siteimprove/alfa-chai";
import rules from "@siteimprove/alfa-rules";

import { persist } from "../../../common/persist";
import { persist } from "common/persist";

chai.use(
alfa.Chai.createPlugin(
Expand Down
1 change: 1 addition & 0 deletions unit-testing/angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"@siteimprove/alfa-jest": "^0.65.2",
"@siteimprove/alfa-rules": "^0.81.0",
"@types/jest": "^29.5.1",
"common": "workspace:^",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"jest-preset-angular": "^13.1.1"
Expand Down
2 changes: 1 addition & 1 deletion unit-testing/angular/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ global.TextEncoder = TextEncoder;
import { Rules } from "@siteimprove/alfa-rules";
const R12 = Rules.get("R12").getUnsafe();

import { persist } from "../../common/persist";
import { persist } from "common/persist";

alfa.Jest.createPlugin(
(value: Angular.Type) => Future.from(Angular.toPage(value)),
Expand Down
1 change: 1 addition & 0 deletions unit-testing/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"@types/jest": "^29.5.1",
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
"common": "workspace:^",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.6",
"jest": "^29.5.0",
Expand Down
2 changes: 1 addition & 1 deletion unit-testing/react/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const R12 = Rules.get("R12").getUnsafe();
import * as enzyme from "enzyme";
import Adapter from "enzyme-adapter-react-16";

import { persist } from "../../common/persist";
import { persist } from "common/persist";

enzyme.configure({ adapter: new Adapter() });

Expand Down
1 change: 1 addition & 0 deletions unit-testing/vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"@siteimprove/alfa-vue": "^0.65.2",
"@types/jest": "^29.5.1",
"@vue/test-utils": "^1.0.0-beta.29",
"common": "workspace:^",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0"
}
Expand Down
2 changes: 1 addition & 1 deletion unit-testing/vue/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ global.TextEncoder = TextEncoder;
import { Rules } from "@siteimprove/alfa-rules";
const R12 = Rules.get("R12").getUnsafe();

import { persist } from "../../common/persist";
import { persist } from "common/persist";

alfa.Jest.createPlugin(
(value: Vue.Type) => Future.from(Vue.toPage(value)),
Expand Down
14 changes: 13 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4627,7 +4627,7 @@ __metadata:
languageName: node
linkType: hard

"common@workspace:common":
"common@workspace:^, common@workspace:common":
version: 0.0.0-use.local
resolution: "common@workspace:common"
dependencies:
Expand Down Expand Up @@ -4907,6 +4907,7 @@ __metadata:
"@types/chai": ^4.2.3
"@types/mocha": ^5.2.7
chai: ^4.3.4
common: "workspace:^"
mocha: ^8.3.2
playwright: ^1.10.0
languageName: unknown
Expand All @@ -4931,6 +4932,7 @@ __metadata:
"@types/chai": ^4.2.3
"@types/mocha": ^5.2.7
chai: ^4.3.4
common: "workspace:^"
mocha: ^8.3.2
playwright: ^1.10.0
languageName: unknown
Expand Down Expand Up @@ -4964,6 +4966,7 @@ __metadata:
"@types/chai": ^4.2.3
"@types/mocha": ^5.2.7
chai: ^4.3.4
common: "workspace:^"
mocha: ^8.3.2
playwright: ^1.10.0
languageName: unknown
Expand All @@ -4980,6 +4983,7 @@ __metadata:
"@types/chai": ^4.2.3
"@types/mocha": ^5.2.7
chai: ^4.3.4
common: "workspace:^"
mocha: ^8.3.2
playwright: ^1.10.0
languageName: unknown
Expand Down Expand Up @@ -5639,6 +5643,7 @@ __metadata:
"@types/chai": ^4.2.3
"@types/mocha": ^5.2.7
chai: ^4.3.4
common: "workspace:^"
mocha: ^8.3.2
playwright: ^1.10.0
languageName: unknown
Expand All @@ -5656,6 +5661,7 @@ __metadata:
"@types/chai": ^4.2.3
"@types/mocha": ^5.2.7
chai: ^4.3.4
common: "workspace:^"
mocha: ^8.3.2
puppeteer: ^8.0.0
languageName: unknown
Expand All @@ -5678,6 +5684,7 @@ __metadata:
"@wdio/spec-reporter": ^7.1.1
chai: ^4.3.4
chromedriver: ^119.0.1
common: "workspace:^"
mocha: ^8.3.2
ts-node: ^9.1.1
wdio-chromedriver-service: ^7.0.0
Expand Down Expand Up @@ -11410,9 +11417,11 @@ __metadata:
"@angular/platform-browser-dynamic": ^8.2.0
"@siteimprove/alfa-angular": ^0.65.2
"@siteimprove/alfa-assert": ^0.65.2
"@siteimprove/alfa-future": ^0.81.0
"@siteimprove/alfa-jest": ^0.65.2
"@siteimprove/alfa-rules": ^0.81.0
"@types/jest": ^29.5.1
common: "workspace:^"
jest: ^29.5.0
jest-environment-jsdom: ^29.5.0
jest-preset-angular: ^13.1.1
Expand All @@ -11434,6 +11443,7 @@ __metadata:
"@types/jest": ^29.5.1
"@types/react": ^17.0.0
"@types/react-dom": ^17.0.0
common: "workspace:^"
enzyme: ^3.11.0
enzyme-adapter-react-16: ^1.15.6
jest: ^29.5.0
Expand All @@ -11447,11 +11457,13 @@ __metadata:
resolution: "unit-testing-vue@workspace:unit-testing/vue"
dependencies:
"@siteimprove/alfa-assert": ^0.65.2
"@siteimprove/alfa-future": ^0.81.0
"@siteimprove/alfa-jest": ^0.65.2
"@siteimprove/alfa-rules": ^0.81.0
"@siteimprove/alfa-vue": ^0.65.2
"@types/jest": ^29.5.1
"@vue/test-utils": ^1.0.0-beta.29
common: "workspace:^"
jest: ^29.5.0
jest-environment-jsdom: ^29.5.0
vue: ^2.6.12
Expand Down

0 comments on commit 236df67

Please sign in to comment.