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
aurelia-cli, node, and jasmine #974
Comments
There are a couple of issues with your config. The first issue is that your ES6 modules are transformed to AMD because of this babel plugin: The second issue is that you're using The slightly adjusted config from this repo may work for you. Here the discussion about this config. The only adjustment I have made is to remove the above mentioned var wallabyWebpack = require('wallaby-webpack');
var wallabyPostprocessor = wallabyWebpack({
entryPatterns: ['test/unit/setup.js', 'test/unit/**/*.spec.js']
});
module.exports = function (wallaby) {
return {
files: [
{pattern: "src/**/*.js", load: false},
{pattern: "test/stubs/**/*.js", load: false},
{pattern: "test/unit/setup.js", load: false},
],
tests: [
{pattern: "test/unit/**/*.spec.js", load: false}
],
env: {
kind: "electron"
},
compilers: {
'**/*.js': wallaby.compilers.babel({
"presets": [
"es2015",
"es2016"
],
"plugins": [
"transform-regenerator",
"transform-async-generator-functions",
"syntax-async-functions",
"transform-decorators-legacy",
"transform-class-properties"
]
})
},
postprocessor: wallabyPostprocessor,
setup: function () {
window.__moduleBundler.loadTests();
}
};
}; plus
|
Hi @ArtemGovorov, So my problem was right down to the window not being found... or at least one of them while devving in node/mocha, which is why I had switched to jasmine. So after all of this going down the deep dark rabbit hole, I went back to node: module.exports = function (wallaby) {
return {
// set `load: false` to all source files and tests processed by webpack
// (except external files),
// as they should not be loaded in browser,
// their wrapped versions will be loaded instead
files: [
// {pattern: 'node_modules/babel-polyfill/dist/polyfill.min.js', instrument: false},
// {pattern: 'node_modules/aurelia-polyfills/dist/commonjs/aurelia-polyfills.js', instrument: false},
{pattern: 'node_modules/requirejs/require.js', instrument: false},
{pattern: "src/**/*.js"},
{pattern: "src/**/*.html"}
],
tests: [
//'test/unit/**/*tests.js'
'test/unit/**/search/*tests.js'
],
compilers: {
'**/*.js': wallaby.compilers.babel()
},
env: {
// use 'node' type to use node.js or io.js
type: 'node',
},
testFramework: 'mocha',
debug: true,
reportConsoleErrorAsError: true,
delay: {
run: 500
}
};
}; After resetting a couple of tests, I found the issue to be:
which is in direct correlation with aurelia-bootstrapper (which you can also see). It still goes into not having a window rep, like you called out. Finally, to address your node message. For me, my ideal is to use node/mocha, and it's been working. In the end the aurelia cli compiles the project into something browser safe. Of course this means trying to get test libraries to align; including wallabyjs. As a side note, I really do wish it was easier to understand the setup area of wallaby. Right now, we go look at docs, but there isn't, I feel, enough information over what's exposed through the setup. In either case, this should still be closed. Thanks, |
Yep, I did mention it's going to happen with the
If plain node/mocha is working for you, then wallaby.js can also work. You'll just need to load/require your mocha
Thanks for the feedback. Could you please share what else in your opinion can we add to the docs to make it better? |
Thanks again for your help @ArtemGovorov. I do appreciate it, and I love wallaby. I'd be happy to share doc ideas. Where would you like me to share doc questions and suggestions? I know the importance of closing a topic/issue/bug/feature request. Cheers, |
@kvernon Thanks! |
Issue description or question
I'm running into where I'm trying to test one of Aurelia's bindable decorators. Before this, things went well, but now that I have to verify code for bindables, I can't get this to work. I'm struggling.
In the end, I know I'm doing something wrong... please help!
An additional note, is that I'm using the Aurelia-cli tool.
error:
Wallaby.js configuration file
###.babelrc
###index-tests.js
Code editor or IDE name and version
WebStorm V2016.3.2
OS name and version
Windows 10 AU
Thanks,
Kelly
The text was updated successfully, but these errors were encountered: