Skip to content
Snippets Groups Projects
Unverified Commit 86607c0f authored by Kev Kloss's avatar Kev Kloss Committed by GitLab
Browse files

Merge branch 'block-mrs-that-break-vue3-specs' into 'master'

Block MRs which introduce failing Vue 3 specs

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/168989



Merged-by: default avatarKev Kloss <kkloss@gitlab.com>
Approved-by: default avatarKev Kloss <kkloss@gitlab.com>
Reviewed-by: default avatarMark Florian <mflorian@gitlab.com>
Reviewed-by: default avatarKev Kloss <kkloss@gitlab.com>
Co-authored-by: default avatarMark Florian <mflorian@gitlab.com>
parents 41c7998d 856ed4c1
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -369,7 +369,7 @@ jest vue3 mr:
parallel: 6
script:
- run_timed_command "yarn jest:ci:vue3-mr:without-fixtures"
allow_failure: true
allow_failure: false
 
jest-with-fixtures vue3 mr:
extends:
Loading
Loading
@@ -420,7 +420,6 @@ jest vue3 predictive:
- "detect-tests"
script:
- if [[ -s "$RSPEC_CHANGED_FILES_PATH" ]] || [[ -s "$RSPEC_MATCHING_JS_FILES_PATH" ]]; then run_timed_command "yarn jest:ci:vue3-mr:predictive-without-fixtures"; fi
allow_failure: false
 
jest-with-fixtures vue3 predictive:
extends:
Loading
Loading
This diff is collapsed.
const { relative } = require('node:path');
const { readFile } = require('node:fs/promises');
const { relative, join } = require('node:path');
const { setTimeout: setTimeoutPromise } = require('node:timers/promises');
const axios = require('axios');
const FixtureCISequencer = require('./fixture_ci_sequencer');
 
const url = 'https://gitlab-org.gitlab.io/frontend/playground/jest-speed-reporter/vue3.json';
const url =
'https://gitlab-org.gitlab.io/frontend/playground/fast-jest-vue-3-quarantine/gitlab.txt';
 
// These fail due to template compilation errors, so aren't recorded in the
// JUnit report that the Jest Speed Reporter project consumes. We must explicitly
// exclude them until this is solved.
// See https://gitlab.com/gitlab-org/gitlab/-/issues/478773.
const SPECS_THAT_FAIL_TO_COMPILE = [
'spec/frontend/boards/components/board_app_spec.js',
'ee/spec/frontend/boards/components/board_app_spec.js',
'spec/frontend/boards/components/board_content_spec.js',
'ee/spec/frontend/boards/components/board_content_spec.js',
];
function parse(quarantineFileContent) {
return quarantineFileContent
.split('\n')
.map((line) => line.trim())
.filter((line) => line && !line.startsWith('#'));
}
 
async function getFailedFilesAsAbsolutePaths(n = 0, maxRetries = 3) {
// See https://gitlab.com/gitlab-org/frontend/playground/fast-jest-vue-3-quarantine for details
// about how to fast quarantine files.
async function getFastQuarantinedFiles(n = 0, maxRetries = 3) {
try {
const { data } = await axios.get(url, { timeout: 10_000 });
return new Set([...data.failedFiles, ...SPECS_THAT_FAIL_TO_COMPILE]);
return parse(data);
} catch (error) {
console.error('\nFailed to fetch list of specs failing with @vue/compat: %s', error.message);
 
Loading
Loading
@@ -27,24 +27,40 @@ async function getFailedFilesAsAbsolutePaths(n = 0, maxRetries = 3) {
const waitMs = 5_000 * 2 ** n;
console.error(`Waiting ${waitMs}ms to retry (${maxRetries - n} remaining)`);
await setTimeoutPromise(waitMs);
return getFailedFilesAsAbsolutePaths(n + 1);
return getFastQuarantinedFiles(n + 1);
}
 
throw error;
}
}
 
async function getLocalQuarantinedFiles() {
const content = await readFile(join(__dirname, 'quarantined_vue3_specs.txt'), {
encoding: 'UTF-8',
});
return parse(content);
}
async function getQuarantinedFiles() {
const results = await Promise.all([getFastQuarantinedFiles(), getLocalQuarantinedFiles()]);
return new Set(results.flat());
}
class SkipSpecsBrokenInVueCompatFixtureCISequencer extends FixtureCISequencer {
#failedSpecFilesPromise = getFailedFilesAsAbsolutePaths();
#quarantinedFiles = getQuarantinedFiles();
 
async shard(tests, options) {
const failedSpecFiles = await this.#failedSpecFilesPromise;
const quarantinedFiles = await this.#quarantinedFiles;
console.warn(
`Skipping ${quarantinedFiles.size} quarantined specs:\n${[...quarantinedFiles].join('\n')}`,
);
 
const testsExcludingOnesThatFailInVueCompat = tests.filter(
(test) => !failedSpecFiles.has(relative(test.context.config.rootDir, test.path)),
const testsExcludingQuarantined = tests.filter(
(test) => !quarantinedFiles.has(relative(test.context.config.rootDir, test.path)),
);
 
return super.shard(testsExcludingOnesThatFailInVueCompat, options);
return super.shard(testsExcludingQuarantined, options);
}
}
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment