Skip to content

Commit

Permalink
test: Log support map on test startup (#6638)
Browse files Browse the repository at this point in the history
When running tests with logging enabled, the logs will now always
contain a full map of media features supported on this platform.

---------

Co-authored-by: Álvaro Velad Galván <ladvan91@hotmail.com>
  • Loading branch information
joeyparrish and avelad committed May 21, 2024
1 parent bbf54d2 commit 26c3f64
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions test/test/boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ function configureJasmineEnvironment() {
// Reset decoding config cache after each test.
afterEach(/** @suppress {accessControls} */ () => {
shaka.util.StreamUtils.decodingConfigCache_ = {};
shaka.media.Capabilities.MediaSourceTypeSupportMap.clear();
});

// Code in karma-jasmine's adapter will malform test failures when the
Expand Down Expand Up @@ -425,10 +426,21 @@ function configureJasmineEnvironment() {
};
}

async function logSupport() {
try {
const support = await shaka.Player.probeSupport();
console.log('Platform support:', JSON.stringify(support, null, 2));
// eslint-disable-next-line no-restricted-syntax
} catch (error) {
console.error('Support check failed at boot!', error);
}
}

/**
* Set up the Shaka Player test environment.
* @return {!Promise}
*/
function setupTestEnvironment() {
async function setupTestEnvironment() {
failTestsOnFailedAssertions();
failTestsOnNamespacedElementOrAttributeNames();
failTestsOnUnhandledErrors();
Expand All @@ -440,6 +452,8 @@ function setupTestEnvironment() {
// detected.
shaka.polyfill.installAll();

await logSupport();

configureJasmineEnvironment();
}

Expand Down Expand Up @@ -499,7 +513,7 @@ window.__karma__.start = async () => {
// See https://github.com/shaka-project/shaka-player/issues/4094

try {
setupTestEnvironment();
await setupTestEnvironment();
console.log('Set up test environment.');
await loadTests();
console.log('Loaded all tests.');
Expand Down

0 comments on commit 26c3f64

Please sign in to comment.