Repository: puppeteer/puppeteer
File: tools/mochaRunner/src/test.ts (TypeScript)

Code before:
/**
 * Copyright 2022 Google Inc. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import assert from 'node:assert/strict';
import {describe, it} from 'node:test';
import os from 'os';

import {TestExpectation} from './types.js';
import {
  filterByParameters,
  getTestResultForFailure,
  isWildCardPattern,
  testIdMatchesExpectationPattern,
  getExpectationUpdates,
} from './utils.js';
import {getFilename, extendProcessEnv} from './utils.js';

describe('extendProcessEnv', () => {
  it('should extend env variables for the subprocess', () => {
    const env = extendProcessEnv([{TEST: 'TEST'}, {TEST2: 'TEST2'}]);
    assert.equal(env['TEST'], 'TEST');
    assert.equal(env['TEST2'], 'TEST2');
  });
});

describe('getFilename', () => {
  it('extract filename for a path', () => {
    assert.equal(getFilename('/etc/test.ts'), 'test');
    assert.equal(getFilename('/etc/test.js'), 'test');
  });
});

describe('getTestResultForFailure', () => {

Review comment (suggestion):
```suggestion
import {Platform, TestExpectation} from './types.js';
```

Code after:
/**
 * Copyright 2022 Google Inc. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import assert from 'node:assert/strict';
import {describe, it} from 'node:test';

import {Platform, TestExpectation} from './types.js';
import {
  filterByParameters,
  getTestResultForFailure,
  isWildCardPattern,
  testIdMatchesExpectationPattern,
  getExpectationUpdates,
} from './utils.js';
import {getFilename, extendProcessEnv} from './utils.js';

describe('extendProcessEnv', () => {
  it('should extend env variables for the subprocess', () => {
    const env = extendProcessEnv([{TEST: 'TEST'}, {TEST2: 'TEST2'}]);
    assert.equal(env['TEST'], 'TEST');
    assert.equal(env['TEST2'], 'TEST2');
  });
});

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', () => {