wip
This commit is contained in:
+1
-1
@@ -182,7 +182,7 @@ module.exports = function(grunt) {
|
||||
autoWatch: true
|
||||
},
|
||||
amd: {
|
||||
configFile: 'karma-setup/requirejs/karma.conf.js',
|
||||
configFile: 'karma-setup/amd/karma.conf.js',
|
||||
browsers: [],
|
||||
singleRun: false,
|
||||
autoWatch: true
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"extends": [
|
||||
"../.eslintrc.js"
|
||||
],
|
||||
"overrides": [
|
||||
{
|
||||
"extends": [
|
||||
"plugin:es5/no-es2015",
|
||||
"prettier"
|
||||
],
|
||||
"files": ["**/*.browser.js"],
|
||||
"plugins": [
|
||||
"es5"
|
||||
],
|
||||
"globals": {
|
||||
"TODO: clean this up": true,
|
||||
"CompilerContext": true,
|
||||
"Handlebars": true,
|
||||
"handlebarsEnv": true,
|
||||
"shouldCompileTo": true,
|
||||
"shouldCompileToWithPartials": true,
|
||||
"shouldThrow": true,
|
||||
"expectTemplate": true,
|
||||
"compileWithPartials": true,
|
||||
"console": true,
|
||||
"require": true,
|
||||
"suite": true,
|
||||
"equal": true,
|
||||
"equals": true,
|
||||
"test": true,
|
||||
"testBoth": true,
|
||||
"raises": true,
|
||||
"deepEqual": true,
|
||||
"start": true,
|
||||
"stop": true,
|
||||
"ok": true,
|
||||
"sinon": true,
|
||||
"strictEqual": true,
|
||||
"define": true,
|
||||
"expect": true,
|
||||
"chai": true
|
||||
},
|
||||
"env": {
|
||||
"mocha": true
|
||||
},
|
||||
"rules": {
|
||||
// Disabling for tests, for now.
|
||||
"no-path-concat": "off",
|
||||
|
||||
"no-var": "off",
|
||||
"dot-notation": "off"
|
||||
}
|
||||
},
|
||||
]
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
module.exports = function(config) {
|
||||
config.set({
|
||||
basePath: '../..',
|
||||
reporters: ['dots'],
|
||||
frameworks: ['mocha', 'requirejs'],
|
||||
browsers: ['Chrome'],
|
||||
@@ -8,10 +9,10 @@ module.exports = function(config) {
|
||||
{ pattern: 'node_modules/chai/chai.js', included: false },
|
||||
{ pattern: 'node_modules/dirty-chai/lib/dirty-chai.js', included: false },
|
||||
{ pattern: 'dist/handlebars.amd.js', included: false },
|
||||
'karma-setup/karma-includes/browser-context.js',
|
||||
'karma-setup/shared/*.browser.js',
|
||||
'karma-setup/amd/*.browser.js',
|
||||
'spec/vendor/json2.js',
|
||||
'spec/env/common.js',
|
||||
'karma-setup/karma-includes/require-config.js',
|
||||
{ pattern: 'spec/*.js', included: false }
|
||||
]
|
||||
});
|
||||
@@ -0,0 +1,38 @@
|
||||
/* global requirejs */
|
||||
|
||||
var tests = Object.keys(window.__karma__.files).filter(function(file) {
|
||||
return file.match(/^\/base\/spec\/[^/]*\.js/);
|
||||
});
|
||||
|
||||
requirejs.config({
|
||||
// Karma serves files from '/base'
|
||||
baseUrl: '/base',
|
||||
|
||||
paths: {
|
||||
handlebars: 'dist/handlebars.amd',
|
||||
sinon: 'node_modules/sinon/pkg/sinon',
|
||||
chai: 'node_modules/chai/chai',
|
||||
dirtyChai: 'node_modules/dirty-chai/lib/dirty-chai'
|
||||
},
|
||||
|
||||
// start test run, once Require.js is done
|
||||
callback: function() {
|
||||
require(['handlebars', 'chai', 'dirtyChai', 'sinon'], function(
|
||||
Handlebars,
|
||||
chai,
|
||||
dirtyChai,
|
||||
sinon
|
||||
) {
|
||||
window.Handlebars = Handlebars;
|
||||
|
||||
chai.use(dirtyChai);
|
||||
window.expect = chai.expect;
|
||||
|
||||
window.sinon = sinon;
|
||||
|
||||
require(tests, function() {
|
||||
window.__karma__.start();
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
window.expect = chai.expect;
|
||||
@@ -1,8 +1,20 @@
|
||||
const files = require('../shared/default-files');
|
||||
|
||||
module.exports = function(config) {
|
||||
config.set({
|
||||
...require('../shared/default-config'),
|
||||
files: [...files('dist/handlebars.js'), 'spec/*.js']
|
||||
basePath: '../..',
|
||||
reporters: ['dots'],
|
||||
frameworks: ['mocha'],
|
||||
browsers: ['Chrome'],
|
||||
files: [
|
||||
'node_modules/sinon/pkg/sinon.js',
|
||||
'node_modules/chai/chai.js',
|
||||
'node_modules/dirty-chai/lib/dirty-chai.js',
|
||||
'karma-setup/shared/*.browser.js',
|
||||
'karma-setup/default/*.browser.js',
|
||||
'spec/vendor/json2.js',
|
||||
'spec/env/common.js',
|
||||
|
||||
'dist/handlebars.js',
|
||||
'spec/*.js'
|
||||
]
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
{
|
||||
"extends": [
|
||||
"../../.eslintrc.js",
|
||||
"plugin:es5/no-es2015",
|
||||
"prettier"
|
||||
],
|
||||
"plugins": [
|
||||
"es5"
|
||||
],
|
||||
"globals": {
|
||||
"TODO: clean this up": true,
|
||||
"CompilerContext": true,
|
||||
"Handlebars": true,
|
||||
"handlebarsEnv": true,
|
||||
"shouldCompileTo": true,
|
||||
"shouldCompileToWithPartials": true,
|
||||
"shouldThrow": true,
|
||||
"expectTemplate": true,
|
||||
"compileWithPartials": true,
|
||||
"console": true,
|
||||
"require": true,
|
||||
"suite": true,
|
||||
"equal": true,
|
||||
"equals": true,
|
||||
"test": true,
|
||||
"testBoth": true,
|
||||
"raises": true,
|
||||
"deepEqual": true,
|
||||
"start": true,
|
||||
"stop": true,
|
||||
"ok": true,
|
||||
"sinon": true,
|
||||
"strictEqual": true,
|
||||
"define": true,
|
||||
"expect": true,
|
||||
"chai": true
|
||||
},
|
||||
"env": {
|
||||
"mocha": true
|
||||
},
|
||||
"rules": {
|
||||
// Disabling for tests, for now.
|
||||
"no-path-concat": "off",
|
||||
|
||||
"no-var": "off",
|
||||
"dot-notation": "off"
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
console.log('Setup starting');
|
||||
|
||||
window.expect = chai.expect;
|
||||
mocha.setup('bdd');
|
||||
// eslint-disable-next-line no-undef
|
||||
chai.use(dirtyChai);
|
||||
|
||||
console.log('Setup complete');
|
||||
@@ -1,29 +0,0 @@
|
||||
/* global requirejs */
|
||||
|
||||
var tests = [];
|
||||
|
||||
console.log('ABC', Object.keys(window.__karma__.files));
|
||||
requirejs.config({
|
||||
// Karma serves files from '/base'
|
||||
baseUrl: '/',
|
||||
|
||||
paths: {
|
||||
handlebars: '/base/dist/handlebars.amd',
|
||||
mochaConfig: '/base/karma-setup/karma-includes/mocha',
|
||||
sinon: '/base/node_modules/sinon/pkg/sinon',
|
||||
chai: '/base/node_modules/chai/chai',
|
||||
dirtyChai: '/base/node_modules/dirty-chai/lib/dirty-chai'
|
||||
},
|
||||
|
||||
shim: {
|
||||
mochaConfig: {
|
||||
deps: ['mocha', 'chai', 'dirtyChai', 'sinon']
|
||||
}
|
||||
},
|
||||
|
||||
// ask Require.js to load these files (all our tests)
|
||||
deps: ['handlebars', 'mochaConfig', tests],
|
||||
|
||||
// start test run, once Require.js is done
|
||||
callback: window.__karma__.start
|
||||
});
|
||||
@@ -1,19 +0,0 @@
|
||||
module.exports = function(config) {
|
||||
config.set({
|
||||
baseUrl: '../..',
|
||||
reporters: ['dots'],
|
||||
frameworks: ['mocha', 'requirejs'],
|
||||
browsers: ['Chrome'],
|
||||
files: [
|
||||
{ pattern: 'node_modules/sinon/pkg/sinon.js', included: false },
|
||||
{ pattern: 'node_modules/chai/chai.js', included: false },
|
||||
{ pattern: 'node_modules/dirty-chai/lib/dirty-chai.js', included: false },
|
||||
{ pattern: 'dist/handlebars.amd.js', included: false },
|
||||
'karma-setup/karma-includes/browser-context.js',
|
||||
'spec/vendor/json2.js',
|
||||
'spec/env/common.js',
|
||||
'karma-setup/karma-includes/require-config.js',
|
||||
{ pattern: 'spec/*.js', included: false }
|
||||
]
|
||||
});
|
||||
};
|
||||
@@ -1,6 +0,0 @@
|
||||
module.exports = {
|
||||
frameworks: ['mocha'],
|
||||
// concurrency: we have no concurrency set, because this seems to let Karma hang after the first batch
|
||||
// of browsers have finished their tests.
|
||||
reporters: ['dots']
|
||||
};
|
||||
@@ -1,13 +0,0 @@
|
||||
module.exports = function files(...additionalFiles) {
|
||||
return [
|
||||
'node_modules/sinon/pkg/sinon.js',
|
||||
'node_modules/chai/chai.js',
|
||||
'node_modules/dirty-chai/lib/dirty-chai.js',
|
||||
'node_modules/mocha/mocha.js',
|
||||
...additionalFiles,
|
||||
'spec/browser-setup/browser-context.js',
|
||||
'spec/browser-setup/mocha.js',
|
||||
'spec/vendor/json2.js',
|
||||
'spec/env/common.js'
|
||||
];
|
||||
};
|
||||
Reference in New Issue
Block a user