fix(test): derive nitro scan cache path from cwd
This commit is contained in:
1 parent
1db49263eb
commit
463bc2cb47
1 file changed
+10
-7
@@ -1,7 +1,15 @@
|
|||||||
// @vitest-environment node
|
// @vitest-environment node
|
||||||
import { createHash } from "node:crypto";
|
import { createHash } from "node:crypto";
|
||||||
|
import path from "node:path";
|
||||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||||
|
|
||||||
|
const SCAN_CACHE_FILE = path.join(
|
||||||
|
process.cwd(),
|
||||||
|
"storage",
|
||||||
|
"nitro-cleanup",
|
||||||
|
"scan-cache.json",
|
||||||
|
);
|
||||||
|
|
||||||
type AnyFn = (...args: any[]) => any;
|
type AnyFn = (...args: any[]) => any;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@@ -490,8 +498,7 @@ describe("refreshScanCacheAfterMutation", () => {
|
|||||||
"icon\u0000/assets/icons": dirSignature([]),
|
"icon\u0000/assets/icons": dirSignature([]),
|
||||||
};
|
};
|
||||||
const files = installFileState({
|
const files = installFileState({
|
||||||
"/var/www/atom-nexst/storage/nitro-cleanup/scan-cache.json":
|
[SCAN_CACHE_FILE]: JSON.stringify({
|
||||||
JSON.stringify({
|
|
||||||
dirs,
|
dirs,
|
||||||
result: {
|
result: {
|
||||||
fake: [
|
fake: [
|
||||||
@@ -517,11 +524,7 @@ describe("refreshScanCacheAfterMutation", () => {
|
|||||||
|
|
||||||
await refreshScanCacheAfterMutation("nitro", ["ghost.nitro"], 1);
|
await refreshScanCacheAfterMutation("nitro", ["ghost.nitro"], 1);
|
||||||
|
|
||||||
const written = JSON.parse(
|
const written = JSON.parse(files.get(SCAN_CACHE_FILE) as string) as {
|
||||||
files.get(
|
|
||||||
"/var/www/atom-nexst/storage/nitro-cleanup/scan-cache.json",
|
|
||||||
) as string,
|
|
||||||
) as {
|
|
||||||
dirs: Record<string, string>;
|
dirs: Record<string, string>;
|
||||||
result: {
|
result: {
|
||||||
fake: Array<{ fileName: string }>;
|
fake: Array<{ fileName: string }>;
|
||||||
|
|||||||
Reference in new issue
Block a user