Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
thostetler committed Apr 18, 2019
1 parent 7948ab8 commit c1a56e7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion grunt/exec.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module.exports = {
cmd: "mkdir src/libs/enzyme && ./node_modules/.bin/browserify --standalone enzyme -x 'react/addons' -x 'react/lib/ReactContext' -x 'react/lib/ExecutionEnvironment' node_modules/enzyme/build/index.js > src/libs/enzyme/enzyme.js"
},
'nyc-instrument': {
cmd: 'node_modules/.bin/nyc instrument src/js/ test/coverage/instrument'
cmd: 'node_modules/.bin/nyc instrument dist/js/ test/coverage/instrument'
},
'coveralls-report': {
cmd: 'cat test/coverage/reports/lcov/lcov.info | ./node_modules/coveralls/bin/coveralls.js'
Expand Down
17 changes: 14 additions & 3 deletions grunt/puppet.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ module.exports = function (grunt) {
'!widgets/facet_graph_widget.spec.js'
]);
specs = specs.map(p => p.replace(/^/, 'test/mocha/js/').replace('.js', ''));
let coverageMappings = grunt.file.expand({
cwd: path.resolve('src/js')
}, ['**/*.js']);
coverageMappings = coverageMappings.reduce((acc, m) => {
m = m.replace('.js', '');
acc[m] = m.replace(/^src\//, 'test/coverage/');
return acc;
}, {});

const browser = await puppeteer.launch({
headless: true,
devtools: false
Expand All @@ -42,9 +51,11 @@ module.exports = function (grunt) {
await page.exposeFunction('_setTotal_', (...args) => bar.setTotal.apply(bar, args));
await page.exposeFunction('_log_', (...args) => console.log.apply(console, args));
await page.exposeFunction('_err_', (...args) => console.error.apply(console, args));
await page.evaluate((specs) => {
await page.evaluate((specs, coverageMappings) => {
return new Promise(resolve => {
require({ baseUrl: '/' }, [
require({
map: { '*': coverageMappings }
}, [
'mocha', 'chai', 'sinon',
'../../node_modules/es5-shim/es5-shim.min'
], (mocha, chai) => {
Expand Down Expand Up @@ -84,7 +95,7 @@ module.exports = function (grunt) {
});
});
});
}, specs);
}, specs, coverageMappings);
await browser.close();
done();
});
Expand Down

0 comments on commit c1a56e7

Please sign in to comment.