From 4f14b4b79c064cc20ecbb95ee74756685f639212 Mon Sep 17 00:00:00 2001 From: Jerome Wu Date: Fri, 24 May 2019 14:37:09 +0800 Subject: [PATCH] Fix tests --- scripts/webpack.config.dev.js | 3 +++ scripts/webpack.config.prod.js | 5 ++++- tests/recognize.test.js | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/webpack.config.dev.js b/scripts/webpack.config.dev.js index 92893b6..620d401 100644 --- a/scripts/webpack.config.dev.js +++ b/scripts/webpack.config.dev.js @@ -31,6 +31,9 @@ module.exports = [ libraryTarget: 'umd', }), genConfig({ + optimization: { + minimize: false, + }, entry: path.resolve(__dirname, '..', 'src', 'index.js'), filename: 'tesseract.asm.dev.js', library: 'Tesseract', diff --git a/scripts/webpack.config.prod.js b/scripts/webpack.config.prod.js index 9f127c7..1c8af0b 100644 --- a/scripts/webpack.config.prod.js +++ b/scripts/webpack.config.prod.js @@ -7,7 +7,7 @@ const genConfig = ({ ...common, ...config, mode: 'production', - // devtool: 'source-map', + devtool: 'source-map', entry, output: { path: path.resolve(__dirname, '..', 'dist'), @@ -25,6 +25,9 @@ module.exports = [ libraryTarget: 'umd', }), genConfig({ + optimization: { + minimize: false, + }, entry: path.resolve(__dirname, '..', 'src', 'index.js'), filename: 'tesseract.asm.min.js', library: 'Tesseract', diff --git a/tests/recognize.test.js b/tests/recognize.test.js index 575572c..c1b6670 100644 --- a/tests/recognize.test.js +++ b/tests/recognize.test.js @@ -1,4 +1,5 @@ const { TesseractWorker } = Tesseract; +const isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined'; const IMAGE_PATH = 'http://localhost:3000/tests/assets/images'; const SIMPLE_TEXT = 'Tesseract.js\n';