Skip to content
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: update test reporting default (QE-251) #445

Merged
merged 3 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions src/server/cli/test-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,6 @@ async function getTestRunnerOptions(argv = []) {
type: Boolean,
description: 'Run tests in Webkit',
order: 4
},
{
name: 'test-reporting',
type: Boolean,
defaultOption: false,
description: 'Enables generating a D2L Test Reporting format JSON file',
order: 14
}
];

Expand Down
6 changes: 3 additions & 3 deletions src/server/wtr-config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { defaultReporter } from '@web/test-runner';
import { env } from 'node:process';
import { headedMode } from './headed-mode-plugin.js';
import { playwrightLauncher } from '@web/test-runner-playwright';
import { reporter as testReportingReporter } from 'd2l-test-reporting/reporters/web-test-runner.js';
import { visualDiff } from './visual-diff-plugin.js';
import { visualDiffReporter } from './visual-diff-reporter.js';

const DEFAULT_PATTERN = type => `./test/**/*.${type}.js`;
const DEFAULT_TEST_REPORTING = !!env['CI'];
const BROWSER_MAP = {
chrome: 'chromium',
chromium: 'chromium',
Expand Down Expand Up @@ -182,7 +184,7 @@ export class WTRConfig {
pattern = DEFAULT_PATTERN,
slow,
timeout,
testReporting,
testReporting = DEFAULT_TEST_REPORTING,
...passthroughConfig
} = {}) {

Expand Down Expand Up @@ -215,8 +217,6 @@ export class WTRConfig {
});
}

testReporting = !!testReporting || this.#cliArgs['test-reporting'];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the end result going to be for a random repo that didn't previously have this configured? Like there'll now be a JSON file that gets generated when the tests run? Are we worried that it won't be in .gitignore?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah there will be a d2l-test-report.json generated. I don't think it will be a problem for repos. Most repos don't explicitly check in generated files or do anything after running tests.

Copy link
Contributor Author

@devpow112 devpow112 Jul 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could add a disable test reporting CLI command if we think we will need to disable it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok cool. I don't think it's worth adding a flag until we know we'll need it.


if (group === 'vdiff' || testReporting) {
config.reporters ??= [ defaultReporter() ];
}
Expand Down