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
2 changes: 1 addition & 1 deletion typescript/packages/common-builder/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"name": "@commontools/builder",
"exports": "./src/index.ts",
"tasks": {
"build": "../scripts/build.ts"
"test": "deno test"
}
}
3 changes: 3 additions & 0 deletions typescript/packages/common-charm/deno.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"name": "@commontools/charm",
"tasks": {
"test": "deno test"
},
"exports": "./src/index.ts"
}
3 changes: 2 additions & 1 deletion typescript/packages/common-cli/deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"tasks": {
"start": "deno run --allow-read --allow-env --allow-net main.ts",
"memtest": "deno run --allow-read --allow-env --allow-net memory_test.ts"
"memtest": "deno run --allow-read --allow-env --allow-net memory_test.ts",
"test": "deno test"
}
}
2 changes: 1 addition & 1 deletion typescript/packages/common-html/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"name": "@commontools/html",
"exports": "./src/index.ts",
"tasks": {
"test-browser": "../scripts/test-browser.ts test-browser/**/*.ts"
"test": "deno test"
}
}
3 changes: 3 additions & 0 deletions typescript/packages/common-os-ui/deno.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"name": "@commontools/os-ui",
"tasks": {
"test": "deno test"
},
"exports": "./src/index.ts",
"imports": {
"@codemirror/lang-css": "npm:@codemirror/lang-css@^6.3.1",
Expand Down
3 changes: 3 additions & 0 deletions typescript/packages/common-runner/deno.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"name": "@commontools/runner",
"tasks": {
"test": "deno test"
},
"exports": "./src/index.ts"
}
2 changes: 1 addition & 1 deletion typescript/packages/common-runner/src/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export function run<T, R = any>(

const internal = {
...(deepCopy(defaults) as { internal: any })?.internal,
...recipe.initial?.internal,
...(recipe.initial as { internal: any } | void)?.internal,
...processCell.get()?.internal,
};

Expand Down
3 changes: 3 additions & 0 deletions typescript/packages/common-ui/deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"name": "@commontools/ui",
"exports": "./src/index.ts",
"tasks": {
"test": "echo 'No tests to run.'"
},
"imports": {
"@shoelace-style/shoelace": "npm:@shoelace-style/shoelace@^2.19.1"
}
Expand Down
2 changes: 1 addition & 1 deletion typescript/packages/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"./toolshed"
],
"tasks": {
"test-all": "./scripts/test-all.sh"
"test-all": "./scripts/test-all.ts"
},
"compilerOptions": {
"jsx": "react-jsxdev",
Expand Down
3 changes: 2 additions & 1 deletion typescript/packages/jumble/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"tasks": {
"dev": "deno run -A --node-modules-dir=auto npm:vite",
"build": "deno run -A --node-modules-dir=auto npm:vite build",
"preview": "deno run -A --node-modules-dir=auto npm:vite preview"
"preview": "deno run -A --node-modules-dir=auto npm:vite preview",
"test": "echo 'No tests to run.'"
},
"imports": {
"@/": "./src/",
Expand Down
3 changes: 3 additions & 0 deletions typescript/packages/llm-client/deno.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"name": "@commontools/llm-client",
"tasks": {
"test": "echo 'No tests to run.'"
},
"exports": "./src/index.ts"
}
42 changes: 0 additions & 42 deletions typescript/packages/scripts/test-all.sh

This file was deleted.

55 changes: 55 additions & 0 deletions typescript/packages/scripts/test-all.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/usr/bin/env -S deno run --allow-read --allow-run
import * as path from "jsr:@std/path";

const decoder = new TextDecoder();
const workspaceCwd = Deno.cwd();
const manifest = JSON.parse(await Deno.readTextFile("./deno.json"));
const members: string[] = manifest.workspace;

const DISABLED = [
"common-cli", // Disabled until `memory_test.ts` passes
"common-html", // Disabled until we get tests and jsx in tests passing
"common-identity", // Disabled until we have web test runner
"common-iframe-sandbox", // Disabled until we have web test runner
"deno-vite-plugin", // Do not test vendored code
"toolshed", // Requires extra configuration to run (e.g. redis)
];

let success = true;
for (const memberPath of members) {
// Convert "./common-memory" to "common-memory"
const packageName = memberPath.substring(2);
if (DISABLED.includes(packageName)) {
continue;
}
console.log(`Testing ${packageName}...`);
const packagePath = path.join(workspaceCwd, packageName);
if (!await testPackage(packagePath)) {
success = false;
}
}

if (success) {
console.log("All tests passing!");
} else {
console.error("One or more tests failed.");
Deno.exit(1);
}

async function testPackage(packagePath: string): Promise<boolean> {
const result = await new Deno.Command(Deno.execPath(), {
args: ["task", "test"],
cwd: packagePath,
stdout: "piped",
}).output();

const stdout = decoder.decode(result.stdout);
if (stdout) {
console.log(stdout);
}
const stderr = decoder.decode(result.stderr);
if (stderr) {
console.error(stderr);
}
return result.success;
}