-
Notifications
You must be signed in to change notification settings - Fork 5
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
feat: only and skip support #55
Closed
Closed
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
c749613
[issue-#5-only] Add tests
13f143b
[issue-#5-only] WIP: support only
a9ef309
Merge branch 'master' into issue-#5-only
de8407c
[issue-#5-only] Got only usage working, temp changed output format
e4b8201
issue-#5-only add skip support
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { Rhum } from "../../mod.ts"; | ||
|
||
Rhum.testPlan("test_plan_1", () => { | ||
Rhum.testSuite("test_suite_1a", () => { | ||
Rhum.testCase("test_case_1a1", () => { | ||
Rhum.asserts.assertEquals(true, true); | ||
}); | ||
Rhum.testCase("test_case_1a2", () => { | ||
Rhum.asserts.assertEquals(true, true); | ||
}); | ||
Rhum.testCase("test_case_1a3", () => { | ||
Rhum.asserts.assertEquals(true, true); | ||
}); | ||
}); | ||
|
||
Rhum.testSuite("test_suite_1b", () => { | ||
Rhum.testCase("test_case_1b1", () => { | ||
Rhum.asserts.assertEquals(true, true); | ||
}); | ||
Rhum.only("test_case_1b2", () => { | ||
Rhum.asserts.assertEquals(true, true); | ||
}); | ||
Rhum.testCase("test_case_1b3", () => { | ||
Rhum.asserts.assertEquals(true, true); | ||
}); | ||
}); | ||
}); | ||
|
||
Rhum.run(); |
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,29 @@ | ||
import { Rhum } from "../../mod.ts"; | ||
|
||
Rhum.testPlan("test_plan_1", () => { | ||
Rhum.testSuite("test_suite_1a", () => { | ||
Rhum.testCase("test_case_1a1", () => { | ||
Rhum.asserts.assertEquals(true, true); | ||
}); | ||
Rhum.testCase("test_case_1a2", () => { | ||
Rhum.asserts.assertEquals(true, true); | ||
}); | ||
Rhum.testCase("test_case_1a3", () => { | ||
Rhum.asserts.assertEquals(true, true); | ||
}); | ||
}); | ||
|
||
Rhum.only("test_suite_1b", () => { | ||
Rhum.testCase("test_case_1b1", () => { | ||
Rhum.asserts.assertEquals(true, true); | ||
}); | ||
Rhum.testCase("test_case_1b2", () => { | ||
Rhum.asserts.assertEquals(true, true); | ||
}); | ||
Rhum.testCase("test_case_1b3", () => { | ||
Rhum.asserts.assertEquals(true, true); | ||
}); | ||
}); | ||
}); | ||
|
||
Rhum.run(); |
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
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,93 @@ | ||
import { StdAsserts as asserts, colors } from "../../deps.ts"; | ||
import {Rhum} from "../../mod.ts"; | ||
|
||
/** | ||
* To be clear, we are making sure that when a user runs their tests using Bourbon, that everything works correctly, | ||
* and the output is correct | ||
*/ | ||
|
||
Deno.test({ | ||
name: "Integration | only_test.ts | Only runs the test case that has `Rhum.only`", | ||
async fn(): Promise<void> { | ||
const p = await Deno.run({ | ||
cmd: [ | ||
"deno", | ||
"test", | ||
"--allow-run", | ||
"--allow-env", | ||
"example_tests/only/only_case.ts", | ||
], | ||
stdout: "piped", | ||
stderr: "piped", | ||
env: {"NO_COLOR": "false"}, | ||
}); | ||
const status = await p.status(); | ||
p.close(); | ||
asserts.assertEquals(status.success, true); | ||
asserts.assertEquals(status.code, 0); | ||
/** | ||
* Because the timing for each test is dynamic, we can't really test it ("... ok (3ms)"), so strip all that out | ||
*/ | ||
let stdout = new TextDecoder("utf-8") | ||
.decode(await p.output()) | ||
.replace(/\(\d+ms\)/g, ""); // (*ms) | ||
/** | ||
* There are also some odd empty lines at the end of the stdout... so we just strip those out | ||
*/ | ||
stdout = stdout.substring(0, stdout.indexOf("filtered out") + 12); | ||
|
||
Rhum.asserts.assertEquals(stdout, | ||
"running 1 tests\n" + | ||
" \n" + | ||
"test_plan_1\n" + | ||
" test_suite_1b\n" + | ||
" test_case_1b2 ... ok \n" + | ||
"\n" + | ||
"test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out " | ||
) | ||
} | ||
}) | ||
|
||
Deno.test({ | ||
name: "Integration | only_test.ts | Only runs the test suite that has `Rhum.only`", | ||
async fn(): Promise<void> { | ||
const p = await Deno.run({ | ||
cmd: [ | ||
"deno", | ||
"test", | ||
"--allow-run", | ||
"--allow-env", | ||
"example_tests/only/only_suite.ts", | ||
], | ||
stdout: "piped", | ||
stderr: "piped", | ||
env: {"NO_COLOR": "false"}, | ||
}); | ||
const status = await p.status(); | ||
p.close(); | ||
asserts.assertEquals(status.success, true); | ||
asserts.assertEquals(status.code, 0); | ||
/** | ||
* Because the timing for each test is dynamic, we can't really test it ("... ok (3ms)"), so strip all that out | ||
*/ | ||
let stdout = new TextDecoder("utf-8") | ||
.decode(await p.output()) | ||
.replace(/\(\d+ms\)/g, ""); // (*ms) | ||
/** | ||
* There are also some odd empty lines at the end of the stdout... so we just strip those out | ||
*/ | ||
stdout = stdout.substring(0, stdout.indexOf("filtered out") + 12); | ||
|
||
Rhum.asserts.assertEquals(stdout, | ||
"running 1 tests\n" + | ||
" \n" + | ||
"test_plan_1\n" + | ||
" test_suite_1b\n" + | ||
" test_case_1b1 ... ok \n" + | ||
" test_case_1b2 ... ok \n" + | ||
" test_case_1b2 ... ok \n" + | ||
"\n" + | ||
"test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out " | ||
) | ||
} | ||
}) |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to figure this out