Closed jljorgenson18 closed 4 years ago
Could you able to provide us with your webpack.config.js
file and public (non-proprietary) package.json
dependencies
and devDependencies
?
If you don't want to post this information publicly, could you please email it to hello@wallabyjs.com?
I can't provide the entire Webpack config but here are the relevant bits
const urlLoaderCfg = {
loader: 'url-loader',
options: {
limit: 2048, // 2kb
fallback: 'file-loader',
name: 'images/[name].[hash].[ext]'
}
};
...
// In module.rules
{
test: /\.(jpe?g|png|gif|pdf|enex|xbm)$/,
use: urlLoaderCfg
}
And the devDependencies (minus @types modules)
"autoprefixer": "^9.7.4",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.0.6",
"babel-plugin-istanbul": "^6.0.0",
"babel-plugin-lodash": "^3.3.4",
"babel-plugin-rewire": "^1.2.0",
"case-sensitive-paths-webpack-plugin": "^2.3.0",
"chai": "^4.2.0",
"chalk": "^3.0.0",
"clean-webpack-plugin": "^3.0.0",
"closure-loader": "^0.9.2",
"command-line-args": "^5.1.1",
"copy-webpack-plugin": "^5.1.1",
"cross-env": "^7.0.2",
"css-loader": "^3.4.2",
"d3-array": "^2.4.0",
"detect-browser": "^4.8.0",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.2",
"eslint": "^6.8.0",
"eslint-config-airbnb-base": "^14.0.0",
"eslint-config-prettier": "^6.10.0",
"eslint-plugin-chai-friendly": "^0.5.0",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-mocha": "^6.3.0",
"eslint-plugin-prettier": "^3.1.2",
"eslint-plugin-react": "^7.18.3",
"eslint-plugin-react-hooks": "^2.5.0",
"exports-loader": "^0.7.0",
"file-loader": "^5.1.0",
"html-webpack-plugin": "^3.2.0",
"imagemin-webpack-plugin": "^2.4.2",
"imports-loader": "^0.8.0",
"ip": "^1.1.5",
"karma": "^4.4.1",
"karma-chrome-launcher": "^3.1.0",
"karma-coverage": "^2.0.1",
"karma-edge-launcher": "^0.4.2",
"karma-firefox-launcher": "^1.3.0",
"karma-ios-simulator-launcher": "0.0.4",
"karma-junit-reporter": "^2.0.1",
"karma-mocha": "^1.3.0",
"karma-parallel": "^0.3.1",
"karma-safari-private-launcher": "^1.0.0",
"karma-sourcemap-loader": "^0.3.7",
"karma-spec-reporter": "0.0.32",
"karma-webpack": "^4.0.2",
"less": "^3.11.1",
"less-loader": "^5.0.0",
"mini-css-extract-plugin": "^0.9.0",
"mocha": "^7.1.0",
"node-noop": "^1.0.0",
"node-sass": "^4.13.1",
"optimize-css-assets-webpack-plugin": "^5.0.3",
"parse5": "^5.1.1",
"postcss-loader": "^3.0.0",
"prettier": "^1.19.1",
"puppeteer": "^2.1.1",
"react-test-renderer": "^16.12.0",
"sass-loader": "^8.0.2",
"sinon": "^9.0.1",
"style-loader": "^1.1.3",
"svg-sprite-loader": "^4.2.1",
"terser-webpack-plugin": "^2.3.5",
"typescript": "^3.8.3",
"url-loader": "^3.0.0",
"webpack": "^4.41.6",
"webpack-bundle-analyzer": "^3.6.1",
"webpack-cli": "^3.3.11",
"webpack-dev-server": "^3.10.3",
"worker-loader": "^2.0.0",
"xregexp": "^4.3.0"
Thanks - can you please provide dependencies
as well (minus anything proprietary)?
@smcenlly I would rather not. There is nothing in dependencies that should affect anything happening here. We could theoretically remove all dependencies and it wouldn't affect the tests since this is just a Webpack file loading problem.
Also I should have added, but this is how we are loading the file
import blackRectangle from 'tests/images/black-rectangle.png';
Thanks - we'll set up a project with the details that you've sent us and try replicate your problem.
Thank you!
I can email more information if needed by the way, it's just that the dependencies are mostly internal packages and React/Redux stuff. None of it is used with our build system.
We can replicate the problem. Will reply when we work out what's going on/wrong.
@smcenlly Thank you! Please let me know if I can help.
Thanks for reporting the problem. Wallaby adds its own loaders to perform some pre/post instrumentation processing of your files. Our loaders weren't marked as raw
, which means that when using Wallaby, all file content was being converted to a UTF8 string, regardless of whether it was a binary file or not. This has been fixed in the latest version of Wallaby, v1.0.871. Wallaby will automatically update for you with this fix within 20-30 minutes. If you want to update immediately, you may run the VS Code command Wallaby.js: Force Core Update
.
Thank you so much. That is pretty interesting and I'll give it a shot tomorrow.
Issue description or question
We are using Webpack with the Webpack postprocessor https://wallabyjs.com/docs/integration/webpack-built-in.html. Within our Webpack config, we use file-loader and url-loader to load in image files. However, the image data we receive when attempting to load the image is corrupted and our image tests fail as a result.
For example, we have this black rectangle image file that is base64 encoded via url-loader into the following
But when running tests in Wallaby, we get the following
Which then fails to load the image as it is corrupted. Note: The image is in the
tests/images
directoryAlso, we are setting "binary: true" on the Wallaby directory for our test images and it is not helping.
Wallaby diagnostics report
Note: I am skipping some of the diagnostic report because of proprietary information. Please let me know if you need more information.