mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-22 23:22:09 +03:00
Compare commits
1 Commits
fix/11060-
...
fix/10028-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
17b35f67d9 |
@@ -94,10 +94,15 @@ export function ensureAndroidCacheDir(options = {}) {
|
||||
*/
|
||||
export function isFatalInstrumentationHookFailure(text) {
|
||||
if (!text) return false;
|
||||
return (
|
||||
/Unsupported platform:\s*android/i.test(text) ||
|
||||
/error occurred while loading instrumentation hook/i.test(text)
|
||||
);
|
||||
// Next.js wraps ANY throw inside instrumentation.register() with the generic
|
||||
// "An error occurred while loading instrumentation hook:" prefix, on every
|
||||
// platform (node_modules/next/dist/server/web/globals.js). That prefix alone
|
||||
// therefore cannot identify the Android/Termux cache-probe failure — a bare
|
||||
// generic instrumentation error on win32/desktop would be misreported as the
|
||||
// Android bug and hide the real cause. Only match when the text actually
|
||||
// carries the Android platform marker that Next's getCacheDirectory() emits.
|
||||
// #10028
|
||||
return /Unsupported platform:\s*android/i.test(text);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
1
changelog.d/fixes/10028-windows-instrumentation-hook.md
Normal file
1
changelog.d/fixes/10028-windows-instrumentation-hook.md
Normal file
@@ -0,0 +1 @@
|
||||
- fix(cli): stop diagnosing every Next.js instrumentation-hook failure as the Android/Termux cache bug — only the Android "Unsupported platform: android" signal now triggers the Android hint, so a win32/desktop instrumentation error surfaces its real cause instead of a useless `mkdir -p ~/.cache` (#10028)
|
||||
@@ -166,6 +166,19 @@ test("isFatalInstrumentationHookFailure: matches Next.js android + hook errors",
|
||||
assert.equal(isFatalInstrumentationHookFailure(""), false);
|
||||
});
|
||||
|
||||
test("isFatalInstrumentationHookFailure: BUG #10028 — generic non-Android instrumentation failure is not Android/Termux", () => {
|
||||
// Next.js wraps ANY throw inside instrumentation.register() with the generic
|
||||
// "An error occurred while loading instrumentation hook:" prefix, on every
|
||||
// platform. Without an actual Android/"Unsupported platform:" signal, that
|
||||
// generic wrapper must NOT be diagnosed as the Android/Termux cache-dir bug,
|
||||
// or a plain win32/desktop failure gets a useless `mkdir -p ~/.cache` hint
|
||||
// and the real cause is hidden.
|
||||
const genericWindowsFailure =
|
||||
"Error: An error occurred while loading instrumentation hook: " +
|
||||
"Cannot find module 'C:\\Users\\dev\\.omniroute\\config.json'";
|
||||
assert.equal(isFatalInstrumentationHookFailure(genericWindowsFailure), false);
|
||||
});
|
||||
|
||||
test("formatAndroidInstrumentationFailureHint: names the cache dir and TERMUX_GUIDE", () => {
|
||||
const hint = formatAndroidInstrumentationFailureHint("/data/home/.cache");
|
||||
assert.match(hint, /\/data\/home\/\.cache/);
|
||||
|
||||
Reference in New Issue
Block a user