Skip to content
This repository was archived by the owner on Jun 26, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ dist
.yarn/install-state.gz
.pnp.*

# test build artifacts
# build artifacts

__fixtures__/dist
__fixtures__/dist
packages/*/build
6 changes: 6 additions & 0 deletions babel.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default {
presets: [
["@babel/preset-env", { targets: { node: "current" } }],
"@babel/preset-typescript",
],
};
14 changes: 14 additions & 0 deletions base-tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"compilerOptions": {
"composite": true,
"target": "ES2024",
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"noUncheckedIndexedAccess": true
}
}
3 changes: 2 additions & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import globals from "globals";

export default tseslint.config(
{
ignores: ["dist/**", "__fixtures__/dist/**"],
ignores: ["dist/**", "__fixtures__/dist/**", "packages/**/build"],
},
{
extends: [eslint.configs.recommended],
Expand All @@ -28,6 +28,7 @@ export default tseslint.config(
tsconfigRootDir: import.meta.dirname,
},
},
// include d.ts files:
files: ["**/*.ts"],
},
);
11 changes: 6 additions & 5 deletions jest.config.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { createJsWithTsEsmPreset } from "ts-jest";
// import { createJsWithTsEsmPreset } from "ts-jest";

const presetConfig = createJsWithTsEsmPreset({
//...options
});
// const presetConfig = createJsWithTsEsmPreset({
// //...options
// });

const jestConfig = {
...presetConfig,
// ...presetConfig,
preset: "jest-puppeteer",
globalSetup: "./jest-setup.mjs",
testPathIgnorePatterns: ["/node_modules/", "packages/.*/build"],
};

export default jestConfig;
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
"test": "jest",
"test:watch": "jest --watch",
"install-puppeteer-browser": "puppeteer browsers install chrome",
"lint": "eslint . && prettier --list-different . && tsc",
"lint": "eslint . && prettier --list-different .",
"build": "webpack",
"clean": "tsc --build --clean && find ./packages -type d -name \"build\" -exec rm -rf {} +",
"format": "prettier --write .",
"prepare": "husky"
},
Expand All @@ -21,13 +22,17 @@
"license": "BSD-3-Clause",
"packageManager": "pnpm@10.6.2",
"devDependencies": {
"@babel/core": "^7.26.10",
"@babel/preset-env": "^7.26.9",
"@babel/preset-typescript": "^7.27.0",
"@eslint/js": "^9.22.0",
"@freecodecamp/curriculum-helpers": "3.10.0",
"@types/chai": "^4.3.20",
"@types/enzyme": "^3.10.18",
"@types/enzyme-adapter-react-16": "^1.0.9",
"@types/jest": "^29.5.14",
"@types/jquery": "^3.5.32",
"babel-jest": "^29.7.0",
"chai": "^4.5.0",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.8",
Expand All @@ -45,7 +50,6 @@
"prettier": "^3.5.3",
"process": "^0.11.10",
"puppeteer": "^24.4.0",
"ts-jest": "^29.2.6",
"ts-loader": "^9.5.2",
"typescript": "^5.8.2",
"typescript-eslint": "^8.26.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* @jest-environment jsdom */

import { FrameTestEvaluator } from "../src/test-evaluators/frame-test-evaluator";
import { FrameTestEvaluator } from "./frame-test-evaluator";

// This is a limited reset, but should be enough if we only add or remove
// elements.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import type {
Fail,
TestEvent,
InitEvent,
} from "./test-evaluator";
} from "../../../types/test-evaluator";

import type { ReadyEvent, ResultEvent } from "../test-runner";
import type { ReadyEvent, ResultEvent } from "../../../types/test-runner";

const READY_MESSAGE: ReadyEvent["data"] = { type: "ready" };

Expand Down
8 changes: 8 additions & 0 deletions packages/frame-evaluators/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../../base-tsconfig.json",
"compilerOptions": {
"rootDir": "./src",
"lib": ["dom"],
"outDir": "./build"
}
}
File renamed without changes.
File renamed without changes.
13 changes: 7 additions & 6 deletions src/test-runner.ts → packages/main/src/test-runner.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import type { InitTestFrameOptions } from "./test-evaluators/frame-test-evaluator";
import type { InitEvent, TestEvent } from "./test-evaluators/test-evaluator";
import type { InitWorkerOptions } from "./test-evaluators/worker-test-evaluator";
import type { ReadyEvent, ResultEvent } from "../../../types/test-runner";
import type {
InitEvent,
TestEvent,
InitWorkerOptions,
InitTestFrameOptions,
} from "../../../types/test-evaluator";

interface Runner {
init(opts?: InitOptions): Promise<void>;
Expand Down Expand Up @@ -33,9 +37,6 @@ type InitOptions = {
};
};

export type ReadyEvent = MessageEvent<{ type: "ready" }>;
export type ResultEvent = MessageEvent<{ type: "result"; value: unknown }>;

export class FrameTestRunner implements Runner {
#testEvaluator: HTMLIFrameElement;
#createTestEvaluator({ source, assetPath, script }: RunnerConfig) {
Expand Down
7 changes: 7 additions & 0 deletions packages/main/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../base-tsconfig.json",
"compilerOptions": {
"rootDir": "./src",
"outDir": "./build"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* @jest-environment jsdom */

import { WorkerTestEvaluator } from "../src/test-evaluators/worker-test-evaluator";
import { WorkerTestEvaluator } from "./worker-test-evaluator";

describe("WorkerTestEvaluator", () => {
let messenger: WorkerTestEvaluator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import type {
Fail,
InitEvent,
TestEvent,
} from "./test-evaluator";
import type { ResultEvent, ReadyEvent } from "../test-runner";
} from "../../../types/test-evaluator";
import type { ResultEvent, ReadyEvent } from "../../../types/test-runner";

const READY_MESSAGE: ReadyEvent["data"] = { type: "ready" };
declare global {
Expand Down
8 changes: 8 additions & 0 deletions packages/workers/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../../base-tsconfig.json",
"compilerOptions": {
"rootDir": "./src",
"lib": ["WebWorker"],
"outDir": "./build"
}
}
Loading