test: move cdp only tests to a subfolder (#11033)

Co-authored-by: Nikolay Vitkov <34244704+Lightning00Blade@users.noreply.github.com>
This commit is contained in:
Alex Rudenko 2023-09-26 10:13:22 +02:00 committed by GitHub
parent 8993def882
commit e0e7e3a5df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 21 deletions

View File

@ -27,9 +27,4 @@ module.exports = {
parallel: !!process.env.PARALLEL,
timeout: timeout,
reporter: process.env.CI ? 'spec' : 'dot',
...(!process.env['PUPPETEER_SHARD']
? {
spec: 'test/build/**/*.spec.js',
}
: {}),
};

View File

@ -17,8 +17,8 @@
import expect from 'expect';
import {isErrorLike} from 'puppeteer-core/internal/util/ErrorLike.js';
import {getTestState, setupTestBrowserHooks} from './mocha-utils.js';
import {waitEvent} from './utils.js';
import {getTestState, setupTestBrowserHooks} from '../mocha-utils.js';
import {waitEvent} from '../utils.js';
describe('Target.createCDPSession', function () {
setupTestBrowserHooks();

View File

@ -17,8 +17,8 @@
import expect from 'expect';
import {type CdpBrowser} from 'puppeteer-core/internal/cdp/Browser.js';
import {getTestState, launch} from './mocha-utils.js';
import {attachFrame} from './utils.js';
import {getTestState, launch} from '../mocha-utils.js';
import {attachFrame} from '../utils.js';
describe('TargetManager', () => {
/* We use a special browser for this test as we need the --site-per-process flag */

View File

@ -17,8 +17,8 @@
import expect from 'expect';
import {PageEvent} from 'puppeteer-core';
import {launch} from './mocha-utils.js';
import {waitEvent} from './utils.js';
import {launch} from '../mocha-utils.js';
import {waitEvent} from '../utils.js';
describe('BFCache', function () {
it('can navigate to a BFCached page', async () => {

View File

@ -16,7 +16,7 @@
import expect from 'expect';
import {getTestState, setupTestBrowserHooks} from './mocha-utils.js';
import {getTestState, setupTestBrowserHooks} from '../mocha-utils.js';
describe('Prerender', function () {
setupTestBrowserHooks();

View File

@ -79,6 +79,7 @@ function getApplicableTestSuites(
async function main() {
const noCoverage = process.argv.indexOf('--no-coverage') !== -1;
const noSuggestions = process.argv.indexOf('--no-suggestions') !== -1;
const excludeCDPOnly = process.argv.indexOf('--no-cdp-tests') !== -1;
const statsFilenameIdx = process.argv.indexOf('--save-stats-to');
let statsFilename = '';
@ -192,10 +193,14 @@ async function main() {
if (process.argv.indexOf('--fullTrace')) {
args.push('--full-trace');
}
if (shard) {
const specs = globSync('test/build/**/*.spec.js').sort((a, b) => {
const specPattern = 'test/build/**/*.spec.js';
const specs = globSync(specPattern, {
ignore: excludeCDPOnly ? 'test/build/cdp/**/*.spec.js' : undefined,
}).sort((a, b) => {
return a.localeCompare(b);
});
if (shard) {
// Shard ID is 1-based.
const [shardId, shards] = shard.split('/').map(s => {
return Number(s);
@ -214,17 +219,14 @@ async function main() {
args.length - argsLength
} files out of ${specs.length}.`
);
} else {
args.push(...specs);
}
const spawnArgs: SpawnOptions = {
shell: true,
cwd: process.cwd(),
stdio: 'inherit',
env: shard
? {
...env,
PUPPETEER_SHARD: 'true',
}
: env,
env,
};
const handle = noCoverage
? spawn('npx', ['mocha', ...args], spawnArgs)