Files
screeps-deploy-action/scratch/test_glob.js
T
Philipp b6cef04a9c
Lint / pre-commit Linting (push) Successful in 42s
Test / Run Tests (push) Successful in 1m3s
feat: implement fail-fast monitoring to stop as soon as error/traceback is detected
2026-05-16 18:28:54 +02:00

30 lines
805 B
JavaScript

import { glob } from "glob";
import path from "path";
import os from "os";
import fs from "fs";
async function test() {
const tempDir = await fs.promises.mkdtemp(
path.join(os.tmpdir(), "glob-test-"),
);
const file = path.join(tempDir, "test.js");
await fs.promises.writeFile(file, "test");
const pattern = "*.js";
const globPattern = path.join(tempDir, pattern);
console.log("globPattern:", globPattern);
const files = await glob(globPattern);
console.log("found files:", files);
// Fix for windows
const fixedPattern = globPattern.replace(/\\/g, "/");
console.log("fixedPattern:", fixedPattern);
const fixedFiles = await glob(fixedPattern);
console.log("found fixed files:", fixedFiles);
await fs.promises.rm(tempDir, { recursive: true, force: true });
}
test();