Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { Deferred, Logger, setLogger } from "batch-cluster"
import { createHash } from "crypto"
import * as fse from "fs-extra"
import { tmpdir } from "os"
import { join } from "path"
import { env } from "process"
import { orElse } from "./Maybe"
const chai = require("chai")
chai.use(require("chai-as-promised"))
chai.use(require("chai-subset"))
// Tests should be quiet unless LOG is set
setLogger(
Logger.withLevels(
Logger.withTimestamps(
Logger.filterLevels(
{
trace: console.log,
debug: console.log,
info: console.log,
warn: console.warn,
error: console.error
},
orElse(env.LOG as any, "error")
)
)
)
)
export { expect } from "chai"
const exiftool = new ExifTool({
maxProcs: 8,
taskRetries: 3,
streamFlushMillis: 1,
minDelayBetweenSpawnMillis: 0
})
function ellipsize(str: string, max: number) {
str = "" + str
return str.length < max ? str : str.substring(0, max - 1) + "…"
}
// NO SRSLY STOP SCROLLING IT REALLY IS BAD
setLogger(
Logger.withLevels(
Logger.withTimestamps(
Logger.filterLevels(
{
trace: console.log,
debug: console.log,
info: console.log,
warn: console.warn,
error: console.error
},
orElse(env.LOG as any, "info")
)
)
)
)
on("uncaughtException", (error: any) => {
import { Deferred, Logger, setLogger } from "batch-cluster"
import { createHash } from "crypto"
import * as fse from "fs-extra"
import { tmpdir } from "os"
import { join } from "path"
import { env } from "process"
import { orElse } from "./Maybe"
const chai = require("chai")
chai.use(require("chai-as-promised"))
chai.use(require("chai-arrays"))
// Tests should be quiet unless LOG is set
setLogger(
Logger.withLevels(
Logger.withTimestamps(
Logger.filterLevels(
{
trace: console.log,
debug: console.log,
info: console.log,
warn: console.warn,
error: console.error
},
orElse(env.LOG as any, "error")
)
)
)
)
export { expect } from "chai"