Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'use strict';
// Karma configuration
// Generated on Thu Oct 08 2015 18:13:05 GMT-0700 (PDT)
let path = require('path');
let build = require('@microsoft/web-library-build');
let configResources = build.karma.resources;
let bindPolyfillPath = configResources.bindPolyfillPath;
let debugRun = (process.argv.indexOf('--debug') > -1);
let testsFilePath = path.join(build.getConfig().tempFolder, 'tests.js');
module.exports = function(config) {
let karmaConfig = {
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '.',
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['mocha', 'sinon-chai'],
'use strict';
// Karma configuration
// Generated on Thu Oct 08 2015 18:13:05 GMT-0700 (PDT)
let path = require('path');
let build = require('@microsoft/web-library-build');
let configResources = build.karma.resources;
let bindPolyfillPath = configResources.bindPolyfillPath;
let debugRun = (process.argv.indexOf('--debug') > -1);
let testsFilePath = path.join(build.getConfig().tempFolder, 'tests.js');
module.exports = function(config) {
let karmaConfig = {
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '.',
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['mocha', 'sinon-chai'],
// list of files / patterns to load in the browser
files: [bindPolyfillPath].concat([testsFilePath]),
function startRun() {
if (!isBuilding) {
isBuilding = true;
buildEnqueued = false;
console.log('Starting build...');
rushBuild.execute(build.getConfig()).then(() => {
isBuilding = false;
// After build is complete, trigger reload.
build.reload.execute(build.getConfig());
if (buildEnqueued) {
startRun();
}
}).catch(() => {
isBuilding = false;
if (buildEnqueued) {
startRun();
}
});
} else {
buildEnqueued = true;
const sourceMatch = [];
projectMatch.forEach(project => sourceMatch.push(
`${project}/src/**/*.{ts,tsx,scss,js,txt,html}`,
`!${project}/src/**/*.scss.ts`
));
let rushBuild = build.subTask('rushBuild', (gulp, options, done) => {
let child = exec(`rush build --to ${pkg.name} ${isProduction ? '--production' : ''}`);
child.stdout.on('data', data => process.stdout.write(data));
child.on('close', done);
});
let customWatch = build.subTask('customWatch', (gulp, options, done) => {
let gaze = require('gaze');
let isBuilding = false;
let buildEnqueued = false;
function startRun() {
if (!isBuilding) {
isBuilding = true;
buildEnqueued = false;
console.log('Starting build...');
rushBuild.execute(build.getConfig()).then(() => {
isBuilding = false;
// After build is complete, trigger reload.
build.reload.execute(build.getConfig());
}
};
// Start watch at root of repo.
let rootPath = path.resolve(__dirname, '../..');
console.log(`Starting watch in ${rootPath}`);
gaze(sourceMatch, { cwd: rootPath }, function () {
this.on('all', startRun);
});
});
build.task('w', customWatch);
build.task('serve', serial(
rushBuild,
build.serve,
customWatch
));
// Shortcuts for individual subtasks.
build.task('webpack', build.webpack);
build.task('tslint', build.tslint);
build.task('ts', build.typescript);
// initialize tasks.
build.initialize(gulp);
'use strict';
let gulp = require('gulp');
let build = require('@microsoft/web-library-build');
build.task('sass', build.sass);
build.task('karma', build.karma);
// initialize tasks.
build.initialize(gulp);
// Always fail on test failures.
build.karma.setConfig({
failBuildOnErrors: true
});
// Use css modules.
build.sass.setConfig({
useCSSModules: true
});
this.on('all', startRun);
});
});
build.task('w', customWatch);
build.task('serve', serial(
rushBuild,
build.serve,
customWatch
));
// Shortcuts for individual subtasks.
build.task('webpack', build.webpack);
build.task('tslint', build.tslint);
build.task('ts', build.typescript);
// initialize tasks.
build.initialize(gulp);
'use strict';
let gulp = require('gulp');
let build = require('@microsoft/web-library-build');
build.task('sass', build.sass);
build.task('karma', build.karma);
// initialize tasks.
build.initialize(gulp);
// Always fail on test failures.
build.karma.setConfig({
failBuildOnErrors: true
});
// Use css modules.
build.sass.setConfig({
useCSSModules: true
});
'use strict';
let gulp = require('gulp');
let build = require('@microsoft/web-library-build');
build.task('sass', build.sass);
build.task('karma', build.karma);
// initialize tasks.
build.initialize(gulp);
// Always fail on test failures.
build.karma.setConfig({
failBuildOnErrors: true
});
// Use css modules.
build.sass.setConfig({
useCSSModules: true,
moduleExportName: ''
});
'use strict';
let gulp = require('gulp');
let build = require('@microsoft/web-library-build');
build.task('sass', build.sass);
build.task('karma', build.karma);
// initialize tasks.
build.initialize(gulp);
// Always fail on test failures.
build.karma.setConfig({
failBuildOnErrors: true
});
// Use css modules.
build.sass.setConfig({
useCSSModules: true,
moduleExportName: ''
});