Skip to content
Closed
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
10 changes: 10 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,13 @@ jobs:
run: cargo check --locked -p raea-cli --tests
- name: unit tests (the crates with no GPU or media device)
run: cargo test --locked -p raea-io-media -p raea-core-fonts -p raea-native
# the checks, the CLI's help guards, specs, workspaces, tools and the K kernels (their GPU twins
# through the interpreter): none needs a GPU, and the check and CLI crates had the most tests and ran in none
- name: unit tests (check, CLI, specs, workspace, tools, kernels)
# raea-cli's skill tests read the raea-skills submodule (the checkout above doesn't fetch submodules)
# no debug info in the test builds: these crates link the engine, and full debug info filled the runner's disk
env:
CARGO_PROFILE_TEST_DEBUG: "0"
run: |
git submodule update --init skills
cargo test --locked -p raea-app-check -p raea-cli -p raea-core-brief -p raea-app-workspace -p raea-app-tools -p raea-core-k -p raea-bundle
9 changes: 8 additions & 1 deletion apps/workspace/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@ fn a_name_is_its_folder() {
fn a_spec_module_is_tidy_typescript() {
// keys unquoted where they can be, nulls and empty lists left out, whole numbers whole, short string lists inline
let v = json!({"id": "delivery", "help": null, "tags": [], "n": 45.0, "options": ["9:16", "16:9"], "odd-key": 1});
assert_eq!(ts_literal(&v, 0), "{\n id: \"delivery\",\n n: 45,\n \"odd-key\": 1,\n options: [\"9:16\", \"16:9\"],\n}");
// the keys come in the map's order, which serde_json's preserve_order feature changes (it's on in raea-cli's build:
// testing this crate with raea-cli unifies it on), so the lines are compared as a set
let out = ts_literal(&v, 0);
let mut got: Vec<&str> = out.lines().collect();
got.sort();
let mut want = vec!["{", " id: \"delivery\",", " n: 45,", " \"odd-key\": 1,", " options: [\"9:16\", \"16:9\"],", "}"];
want.sort();
assert_eq!(got, want, "{out}");
}

#[test]
Expand Down
11 changes: 7 additions & 4 deletions engine/bundle/tests/bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,12 @@ fn bundles_a_script_with_the_engines_resolution() {
w("js/shims/node/zlib.ts", "export const gzip = () => 'ZLIB_SHIM';\n");
w("js/node_modules/react/package.json", r#"{ "name": "react", "main": "index.js" }"#);
w("js/node_modules/react/index.js", "export const version = 'ENGINE_REACT';\n");
w("motion/index.tsx", "export const motion = 'MOTION_INDEX';\n");
w("motion/ecs.ts", "export const ecs = 'MOTION_ECS';\n");
w("motion/prelude.ts", "export const prelude = 'MOTION_PRELUDE';\n");
// the SDK as the engine lays it out: sdk/raea/src, its names in sdk/tsconfig.base.json's paths (the test's own list,
// so it doesn't depend on the repository's)
w("sdk/tsconfig.base.json", r#"{ "compilerOptions": { "paths": { "raea": ["./raea/src/prelude.ts"], "raea/ecs": ["./raea/src/ecs.ts"], "raea/*": ["./raea/src/*"] } } }"#);
w("sdk/raea/src/index.tsx", "export const motion = 'MOTION_INDEX';\n");
w("sdk/raea/src/ecs.ts", "export const ecs = 'MOTION_ECS';\n");
w("sdk/raea/src/prelude.ts", "export * from './index';\nexport const prelude = 'MOTION_PRELUDE';\n");
w("lib/aliased.ts", "export const aliased = 'ALIASED';\n");
// the script's own folder carries another react: the engine's must win
w("work/node_modules/react/package.json", r#"{ "name": "react", "main": "index.js" }"#);
Expand All @@ -125,7 +128,7 @@ import { version } from "react";
"#);
let script = raea_bundle::script::Script {
js: d.join("js"),
motion: d.join("motion"),
motion: d.join("sdk/raea/src"),
shell: d.join("nope.ts"),
aliases: [("~lib".to_string(), d.join("lib/aliased.ts"))].into_iter().collect(),
stubs: vec!["fs".into()],
Expand Down
Loading