@sentry/webpack-plugin
Advanced tools
Comparing version 1.4.0 to 1.5.0
@@ -11,3 +11,3 @@ { | ||
"author": "Sentry", | ||
"version": "1.4.0", | ||
"version": "1.5.0", | ||
"license": "MIT", | ||
@@ -14,0 +14,0 @@ "repository": "git@github.com:getsentry/sentry-webpack-plugin.git", |
@@ -75,3 +75,7 @@ /*eslint-disable*/ | ||
compiler = { | ||
plugin: jest.fn(), | ||
hooks: { | ||
afterEmit: { | ||
tapAsync: jest.fn(), | ||
}, | ||
}, | ||
}; | ||
@@ -92,10 +96,33 @@ }); | ||
test('should call `compiler.plugin()` with `after-emit` and callback function', () => { | ||
test('should call `compiler.hooks.afterEmit.tapAsync()` with callback function', () => { | ||
const sentryCliPlugin = new SentryCliPlugin(); | ||
sentryCliPlugin.apply(compiler); | ||
expect(compiler.plugin).toHaveBeenCalled(); | ||
expect(compiler.plugin.mock.calls[0][0]).toBe('after-emit'); | ||
expect(typeof compiler.plugin.mock.calls[0][1]).toBe('function'); | ||
expect(compiler.hooks.afterEmit.tapAsync).toHaveBeenCalledWith('SentryCliPlugin', expect.any(Function)); | ||
}); | ||
describe('Webpack <= 3', () => { | ||
let _compiler; | ||
beforeAll(() => { | ||
_compiler = compiler; | ||
}); | ||
beforeEach(() => { | ||
compiler = { | ||
plugin: jest.fn(), | ||
}; | ||
}); | ||
afterAll(() => { | ||
compiler = _compiler; | ||
}); | ||
test('should call `compiler.plugin()` with `after-emit` and callback function', () => { | ||
const sentryCliPlugin = new SentryCliPlugin(); | ||
sentryCliPlugin.apply(compiler); | ||
expect(compiler.plugin).toHaveBeenCalledWith('after-emit', expect.any(Function)); | ||
}); | ||
}); | ||
}); | ||
@@ -115,5 +142,9 @@ | ||
compiler = { | ||
plugin: jest.fn((event, callback) => | ||
callback(compilation, compilationDoneCallback) | ||
), | ||
hooks: { | ||
afterEmit: { | ||
tapAsync: jest.fn((name, callback) => | ||
callback(compilation, compilationDoneCallback) | ||
), | ||
}, | ||
}, | ||
}; | ||
@@ -120,0 +151,0 @@ }); |
@@ -94,2 +94,10 @@ const SentryCli = require('@sentry/cli'); | ||
} | ||
attachAfterEmitHook(compiler, callback) { | ||
// Backwards compatible version of: compiler.plugin.afterEmit.tapAsync() | ||
if (compiler.hooks) { | ||
compiler.hooks.afterEmit.tapAsync('SentryCliPlugin', callback); | ||
} else { | ||
compiler.plugin('after-emit', callback); | ||
} | ||
} | ||
@@ -107,3 +115,3 @@ apply(compiler) { | ||
compiler.plugin('after-emit', (compilation, cb) => { | ||
this.attachAfterEmitHook(compiler, (compilation, cb) => { | ||
function handleError(message, errorCb) { | ||
@@ -110,0 +118,0 @@ compilation.errors.push(`Sentry CLI Plugin: ${message}`); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
126489
316