Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eng: allow snapshot mutation messages locally #194498

Merged
merged 2 commits into from
Sep 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 15 additions & 8 deletions test/unit/electron/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ Object.assign(globalThis, {
__mkdirPInTests: path => fs.promises.mkdir(path, { recursive: true }),
});

const IS_CI = !!process.env.BUILD_ARTIFACTSTAGINGDIRECTORY;
const _tests_glob = '**/test/**/*.test.js';
let loader;
let _out;
Expand Down Expand Up @@ -172,14 +173,20 @@ function loadTests(opts) {

//#region Unexpected Output

const _allowedTestOutput = new Set([
'The vm module of Node.js is deprecated in the renderer process and will be removed.',
]);
const _allowedTestOutput = [
/The vm module of Node\.js is deprecated in the renderer process and will be removed./,
];

// allow snapshot mutation messages locally
if (!IS_CI) {
_allowedTestOutput.push(/Creating new snapshot in/);
_allowedTestOutput.push(/Deleting [0-9]+ old snapshots/);
}

const _allowedTestsWithOutput = new Set([
'creates a snapshot', // https://github.com/microsoft/vscode/issues/192439
'validates a snapshot', // https://github.com/microsoft/vscode/issues/192439
'cleans up old snapshots', // https://github.com/microsoft/vscode/issues/192439
'creates a snapshot', // self-testing
'validates a snapshot', // self-testing
'cleans up old snapshots', // self-testing
'issue #149412: VS Code hangs when bad semantic token data is received', // https://github.com/microsoft/vscode/issues/192440
'issue #134973: invalid semantic tokens should be handled better', // https://github.com/microsoft/vscode/issues/192440
'issue #148651: VSCode UI process can hang if a semantic token with negative values is returned by language service', // https://github.com/microsoft/vscode/issues/192440
Expand All @@ -194,7 +201,7 @@ function loadTests(opts) {

for (const consoleFn of [console.log, console.error, console.info, console.warn, console.trace, console.debug]) {
console[consoleFn.name] = function (msg) {
if (!_allowedTestOutput.has(msg) && !_allowedTestsWithOutput.has(currentTestTitle)) {
if (!_allowedTestOutput.some(a => a.test(msg)) && !_allowedTestsWithOutput.has(currentTestTitle)) {
_testsWithUnexpectedOutput = true;
consoleFn.apply(console, arguments);
}
Expand Down Expand Up @@ -242,7 +249,7 @@ function loadTests(opts) {
process.on('uncaughtException', error => onUnexpectedError(error));
process.on('unhandledRejection', (reason, promise) => {
onUnexpectedError(reason);
promise.catch(() => {});
promise.catch(() => { });
});
window.addEventListener('unhandledrejection', event => {
event.preventDefault(); // Do not log to test output, we show an error later when test ends
Expand Down