/** * @license * Copyright 2022 Google Inc. * SPDX-License-Identifier: Apache-2.0
*/ importassert from 'node:assert/strict'; import {describe, it} from 'node:test';
import type {Platform, TestExpectation, MochaTestResult} from './types.js'; import {
filterByParameters,
getTestResultForFailure,
isWildCardPattern,
testIdMatchesExpectationPattern,
getExpectationUpdates,
} from './utils.js'; import {getFilename, extendProcessEnv} from './utils.js';
describe('getFilename', () => {
it('extract filename for a path', () => { assert.equal(getFilename('/etc/test.ts'), 'test'); assert.equal(getFilename('/etc/test.js'), 'test');
});
});
describe('getTestResultForFailure', () => {
it('should get a test result for a mocha failure', () => { assert.equal(
getTestResultForFailure({err: {code: 'ERR_MOCHA_TIMEOUT'}}), 'TIMEOUT',
); assert.equal(getTestResultForFailure({err: {code: 'ERROR'}}), 'FAIL');
});
});
describe('filterByParameters', () => {
it('should filter a list of expectations by parameters', () => { const expectations: TestExpectation[] = [
{
testIdPattern: '[oopif.spec] OOPIF "after all" hook for "should keep track of a frames OOP state"',
platforms: ['darwin'],
parameters: ['firefox', 'headless'],
expectations: ['FAIL'],
},
]; assert.equal(
filterByParameters(expectations, ['firefox', 'headless']).length, 1,
); assert.equal(filterByParameters(expectations, ['firefox']).length, 0); assert.equal(
filterByParameters(expectations, ['firefox', 'headless', 'other']).length, 1,
); assert.equal(filterByParameters(expectations, ['other']).length, 0);
});
});
describe('isWildCardPattern', () => {
it('should detect if an expectation is a wildcard pattern', () => { assert.equal(isWildCardPattern(''), false); assert.equal(isWildCardPattern('a'), false); assert.equal(isWildCardPattern('*'), true);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.