Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Commit

Permalink
RC > Instrument different directory for libraries (#448)
Browse files Browse the repository at this point in the history
  • Loading branch information
Blackbaud-SteveBrush authored Aug 9, 2018
1 parent 8c20e03 commit 6e55ea2
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
14 changes: 11 additions & 3 deletions config/webpack/test.webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,16 @@ function outPath() {
}

function getWebpackConfig(skyPagesConfig, argv) {
const runCoverage = (!argv || argv.coverage !== false);
skyPagesConfig.runtime.includeRouteModule = false;
const ENV = process.env.ENV = process.env.NODE_ENV = 'test';
const srcPath = path.resolve(process.cwd(), 'src', 'app');
const argvCoverage = (argv) ? argv.coverage : true;
const runCoverage = (argvCoverage !== false);

let srcPath;
if (argvCoverage === 'library') {
srcPath = path.resolve(process.cwd(), 'src', 'app', 'public');
} else {
srcPath = path.resolve(process.cwd(), 'src', 'app');
}

const resolves = [
process.cwd(),
Expand All @@ -33,6 +39,8 @@ function getWebpackConfig(skyPagesConfig, argv) {
outPath('node_modules')
];

skyPagesConfig.runtime.includeRouteModule = false;

let alias = aliasBuilder.buildAliasList(skyPagesConfig);

let config = {
Expand Down
15 changes: 15 additions & 0 deletions test/config-webpack-test.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*jshint jasmine: true, node: true */
'use strict';

const path = require('path');
const runtimeUtils = require('../utils/runtime-test-utils');

describe('config webpack test', () => {
Expand Down Expand Up @@ -104,4 +105,18 @@ describe('config webpack test', () => {
expect(foundMatch).toBe(true);
}
});

it('should run coverage differently for libraries', () => {
let instrumentLoader = getInstrumentLoader();
let index = instrumentLoader.include.indexOf(path.resolve('src', 'app'));

expect(index > -1).toEqual(true);

instrumentLoader = getInstrumentLoader({
coverage: 'library'
});

index = instrumentLoader.include.indexOf(path.resolve('src', 'app', 'public'));
expect(index > -1).toEqual(true);
});
});

0 comments on commit 6e55ea2

Please sign in to comment.