Skip to content

Commit

Permalink
AzureClient: Add JUnit reporting option to Azure End-to-end Tests (#1…
Browse files Browse the repository at this point in the history
…6667)

## Description

Similar to other E2E tests in the FF repo, it would be nice to have
JUnit reports output from the Azure End-to-end test suite. With this
change, setting `FLUID_TEST_REPORT=1` causes tests to output a
nyc/junit-report.xml file.

Additionally, mocha-test-setup adds the ability for us to easily plug in
a test logger (e.g. ff-internal/aria-logger) for better log output
reporting. I added `getTestLogger` as the logger for AzureClient when
the mockLogger is not defined. As far as I can tell, there is currently
no usage of MockLogger in these tests, so this shouldn't change
anything. In the future, we can use a mix-in to output to both as
needed, I think.
  • Loading branch information
znewton authored Aug 3, 2023
1 parent a8196ce commit 5bb1f9b
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
3 changes: 2 additions & 1 deletion azure/packages/test/end-to-end-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"test": "npm run test:realsvc",
"test:realsvc": "npm run test:realsvc:tinylicious",
"test:realsvc:azure": "cross-env FLUID_CLIENT=azure npm run test:realsvc:azure:run",
"test:realsvc:azure:run": "mocha --unhandled-rejections=strict --recursive dist/test/**/*.spec.js --exit --timeout 20000",
"test:realsvc:azure:run": "mocha --unhandled-rejections=strict --recursive dist/test/**/*.spec.js --exit --timeout 20000 --config src/test/.mocharc.js",
"test:realsvc:run": "mocha dist/test --config src/test/.mocharc.js",
"test:realsvc:tinylicious": "start-server-and-test start:tinylicious:test 7071 test:realsvc:azure:run",
"test:realsvc:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:realsvc"
Expand Down Expand Up @@ -61,6 +61,7 @@
"@fluidframework/fluid-static": "workspace:~",
"@fluidframework/map": "workspace:~",
"@fluidframework/matrix": "workspace:~",
"@fluidframework/mocha-test-setup": "workspace:~",
"@fluidframework/sequence": "workspace:~",
"@fluidframework/telemetry-utils": "workspace:~",
"@fluidframework/test-runtime-utils": "workspace:~",
Expand Down
11 changes: 11 additions & 0 deletions azure/packages/test/end-to-end-tests/src/test/.mocharc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*!
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
* Licensed under the MIT License.
*/

"use strict";

const packageDir = `${__dirname}/../..`;
const getFluidTestMochaConfig = require("@fluidframework/mocha-test-setup/mocharc-common.js");
const config = getFluidTestMochaConfig(packageDir);
module.exports = config;
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,9 @@ export function createAzureClient(
endpoint: "http://localhost:7071",
type: "local",
};
return new AzureClient({ connection: connectionProps, logger, configProvider });
return new AzureClient({
connection: connectionProps,
logger: logger ?? getTestLogger?.(),
configProvider,
});
}
2 changes: 2 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5bb1f9b

Please sign in to comment.