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

core: fix crash with Sentry init #13104

Merged
merged 1 commit into from Sep 22, 2021
Merged
Show file tree
Hide file tree
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
6 changes: 5 additions & 1 deletion lighthouse-cli/bin.js
Expand Up @@ -21,6 +21,7 @@
import fs from 'fs';
import path from 'path';
import url from 'url';
import module from 'module';

import log from 'lighthouse-logger';
import updateNotifier from 'update-notifier';
Expand All @@ -30,12 +31,15 @@ import * as Printer from './printer.js';
import {getFlags} from './cli-flags.js';
import {runLighthouse} from './run.js';
import lighthouse from '../lighthouse-core/index.js';
import * as Sentry from '../lighthouse-core/lib/sentry.js';
import {askPermission} from './sentry-prompt.js';
import {LH_ROOT} from '../root.js';

const pkg = JSON.parse(fs.readFileSync(LH_ROOT + '/package.json', 'utf-8'));

// TODO(esmodules): use regular import when this file is esm.
const require = module.createRequire(import.meta.url);
const Sentry = require('../lighthouse-core/lib/sentry.js');

/**
* @return {boolean}
*/
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-cli/test/cli/bin-test.js
Expand Up @@ -30,7 +30,7 @@ jest.unstable_mockModule('../../sentry-prompt.js', () => {
});

const mockSentryInit = jest.fn();
jest.unstable_mockModule('../../../lighthouse-core/lib/sentry.js', () => {
jest.mock('../../../lighthouse-core/lib/sentry.js', () => {
return {init: mockSentryInit};
});

Expand Down