-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(logs): simplify the describe (#63)
* docs: update philosophy * chore: add Deno local playground * feat(logs): simplify the describe * fix: allows local variables in beforeEach * refactor(assert): simplify code style
- Loading branch information
1 parent
9b2d643
commit 790ced0
Showing
20 changed files
with
773 additions
and
654 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
export type Control = { | ||
pause: () => void; | ||
continue: () => void; | ||
reset: () => void; | ||
}; | ||
|
||
export type EachConfigs = { | ||
status: boolean; | ||
cb?: () => unknown | Promise<unknown>; | ||
}; | ||
|
||
export const each: { | ||
before: EachConfigs; | ||
after: EachConfigs; | ||
} = { | ||
before: { | ||
status: true, | ||
cb: undefined, | ||
}, | ||
after: { | ||
status: true, | ||
cb: undefined, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { EOL } from 'node:os'; | ||
|
||
export const findFile = (error: Error) => { | ||
const stackLines = error.stack?.split(EOL) || []; | ||
|
||
let file = ''; | ||
|
||
const basePath = 'poku/lib/'; | ||
|
||
for (const line of stackLines) { | ||
if (!line.includes(basePath)) { | ||
const match = line.match( | ||
/at\s(\/.+|file:.+)|^(\s+)at\smodule\scode\s\((\/.+|file:.+)\)/i | ||
); | ||
|
||
// Node and Deno | ||
if (match && match[1]) { | ||
file = match[1]; | ||
break; | ||
} | ||
|
||
// Bun | ||
if (match && match[3]) { | ||
file = match[3]; | ||
break; | ||
} | ||
} | ||
} | ||
|
||
return file; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.