修复环境探测测试夹具触发配置检查的问题
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Has been cancelled
Project CI / Backend tests (pull_request) Has been cancelled
Project CI / Native shell tests (pull_request) Has been cancelled
Project CI / Frontend tests (pull_request) Has been cancelled
Project CI / Repository checks (pull_request) Has been cancelled
Project CI / AI game creator shell Rust crates (pull_request) Has been cancelled
Project CI / AI game creator shell web tests (pull_request) Has been cancelled
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Has been cancelled
Project CI / AI game creator shell Rust smoke (pull_request) Has been cancelled
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Has been cancelled
Project CI / Backend tests (pull_request) Has been cancelled
Project CI / Native shell tests (pull_request) Has been cancelled
Project CI / Frontend tests (pull_request) Has been cancelled
Project CI / Repository checks (pull_request) Has been cancelled
Project CI / AI game creator shell Rust crates (pull_request) Has been cancelled
Project CI / AI game creator shell web tests (pull_request) Has been cancelled
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Has been cancelled
Project CI / AI game creator shell Rust smoke (pull_request) Has been cancelled
将 Node 环境断言移入独立测试夹具并通过 include_str 引用 保持生产配置检查规则与预检实现不变 同步定向验证入口说明
This commit is contained in:
@@ -669,24 +669,7 @@ mod tests {
|
||||
let fixture = root.path().join("probe.cjs");
|
||||
fs::write(
|
||||
&fixture,
|
||||
r#"
|
||||
const assert = require('node:assert/strict');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const home = process.env.HOME;
|
||||
assert.ok(home && fs.statSync(home).isDirectory());
|
||||
for (const key of ['USERPROFILE', 'APPDATA', 'LOCALAPPDATA']) {
|
||||
assert.equal(process.env[key], home);
|
||||
}
|
||||
assert.equal(fs.realpathSync(process.cwd()), fs.realpathSync(home));
|
||||
assert.equal(fs.realpathSync(require('node:os').homedir()), fs.realpathSync(home));
|
||||
for (const key of ['npm_config_userconfig', 'npm_config_globalconfig']) {
|
||||
assert.equal(path.dirname(process.env[key]), home);
|
||||
assert.equal(fs.readFileSync(process.env[key], 'utf8'), '');
|
||||
}
|
||||
assert.equal(process.env.npm_config_cache, path.join(home, 'npm-cache'));
|
||||
console.log('1.0.0');
|
||||
"#,
|
||||
include_str!("../tests/fixtures/environment-probe.cjs"),
|
||||
)
|
||||
.unwrap();
|
||||
let fixture_runtime = NodeRuntime {
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
const assert = require('node:assert/strict');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
|
||||
const home = process.env.HOME;
|
||||
assert.ok(home && fs.statSync(home).isDirectory());
|
||||
for (const key of ['USERPROFILE', 'APPDATA', 'LOCALAPPDATA']) {
|
||||
assert.equal(process.env[key], home);
|
||||
}
|
||||
assert.equal(fs.realpathSync(process.cwd()), fs.realpathSync(home));
|
||||
assert.equal(
|
||||
fs.realpathSync(require('node:os').homedir()),
|
||||
fs.realpathSync(home),
|
||||
);
|
||||
for (const key of ['npm_config_userconfig', 'npm_config_globalconfig']) {
|
||||
assert.equal(path.dirname(process.env[key]), home);
|
||||
assert.equal(fs.readFileSync(process.env[key], 'utf8'), '');
|
||||
}
|
||||
assert.equal(process.env.npm_config_cache, path.join(home, 'npm-cache'));
|
||||
process.stdout.write('1.0.0\n');
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
Node/npm 版本探测清空继承环境后,必须设置客户端创建的临时 `HOME`、`USERPROFILE`、`APPDATA` 和 `LOCALAPPDATA`,并指定空的用户及全局 npm 配置、临时缓存和临时工作目录。临时目录保留到探测子进程退出,不依赖 Windows 用户资料查询,也不读取用户或项目的 `.npmrc`。探测继续使用校验后的客户端运行时;初始化临时环境失败返回 `runtime-probe-home-unavailable`,不回退到系统 Node 或真实用户目录。
|
||||
|
||||
验证使用真实 Node/npm 的 `environment_check::tests::real_node_npm_environment_versions`,同时用 Node 脚本检查隔离目录及空配置,避免正常机器的 Windows 后备查询掩盖回归。此测试需要本地 Node/npm,默认忽略,定向验收时显式运行。
|
||||
验证使用真实 Node/npm 的 `environment_check::tests::real_node_npm_environment_versions`,同时用 `src-tauri/tests/fixtures/environment-probe.cjs` 检查隔离目录及空配置,避免正常机器的 Windows 后备查询掩盖回归。测试通过 `include_str!` 引用独立夹具,不把 Node 环境断言内嵌到生产源码扫描范围。此测试需要本地 Node/npm,默认忽略,定向验收时显式运行;另运行 `npm run ai-game-creator-shell:typecheck` 覆盖配置静态检查。
|
||||
|
||||
## 2026-09-28 AGC 客户端现行分工:离线前端、事件驱动与维护态出口
|
||||
|
||||
|
||||
Reference in New Issue
Block a user