Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/sentry/sentry_browser_wrapper_spec.js')
-rw-r--r--spec/frontend/sentry/sentry_browser_wrapper_spec.js29
1 files changed, 25 insertions, 4 deletions
diff --git a/spec/frontend/sentry/sentry_browser_wrapper_spec.js b/spec/frontend/sentry/sentry_browser_wrapper_spec.js
index d98286e1371..60c441fe83c 100644
--- a/spec/frontend/sentry/sentry_browser_wrapper_spec.js
+++ b/spec/frontend/sentry/sentry_browser_wrapper_spec.js
@@ -1,18 +1,39 @@
+/* eslint-disable no-console */
+
import * as Sentry from '~/sentry/sentry_browser_wrapper';
const mockError = new Error('error!');
describe('SentryBrowserWrapper', () => {
+ beforeAll(() => {
+ process.env.NODE_ENV = 'development';
+ });
+
+ afterAll(() => {
+ process.env.NODE_ENV = 'test';
+ });
+
+ beforeEach(() => {
+ jest.spyOn(console, 'error').mockImplementation();
+ });
+
afterEach(() => {
+ console.error.mockRestore();
+
// eslint-disable-next-line no-underscore-dangle
delete window._Sentry;
});
describe('when _Sentry is not defined', () => {
- it('methods fail silently', () => {
- expect(() => {
- Sentry.captureException(mockError);
- }).not.toThrow();
+ it('captureException will report to console instead', () => {
+ Sentry.captureException(mockError);
+
+ expect(console.error).toHaveBeenCalledTimes(1);
+ expect(console.error).toHaveBeenCalledWith(
+ '[Sentry stub]',
+ 'captureException(...) called with:',
+ { 0: mockError },
+ );
});
});