mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-05 00:15:32 +00:00
Merge branch 'chore/web-core-preflight-replay-15856-cleanup' into chore/web-core-preflight-replay-15887-renames
Some checks failed
Keyman Build Summary / Summarize build status checks (push) Has been cancelled
Some checks failed
Keyman Build Summary / Summarize build status checks (push) Has been cancelled
This commit is contained in:
commit
7d734fef6e
5 changed files with 34 additions and 27 deletions
|
|
@ -135,6 +135,8 @@ function Teamcity(runner, options) {
|
|||
const ignoredTests = {};
|
||||
const testState = { pending: 0 };
|
||||
|
||||
log('Initializing Mocha TeamCity Reporter');
|
||||
|
||||
runner.on(EVENT_SUITE_BEGIN, function (suite) {
|
||||
handleFlow(true, hasParentFlowId);
|
||||
if (suite.root) {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class TestNode {
|
|||
private id: string;
|
||||
private suiteOrTest: Suite | TestCase;
|
||||
private flowId: number;
|
||||
private parent: TestNode;
|
||||
private parent: TestNode | null;
|
||||
private childrenToVisit: TestNode[] = [];
|
||||
|
||||
public constructor(suiteOrTest: Suite | TestCase) {
|
||||
|
|
@ -87,29 +87,20 @@ class TestNode {
|
|||
}
|
||||
}
|
||||
|
||||
private end(result: TestResult, force: boolean = false): void {
|
||||
if (this.childrenToVisit.length > 0 && force) {
|
||||
while (this.childrenToVisit.length > 0) {
|
||||
const child = this.childrenToVisit[0];
|
||||
child.end(result, force);
|
||||
private end(result: TestResult): void {
|
||||
if (this.suiteOrTest.title !== '') {
|
||||
if (this.isTest) {
|
||||
const { msgTitle, details } = this.getTestResult(result) ?? { msgTitle: 'testFinished', details: '' };
|
||||
console.log(`##teamcity[${msgTitle} name='${this.suiteOrTest.title}' ${details}]`);
|
||||
} else {
|
||||
console.log(`##teamcity[testSuiteFinished name='${this.suiteOrTest.title}']`);
|
||||
}
|
||||
console.log(`##teamcity[flowFinished flowId='${this.flowId}']`);
|
||||
}
|
||||
|
||||
if (!force) {
|
||||
if (this.suiteOrTest.title !== '') {
|
||||
if (this.isTest) {
|
||||
const { msgTitle, details } = this.getTestResult(result) ?? { msgTitle: 'testFinished', details: '' };
|
||||
console.log(`##teamcity[${msgTitle} name='${this.suiteOrTest.title}' ${details}]`);
|
||||
} else {
|
||||
console.log(`##teamcity[testSuiteFinished name='${this.suiteOrTest.title}']`);
|
||||
}
|
||||
console.log(`##teamcity[flowFinished flowId = '${this.flowId}']`);
|
||||
}
|
||||
this.removeFromOpenNodes();
|
||||
|
||||
this.parent?.removeChild(this);
|
||||
TestNode.Nodes.delete(this.id);
|
||||
}
|
||||
this.removeFromOpenNodes();
|
||||
this.parent?.removeChild(this);
|
||||
TestNode.Nodes.delete(this.id);
|
||||
}
|
||||
|
||||
private removeFromOpenNodes(): void {
|
||||
|
|
@ -134,7 +125,7 @@ class TestNode {
|
|||
}
|
||||
|
||||
// No more children, so close this node
|
||||
this.end(null, false);
|
||||
this.end(null);
|
||||
}
|
||||
|
||||
public static startTest(test: TestCase): void {
|
||||
|
|
@ -159,13 +150,18 @@ class TestNode {
|
|||
if (this.childrenToVisit.length > 0) {
|
||||
console.error(`Root node still has ${this.childrenToVisit.length} open children`);
|
||||
}
|
||||
this.end(null, true);
|
||||
if (TestNode.OpenNodes.length > 0) {
|
||||
console.error(`Still have ${TestNode.OpenNodes.length} open nodes`);
|
||||
while (TestNode.OpenNodes.length > 0) {
|
||||
const id = TestNode.OpenNodes[TestNode.OpenNodes.length - 1];
|
||||
console.log(`Closing '${id}'`);
|
||||
const node = TestNode.Nodes.get(id);
|
||||
if (!node) {
|
||||
console.error(`Node for '${id}' not found in Nodes map, removing from OpenNodes`);
|
||||
TestNode.OpenNodes.pop();
|
||||
continue;
|
||||
}
|
||||
|
||||
node.end(null);
|
||||
}
|
||||
}
|
||||
|
|
@ -179,9 +175,10 @@ class TestNode {
|
|||
}
|
||||
|
||||
export default class PlaywrightTeamcityReporter implements Reporter {
|
||||
private root: TestNode = null;
|
||||
private root!: TestNode;
|
||||
|
||||
public constructor(options: { parentFlow?: string } = {}) {
|
||||
console.log('Initializing Playwright TeamCity Reporter');
|
||||
TestNode.RootFlow = options.parentFlow ?? 'unit_tests';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -94,14 +94,16 @@ export default function teamcityReporter({ name="Web Test Runner JavaScript test
|
|||
|
||||
/** @type {import('@web/test-runner').Reporter} */
|
||||
const reporter = {
|
||||
start({config, sessions}) {
|
||||
start({ config, sessions }) {
|
||||
logger = config.logger;
|
||||
logger.log('Initializing Web Test Runner TeamCity Reporter');
|
||||
|
||||
rootDir = config.rootDir;
|
||||
|
||||
for(const session of sessions.all()) {
|
||||
testDefMap.set(buildSessionName(session), new Map());
|
||||
}
|
||||
|
||||
logger = config.logger;
|
||||
logger.log(`##teamcity[blockOpened name='${e(name)}']`);
|
||||
},
|
||||
stop(args) {
|
||||
|
|
|
|||
|
|
@ -205,12 +205,15 @@ function do_browser_tests() {
|
|||
|
||||
pushd "${KEYMAN_ROOT}"
|
||||
if is_test_included dom; then
|
||||
builder_echo "Running browser-based tests..."
|
||||
web-test-runner --config "web/src/test/auto/dom/web-test-runner${WTR_CONFIG}.config.mjs" ${WTR_INSPECT}
|
||||
fi
|
||||
if is_test_included integrated; then
|
||||
builder_echo "Running integration tests..."
|
||||
web-test-runner --config "web/src/test/auto/integrated/web-test-runner${WTR_CONFIG}.config.mjs" ${WTR_INSPECT}
|
||||
fi
|
||||
if is_test_included e2e; then
|
||||
builder_echo "Running end-to-end tests..."
|
||||
npx playwright test --config "web/src/test/auto/e2e/playwright.config.ts"
|
||||
fi
|
||||
popd
|
||||
|
|
|
|||
|
|
@ -76,7 +76,10 @@ export default defineConfig({
|
|||
|
||||
/* Run your local dev server before starting the tests */
|
||||
webServer: {
|
||||
command: `"${KEYMAN_ROOT}/node_modules/.bin/gosh" "../../../../build.sh start"`,
|
||||
// Normally we'd run `web/build.sh start` or `gosh web/build.sh start`
|
||||
// here, but that's causing problems on Windows.
|
||||
command: 'node web/src/tools/testing/test-server/index.cjs',
|
||||
cwd: KEYMAN_ROOT,
|
||||
url: 'http://localhost:3000',
|
||||
reuseExistingServer: !process.env.KEYMAN_IS_CI_BUILD,
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue