mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-09 21:07:46 +00:00
[tests] combine examples e2e into one chunk (#9772)
We don't need 5 chunks of the very fast examples tests. We spend more time in setup for each one. We are also more likely to hit the [usage limit](https://docs.github.com/en/actions/learn-github-actions/usage-limits-billing-and-administration#usage-limits) with these. This PR combines them into one test suite.
This commit is contained in:
30
utils/chunk-tests.js
vendored
30
utils/chunk-tests.js
vendored
@@ -16,6 +16,28 @@ const runnersMap = new Map([
|
|||||||
['test-dev', { min: 1, max: 5, runners: ['ubuntu-latest', 'macos-latest'] }],
|
['test-dev', { min: 1, max: 5, runners: ['ubuntu-latest', 'macos-latest'] }],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
const optionsOverrides = {
|
||||||
|
examples: { min: 1, max: 1 },
|
||||||
|
};
|
||||||
|
|
||||||
|
function getRunnerOptions(scriptName, packageName) {
|
||||||
|
let runnerOptions = runnersMap.get(scriptName);
|
||||||
|
if (optionsOverrides[packageName]) {
|
||||||
|
runnerOptions = Object.assign(
|
||||||
|
{},
|
||||||
|
runnerOptions,
|
||||||
|
optionsOverrides[packageName]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
runnerOptions || {
|
||||||
|
min: 1,
|
||||||
|
max: 1,
|
||||||
|
runners: ['ubuntu-latest'],
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
async function getChunkedTests() {
|
async function getChunkedTests() {
|
||||||
const scripts = [...runnersMap.keys()];
|
const scripts = [...runnersMap.keys()];
|
||||||
const rootPath = path.resolve(__dirname, '..');
|
const rootPath = path.resolve(__dirname, '..');
|
||||||
@@ -67,11 +89,9 @@ async function getChunkedTests() {
|
|||||||
([packagePathAndName, scriptNames]) => {
|
([packagePathAndName, scriptNames]) => {
|
||||||
const [packagePath, packageName] = packagePathAndName.split(',');
|
const [packagePath, packageName] = packagePathAndName.split(',');
|
||||||
return Object.entries(scriptNames).flatMap(([scriptName, testPaths]) => {
|
return Object.entries(scriptNames).flatMap(([scriptName, testPaths]) => {
|
||||||
const {
|
const runnerOptions = getRunnerOptions(scriptName, packageName);
|
||||||
runners = ['ubuntu-latest'],
|
const { runners, min, max } = runnerOptions;
|
||||||
min = 1,
|
|
||||||
max = 1,
|
|
||||||
} = runnersMap.get(scriptName) || {};
|
|
||||||
const sortedTestPaths = testPaths.sort((a, b) => a.localeCompare(b));
|
const sortedTestPaths = testPaths.sort((a, b) => a.localeCompare(b));
|
||||||
return intoChunks(min, max, sortedTestPaths).flatMap(
|
return intoChunks(min, max, sortedTestPaths).flatMap(
|
||||||
(chunk, chunkNumber, allChunks) => {
|
(chunk, chunkNumber, allChunks) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user