-
Notifications
You must be signed in to change notification settings - Fork 0
feat(Core): create initial core package #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
ElijahKotyluk
wants to merge
13
commits into
master
Choose a base branch
from
feat/core
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
6d209de
chore(Test): add initial test class and interface with run method.
ElijahKotyluk 8cf71e2
chore(Core): initial core implementations.
ElijahKotyluk 296b015
chore(core): link and clean up.
ElijahKotyluk f28d3f2
chore(onyx): remove unused dependencies and files, comment out ci tes…
ElijahKotyluk 17cb915
chore(core): remove debug logs.
ElijahKotyluk 9a9e95b
chore(matchers): create initial deepEqual, test framwork with itself.
ElijahKotyluk f0811b0
chore(esbuild): add script.
ElijahKotyluk 6383233
chore(onyx): add config stuff, update onyx test.
ElijahKotyluk 7e47fb3
chore(eslint): ignore onyx.mjs.
ElijahKotyluk 11f2d9f
chore(eslint): add esbuild script to ignore.
ElijahKotyluk 4cdb45f
test(test): update describe description.
ElijahKotyluk 3fcca6d
chore(ci): comment out coverage until onyx can do it.
ElijahKotyluk cf2545b
refactor(deepEqual): direct index iteration.
ElijahKotyluk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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,58 @@ | ||
| interface TestTask { | ||
| description: string; | ||
| fn: () => Promise<void> | void; | ||
| result?: TestResult; | ||
| } | ||
|
|
||
| interface TestResult { | ||
| test: Test; | ||
| status: Extract<TaskStatus, "pass" | "fail" | "skipped">; | ||
| error?: Error; | ||
| duration?: number; | ||
| } | ||
|
|
||
| enum TaskStatus { | ||
| Pending = "pending", | ||
| Running = "running", | ||
| Pass = "pass", | ||
| Fail = "fail", | ||
| Skipped = "skipped", | ||
| } | ||
|
|
||
| class Test implements Test { | ||
|
ElijahKotyluk marked this conversation as resolved.
Outdated
|
||
| description: string; | ||
| fn: () => Promise<void> | void; | ||
| state: TaskStatus = TaskStatus.Pending; | ||
|
|
||
| // parent?: Suite; // @TODO - this should be a reference to the parent once they are created | ||
| result?: TestResult; | ||
|
|
||
| constructor(description: string, fn: () => Promise<void> | void) { | ||
| this.description = description; | ||
| this.fn = fn; | ||
| } | ||
|
|
||
| async run() { | ||
| const start = performance.now(); | ||
|
|
||
| try { | ||
| this.state = TaskStatus.Running; | ||
| await this.fn(); | ||
|
|
||
| this.result = { | ||
| test: this, | ||
| status: TaskStatus.Pass, | ||
|
ElijahKotyluk marked this conversation as resolved.
Outdated
|
||
| duration: performance.now() - start, | ||
| }; | ||
| } catch (error) { | ||
| this.result = { | ||
| test: this, | ||
| status: TaskStatus.Fail, | ||
|
ElijahKotyluk marked this conversation as resolved.
Outdated
|
||
| error: error instanceof Error ? error : new Error(String(error)), | ||
| duration: performance.now() - start, | ||
| }; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| export { Test, type TestResult, type TestTask }; | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.