Closed forkingpath closed 8 years ago
Could you please share your wallaby and webpack configs?
Some folder names changed to protect $dayjob.
var path = require('path');
var webpack = require('webpack');
var chai = require('chai');
var appRootPath = path.resolve(__dirname, "app");
var modulePath = path.resolve(appRootPath, 'vendor');
var wallabyWebpack = require('wallaby-webpack');
var buildConstants = require('./plugins/build_constants');
var babel = require('babel-core');
var wallabyPostprocessor = wallabyWebpack({
externals: {
"Backbone": "backbone",
FB: "var FB"
},
plugins: [
new webpack.DefinePlugin(buildConstants),
new webpack.IgnorePlugin( /.scss$/ ),
new webpack.ProvidePlugin(
{
"_": "underscore",
"$": "jquery",
"jquery": "jquery",
"jQuery": "jquery",
"React": "react",
"react": "react",
"isMobile": path.resolve(modulePath, "isMobile"),
"hammer": path.resolve(modulePath, "hammer"),
"Hammer": path.resolve(appRootPath, "vendor/hammer")
})
],
resolve: {
fallback: path.resolve("./node_modules"),
root: [
appRootPath,
path.resolve(appRootPath,"stores"),
path.resolve(appRootPath,"jsx-templates/base/components"),
path.resolve(appRootPath,"jsx-templates/base/dialogs"),
path.resolve(appRootPath,"jsx-templates/base/"),
path.resolve(appRootPath,"vendor"),
path.resolve(appRootPath, "bower_components"),
path.resolve(appRootPath,"../node_modules/gsap/src/uncompressed")
],
extensions: ['', '.js', '.jsx', '.sass', '.css', '.scss']
},
module: {
noParse: /(vendor|jquery|bower_components|gsap|json|scss|react\.js).*/
}
}
);
module.exports = function (wallaby) {
return {
env: {
NODE_ENV: "test",
BABEL_ENV: "test",
type: 'node',
runner: "C:\\phantomjs-2.0.0-windows\\bin\\phantomjs.exe"
},
files: [
{pattern: 'node_modules/chai/chai.js', instrument: false},
{pattern: 'node_modules/sinon-chai/sinon-chai.js', instrument: false},
{pattern: 'node_modules/chai-as-promised/lib/chai-as-promised.js', instrument: false},
{pattern: 'app/game-wrappers/*.js', load: false},
{pattern: 'app/jsx-templates/base/*.jsx', load: false},
{pattern: 'app/stores/**/*.jsx', load: false},
{pattern: 'app/utils/**/*.js', load: false},
{pattern: 'app/*.js', load: false}
],
compilers: {
'app/**/*.js*': file => babel.transform(file.content, {
sourceMap: true,
presets: ['react', 'stage-0', 'es2015'],
plugins: ['transform-runtime', "babel-plugin-transform-decorators-legacy", 'rewire']
})
},
tests: [
{pattern: 'test/*Test.js', load: false}
],
testFramework: 'mocha',
postprocessor: wallabyPostprocessor,
debug: true,
bootstrap: function (wallaby) {
window.__moduleBundler.loadTests();
},
workers: {
initial: 6,
regular: 3
}
};
};
Thanks. It looks like you're trying to use 2 incompatible options:
env: {
...
type: 'node',
runner: "C:\\phantomjs-2.0.0-windows\\bin\\phantomjs.exe"
},
type: 'node'
supposed to be used when you'd like to run your tests in node.js. However, from the rest of your config it looks like you're running browser tests, so you should remove it (or specify type: 'browser'
which is the default option value). Please also make sure the C:\\phantomjs-2.0.0-windows\\bin\\phantomjs.exe
file exists.
Ah, I see. I had thought that because PhantomJS runs in node, it would be a node environment, but that's wrong! Thank you!
Cool, let me know if you hit any other bumps configuring wallaby.js for your project, happy to help.
I'm not sure if I've misconfigured something or not, but I can't see any reason for this to be happening, & my tests and webpack configs work separately from wallaby.js. After loading and transpiling my app code and single test, the following output loops in the console:
It just repeats with different session #s. Not only that, but whatever number of workers I specify in wallaby.js, they all time out too. What's going on?
I can't find any docs about the workers that wallaby uses, so I don't know where to start. I tried to cut down my Webpack compilation time but it's holding steady at around 15s; either way it doesn't look like that's what is causing it to time out based on experimenting with the config.