Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 0 additions & 48 deletions .github/workflows/release-package.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ dist
yarn-error.log
/@types
/.yarn/install-state.gz
.npmrc
1 change: 0 additions & 1 deletion .npmrc

This file was deleted.

22 changes: 0 additions & 22 deletions bin/gest.cjs

This file was deleted.

4 changes: 4 additions & 0 deletions bin/gest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
DIR=$(dirname "$(dirname $(realpath "${BASH_SOURCE[0]}"))")
SCRIPT="$DIR/dist/esm/base/index.mjs"
gjs -m $SCRIPT $@
11 changes: 9 additions & 2 deletions gest.config.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
export default () => {
/** @type {import("@reactgjs/gest/config").Config} */
/**
* @type {import("@reactgjs/gest/config").Config}
*/
const config = {
testDir: "tests",
srcDir: "src",
parallel: 1,
multiprocessing: false,
errorReporterParser: (err, report) => {
if (err instanceof Error && err.message.includes("Invalid Markup.")) {
if (
err instanceof Error &&
err.message.includes("Invalid Markup.")
) {
return report.message + "\n" + report.getPositionPatch();
}
return report.message;
Expand Down
14 changes: 10 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@reactgjs/gest",
"version": "0.5.0",
"version": "0.6.0-beta.3",
"main": "./dist/esm/user-land/index.mjs",
"types": "./dist/types/user-land/index.d.ts",
"exports": {
Expand All @@ -14,7 +14,7 @@
},
"./config": "./config.ts"
},
"bin": "./bin/gest.cjs",
"bin": "./bin/gest.sh",
"files": [
"bin",
"dist",
Expand Down Expand Up @@ -59,7 +59,10 @@
"_bundledDependencies": [
"dilswer",
"termx-markup",
"fs-gjs"
"fs-gjs",
"path-gjsify",
"gjs-multiprocess",
"@ncpa0cpl/mutex.js"
],
"devDependencies": {
"@ncpa0cpl/nodepack": "~2.3.3",
Expand All @@ -80,7 +83,10 @@
"typescript": "~5.6.3"
},
"dependencies": {
"esbuild": "~0.24.0"
"@ncpa0cpl/mutex.js": "^1.0.1",
"esbuild": "~0.24.0",
"gjs-multiprocess": "0.0.1",
"path-gjsify": "^1.0.0"
},
"resolutions": {
"dilswer": "2.1.1",
Expand Down
16 changes: 13 additions & 3 deletions scripts/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,19 @@ async function main() {
declarations: true,
exclude: /.*\.d\.ts$/,
compileVendors: pkg._bundledDependencies,
esbuildOptions: {
external: ["gi://GLib?version=2.0", "gi://Gio?version=2.0"],
},
preset: { gjs: true },
});

await build({
target: "ES2022",
srcDir: p("./node_modules/gjs-multiprocess/dist/esm/client"),
entrypoint: "client.mjs",
outDir: p("dist/esm/_vendors"),
tsConfig: p("tsconfig.json"),
formats: ["esm"],
bundle: true,
exclude: /.*\.d\.ts$/,
preset: { gjs: true },
});

await generateConfigSchema();
Expand Down
2 changes: 1 addition & 1 deletion src/base/builder/build-file.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import path from "path-gjsify";
import { Command } from "../command/command";
import { btoa } from "../utils/base64";
import type { ConfigFacade } from "../utils/config";
import { getDirname } from "../utils/get-dirname";
import path from "../utils/path";
import type {
BSMJsonValue,
BSMValue,
Expand Down
43 changes: 30 additions & 13 deletions src/base/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import Fs from "fs-gjs";
import GLib from "gi://GLib?version=2.0";
import path from "path-gjsify";
import system from "system";
import { html, Output } from "termx-markup";
import { Global } from "./globals";
import { Mainloop } from "./mainloop";
import { ProgressTracker } from "./progress/progress";
import { ProgressReporter } from "./progress/reporter";
import type { TestRunnerOptions, TestSuite } from "./test-runner";
import { TestRunner } from "./test-runner";
import { MainRunner } from "./runner/main-runner";
import { Multiprocessing } from "./runner/subprocess/server";
import type { TestRunnerOptions, TestSuite } from "./runner/types";
import { _getArgValue } from "./utils/args";
import { loadConfig } from "./utils/config";
import { ConsoleInterceptor } from "./utils/console-interceptor/console-interceptor";
Expand All @@ -18,7 +20,6 @@ import {
} from "./utils/errors/error-handling";
import { walkFiles } from "./utils/filesystem";
import { getDirname } from "./utils/get-dirname";
import path from "./utils/path";
import { preloadGiLibs } from "./utils/preload-gi-libs";
import { initFakeTimers } from "./utils/timers";

Expand All @@ -36,6 +37,7 @@ globalThis.__gest_ = {
};

async function main() {
let failed = false;
try {
const startTime = currentMicrosecond();

Expand All @@ -51,12 +53,13 @@ async function main() {
<br />
<line>Options:</line>
<pad size="2">
<line>-h, --help</line>
<line>-v, --verbose</line>
<line>-f, --file [path]</line>
<line>-t, --testNamePattern [regex]</line>
<line>-p, --testPathPattern [regex]</line>
<line>-s, --silenceLogs</line>
<line>-h, --help Show this message.</line>
<line>-v, --verbose Show detailed info on each test pass.</line>
<line>-f, --file [path] Provide a specific test file to run.</line>
<line>-t, --testNamePattern [regex] Pattern to match test names.</line>
<line>-p, --testPathPattern [regex] Pattern to match test file names.</line>
<line>-s, --silenceLogs Silence all logs from within tests.</line>
<line>-m, --multiprocessing Disable or enable multiprocessing.</line>
</pad>
`);

Expand All @@ -76,6 +79,11 @@ async function main() {
);
const silenceLogs =
pargs.includes("-s") || pargs.includes("--silenceLogs");
const multiprocessing = _getArgValue(
pargs,
"-m",
"--multiprocessing",
);

const options: TestRunnerOptions = {
verbose: pargs.includes("--verbose") || pargs.includes("-v"),
Expand Down Expand Up @@ -117,6 +125,13 @@ async function main() {

await preloadGiLibs(config);

if (multiprocessing != null) {
config.override(
"multiprocessing",
["false", "0"].includes(multiprocessing) ? false : true,
);
}

const testsDir = path.resolve(Global.getCwd(), config.testDir);
const parallel = config.parallel;

Expand Down Expand Up @@ -190,7 +205,7 @@ async function main() {
}
});

const consoleInterceptor = ConsoleInterceptor.init();
const consoleInterceptor = ConsoleInterceptor.getInterceptor();

const progressTracker = new ProgressTracker(config);

Expand All @@ -205,7 +220,7 @@ async function main() {
const testRunners = Array.from(
{ length: parallel },
() =>
new TestRunner(testFiles, config, progressTracker, options),
new MainRunner(testFiles, config, progressTracker, options),
);

await Promise.all(testRunners.map((runner) => runner.start()));
Expand Down Expand Up @@ -235,8 +250,10 @@ async function main() {
<br /><br />
<pre>${_getErrorStack(e, undefined)}</pre>`,
);

Mainloop.exit(1);
failed = true;
} finally {
await Multiprocessing.close().catch(() => {});
Mainloop.exit(failed ? 1 : undefined);
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/base/progress/progress-utils/progress-parsed-error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ import type { TestHook } from "../../../user-land/test-collector";
export type ProgressErrorReport = {
thrown: unknown;
origin: "lifecycleHook" | "test" | "gest";
hook?: TestHook;
hook?: Omit<TestHook, "callback">;
};

export type ProgressErrorReportParsed = {
thrown: unknown;
origin: "lifecycleHook" | "test" | "gest";
message: string;
errorType?: string;
stack?: string;
link?: string;
};
Loading
Loading