Skip to content

Commit

Permalink
added test report output cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
timbrinded committed Sep 13, 2023
1 parent c3900c5 commit 4973189
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .changeset/cold-turkeys-hang.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@moonwall/types": patch
"@moonwall/cli": patch
"@moonwall/tests": patch
---

Added reporter outputs
1 change: 1 addition & 0 deletions packages/cli/src/cmds/runTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export async function executeTests(env: Environment, additionalArgs?: object) {
watch: false,
globals: true,
reporters: env.reporters ? env.reporters : ["default"],
outputFile: env.reportFile,
testTimeout: globalConfig.defaultTestTimeout,
hookTimeout: 500000,
useAtomics: true,
Expand Down
14 changes: 14 additions & 0 deletions packages/types/config_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,20 @@
"description": "The name of the environment.",
"type": "string"
},
"reportFile": {
"anyOf": [
{
"additionalProperties": {
"type": "string"
},
"type": "object"
},
{
"type": "string"
}
],
"description": "Write test results to a file when the using JSON or HTML reporter.\nBy providing an object instead of a string you can define individual outputs when using multiple reporters."
},
"reporters": {
"description": "An optional array of reporter names.",
"items": {
Expand Down
6 changes: 6 additions & 0 deletions packages/types/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ export type Environment = {
*/
reporters?: string[];

/**
* Write test results to a file when the using JSON or HTML reporter.
* By providing an object instead of a string you can define individual outputs when using multiple reporters.
*/
reportFile?: string | { [reporterName: string]: string };

/**
* The name of the environment.
*/
Expand Down
3 changes: 2 additions & 1 deletion test/moonwall.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,8 @@
"name": "dev_test",
"testFileDir": ["suites/dev_tests"],
"envVars": ["DEBUG_COLORS=1", "TIMBO_TEST_ENV='TIMBO timbo timbo'"],
"reporters": ["default", "html"],
"reporters": ["default", "html", "json"],
"reportFile": { "json": "tmp/report444.json" },
"contracts": "contracts/",
"runScripts": ["compile-contracts.ts compile -p contracts/precompiles"],
"defaultSigner": {
Expand Down

0 comments on commit 4973189

Please sign in to comment.