mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
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:
parent
8993def882
commit
e0e7e3a5df
@ -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',
|
||||
}
|
||||
: {}),
|
||||
};
|
||||
|
@ -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();
|
@ -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 */
|
@ -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 () => {
|
@ -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();
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user