mirror of
https://gitea.com/gitea/gitea-mirror.git
synced 2026-04-23 21:52:13 +00:00
Adapt monaco error matching pattern to recent webpack config change (#36533)
Signed-off-by: silverwind <me@silverwind.io>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import {showGlobalErrorMessage} from './bootstrap.ts';
|
||||
import {showGlobalErrorMessage, shouldIgnoreError} from './bootstrap.ts';
|
||||
|
||||
test('showGlobalErrorMessage', () => {
|
||||
document.body.innerHTML = '<div class="page-content"></div>';
|
||||
@@ -10,3 +10,19 @@ test('showGlobalErrorMessage', () => {
|
||||
expect(document.body.innerHTML).toContain('>test msg 2<');
|
||||
expect(document.querySelectorAll('.js-global-error').length).toEqual(2);
|
||||
});
|
||||
|
||||
test('shouldIgnoreError', () => {
|
||||
for (const url of [
|
||||
'https://gitea.test/assets/js/monaco.b359ef7e.js',
|
||||
'https://gitea.test/assets/js/monaco-editor.4a969118.worker.js',
|
||||
'https://gitea.test/assets/js/vendors-node_modules_pnpm_monaco-editor_0_55_1_node_modules_monaco-editor_esm_vs_base_common_-e11c7c.966a028d.js',
|
||||
]) {
|
||||
const err = new Error('test');
|
||||
err.stack = `Error: test\n at ${url}:1:1`;
|
||||
expect(shouldIgnoreError(err)).toEqual(true);
|
||||
}
|
||||
|
||||
const otherError = new Error('test');
|
||||
otherError.stack = 'Error: test\n at https://gitea.test/assets/js/index.js:1:1';
|
||||
expect(shouldIgnoreError(otherError)).toEqual(false);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user