canvas-lms/webpack.test.config.babel.js

77 lines
2.4 KiB
JavaScript
Raw Normal View History

import 'babel-polyfill'
var webpack = require("webpack");
var I18nPlugin = require("./frontend_build/i18nPlugin");
var ClientAppsPlugin = require("./frontend_build/clientAppPlugin");
var CompiledReferencePlugin = require("./frontend_build/CompiledReferencePlugin");
var ShimmedAmdPlugin = require("./frontend_build/shimmedAmdPlugin");
var baseWebpackConfig = require("./frontend_build/baseWebpackConfig");
var testWebpackConfig = baseWebpackConfig;
// the ember specs don't play nice with the rest,
// so we run them in totally seperate bundles
if(process.env.WEBPACK_TEST_BUNDLE == 'ember'){
testWebpackConfig.entry = {
'WebpackedEmberSpecs': "./spec/javascripts/webpack_ember_spec_index.js"
}
}else {
testWebpackConfig.entry = {
'WebpackedSpecs': "./spec/javascripts/webpack_spec_index.js"
}
}
testWebpackConfig.devtool = undefined;
testWebpackConfig.output.path = __dirname + '/spec/javascripts/webpack';
testWebpackConfig.output.pathinfo = true;
testWebpackConfig.output.filename = "[name].bundle.test.js";
testWebpackConfig.plugins = [
new I18nPlugin(),
new ShimmedAmdPlugin(),
new ClientAppsPlugin(),
new CompiledReferencePlugin(),
new webpack.IgnorePlugin(/\.md$/),
new webpack.IgnorePlugin(/(CHANGELOG|LICENSE|README)$/),
new webpack.IgnorePlugin(/package.json/)
];
testWebpackConfig.resolve.alias.qunit = "qunitjs/qunit/qunit.js";
testWebpackConfig.resolve.root.push(__dirname + '/spec/coffeescripts');
testWebpackConfig.resolve.root.push(__dirname + '/spec/javascripts/support');
testWebpackConfig.module.loaders.push({
test: /\/spec\/coffeescripts\//,
loaders: ["qunitDependencyLoader"]
});
// Some plugins use a special spec_canvas path for their specs
testWebpackConfig.module.loaders.push({
test: /\/spec_canvas\/coffeescripts\//,
loaders: [
'qunitDependencyLoader'
]
});
testWebpackConfig.module.loaders.push({
test: /\/spec\/javascripts\/jsx\//,
loaders: ["qunitJsxDependencyLoader"]
});
testWebpackConfig.module.loaders.push({
test: /\/ember\/.*\/tests\//,
loaders: ["qunitDependencyLoader"]
});
testWebpackConfig.module.postLoaders = [{
test: /(jsx.*(\.js$|\.jsx$)|\.coffee$|public\/javascripts\/.*\.js$)/,
exclude: /(node_modules|spec|public\/javascripts\/(bower|client_apps|compiled|jst|jsx|translations|vendor))/,
loader: 'istanbul-instrumenter'
}]
testWebpackConfig.module.noParse = [
Add automated a11y testing helper for qunit tests refs SD-743 fixes CNVS-26721 This adds a qunit assertion helper that wraps the aXe library. Rules can be ignored by passing an array of rules in the options argument to the helper. e.g. `assertions.isAccessible $html, done, { ignores: 'aria-valid-attr-value'}` Test plan: Undo the changes that I made to the DashboardCard.jsx component. You should get a warning about invalid aria attributes because the aria-controls attribute is referring to an element that doesn't exist. To fix this, I modified the component to hide/show the color picker so that the aria attribute value is valid. If you add the ignores option as described above, the test should pass without my changes. To verify the dashboard card color picker changes: - Verify that you can click or use the ENTER key on a dashboard card cog button to bring up the color picker - Verify that you can select a color and apply it to the card. - Verify that you can click outside the color picker to close it - Verify that you can hit the ESC key to close the color picker - When the color picker is closed, focus should return to the the cog button trigger - After selecting a color you should be able to open the color picker again and select a different color The color picker in the Calendar should be regression tested as well. Change-Id: I5d5bfdaf39df1e0cb8776144771baeb1ed31ff2a Reviewed-on: https://gerrit.instructure.com/70638 Reviewed-by: Ryan Shaw <ryan@instructure.com> Product-Review: Colleen Palmer <colleen@instructure.com> QA-Review: Myller de Araujo <myller@instructure.com> Tested-by: Jenkins
2016-01-20 12:32:39 +08:00
/\/sinon-1.17.2.js/,
/\/axe.js/
]
module.exports = testWebpackConfig;