Skip to content

Commit

Permalink
Move nasty function to tests only
Browse files Browse the repository at this point in the history
  • Loading branch information
mxcl committed Apr 14, 2023
1 parent 48d16e8 commit 706a0c2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
12 changes: 0 additions & 12 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,6 @@ Array.prototype.chuzzle = function<T>() {
console.verbose = console.error
console.debug = console.error

console.silence = async function<T>(body: () => Promise<T>) {
const originals = [console.log, console.info]
try {
console.log = () => {}
console.info = () => {}
return await body()
} finally {
console.log = originals[0]
console.info = originals[1]
}
}

Array.prototype.compact_push = function<T>(item: T | null | undefined) {
if (item) this.push(item)
}
Expand Down
2 changes: 0 additions & 2 deletions tests/integration.suite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ const suite = describe({
proc.close()
}

console.log(cmd, env)

const proc = Deno.run({ cmd, cwd: sandbox.string, stdout, stderr, env, clearEnv: true})
try {
const status = await proc.status()
Expand Down
12 changes: 12 additions & 0 deletions tests/unit/cache.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@ import { assert } from "deno/testing/asserts.ts"
import { useDownload } from "hooks"
import Path from "path"

console.silence = async function<T>(body: () => Promise<T>) {
const originals = [console.log, console.info]
try {
console.log = () => {}
console.info = () => {}
return await body()
} finally {
console.log = originals[0]
console.info = originals[1]
}
}

Deno.test("etag-mtime-check",async () => {
const tmpdir = new Path(await Deno.makeTempDir({ prefix: "tea" }))
try {
Expand Down

0 comments on commit 706a0c2

Please sign in to comment.