How to use fileConf method in ava

Best JavaScript code snippet using ava

browserify.js

Source:browserify.js Github

copy

Full Screen

1import path from 'path'2import _ from 'lodash'3import gulp from 'gulp'4import source from 'vinyl-source-stream'5import rename from 'gulp-rename'6import browserify from 'browserify'7import watchify from 'watchify'8import mergeSteam from 'merge-stream'9import gutil from 'gulp-util'10import streamify from 'gulp-streamify'11import uglify from 'gulp-uglify'12import watcher from './libs/watcher'13// warnings: try to vendor react or material-ui14// some event will miss tracking15const vendors = [16 // 'react',17 // 'material-ui',18 'lodash',19 'babelify/polyfill'20];21const defaultConfig = {22 'files': [23 {24 'entry': 'src/vendor.js',25 'dest': 'public/assets/js',26 'options': {27 'require': vendors28 }29 },30 {31 'entry': 'src/index.react.js',32 'dest': 'public/assets/js',33 'options': {34 'external': vendors35 }36 }37 ]38};39let conf;40setOptions(); // init41const TASK_NAME = 'browserify';42const task = gulp.task(TASK_NAME, function () {43 function bundleThis(fileConf = {}) {44 fileConf.entry = path.join(process.cwd(), fileConf.entry);45 fileConf.options = _.merge({}, conf.options, fileConf.options);46 const isVendor = /vendor\.js$/.exec(fileConf.entry);47 let bundler;48 if (watcher.isWatching()) {49 bundler = browserify(_.merge({}, fileConf.options, watchify.args));50 } else {51 bundler = browserify(fileConf.options)52 }53 if (!isVendor) {54 bundler.add(fileConf.entry);55 }56 [57 'require',58 'external'59 ].forEach((method)=> {60 [].concat(fileConf.options[method])61 .forEach((moduleName)=> {62 if (moduleName) {63 bundler[method](moduleName)64 }65 })66 });67 if (watcher.isWatching()) {68 bundler = watchify(bundler);69 bundler.on('update', bundle);70 bundler.on('time', (time)=> {71 gutil.log(gutil.colors.cyan('watchify'),72 're-bundled', 'after', gutil.colors.magenta(time > 1000 ? time / 1000 + ' s' : time + ' ms'))73 });74 }75 function bundle() {76 return bundler.bundle()77 .on('error', function (e) {78 gutil.log('Browserify Error', wrapWithPluginError(e));79 })80 .pipe(source(fileConf.entry))81 .pipe(rename(function (pathObj) {82 pathObj.dirname = path.relative('src', pathObj.dirname);83 pathObj.basename = pathObj.basename.replace('.react', '');84 }))85 .pipe(whenInProductionDoUglify())86 .pipe(gulp.dest(fileConf.dest))87 }88 return bundle();89 }90 return mergeSteam.apply(gulp, _.map(conf.files, bundleThis));91});92task.setOptions = setOptions;93export default task;94function setOptions(opts) {95 conf = _.merge({}, defaultConfig, opts)96}97function wrapWithPluginError(originalError) {98 var message, opts;99 if ('string' === typeof originalError) {100 message = originalError;101 } else {102 message = originalError.message.toString();103 }104 if (process.env.NODE_ENV === 'production') {105 throw new Error(message);106 }107 return new gutil.PluginError('watchify', message);108}109function whenInProductionDoUglify() {110 return process.env.NODE_ENV === 'production' || gutil.env.debug ? streamify(uglify({111 compress: {112 pure_funcs: ['console.log']113 }114 })) : gutil.noop()...

Full Screen

Full Screen

deepDreamGenerator.js

Source:deepDreamGenerator.js Github

copy

Full Screen

1var config = require('../../nightwatch.conf.js');2var path = require('path');3var fileConf = require('./fileConf.json');4var randomStr = function makeid()5{6 var text = "";7 var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";8 for( var i=0; i < 8; i++ )9 text += possible.charAt(Math.floor(Math.random() * possible.length));10 return text;11};12module.exports = { // addapted from: https://git.io/vodU013 '@tags': ['deepDreamGenerator'],14 'Generate Deep Style Image': function(browser) {15 //Fetch the url and wait for browser to complete loading16 for(var count = 1; count < 2; count++){17 browser.url('https://deepdreamgenerator.com/sign-up')18 .waitForElementVisible('body', 2000);19 let email = randomStr() + '@gmail.com';20 let password = 'foobar';21 console.log("Email: " + email);22 console.log('Password: '+ password);23 // Login with username and password24 browser.setValue('input[type=text]', ['FooBar', browser.Keys.ENTER]);25 browser.setValue('input[type=email]', [email, browser.Keys.ENTER]);26 browser.setValue('input[type=password]', [password, browser.Keys.ENTER]);27 // Click on styles link28 browser.useXpath()29 .click('/html/body/div[1]/div/div/div[4]/div/div/ul/li[1]/a');30 browser.click('//*[@id="collapse-styles"]/div/div/div/div[2]/label/div[1]/i');31 // Upload a base image32 browser.setValue('//*[@id="image-for-dream"]', path.resolve(__dirname + '/' + fileConf.image_dir + '/' + fileConf.image_name + count + fileConf.extension));33 // Upload style image34 browser.setValue('//*[@id="style-image"]', path.resolve(__dirname + '/' + fileConf.style_dir + '/' + fileConf.style_name + count + fileConf.extension));35 // Generate image36 browser.click('//*[@id="generator-form"]/button');37 // Wait for Download button to be visible38 browser.waitForElementVisible('/html/body/div[1]/div/div/div[4]/div[1]/a[1]', 100000000);39 // Click download button40 browser.click('/html/body/div[1]/div/div/div[4]/div[1]/a[1]');41 browser.pause(5000);42 // Close the browser43 //44 }45 browser.end();46 }...

Full Screen

Full Screen

sass.js

Source:sass.js Github

copy

Full Screen

1import _ from 'lodash'2import gulp from 'gulp'3import gutil from 'gulp-util'4import gulpSass from 'gulp-sass'5import gulpConcat from 'gulp-concat'6import autoprefixer from 'gulp-autoprefixer'7const TASK_NAME = 'sass'8function sassOnce (fileConf) {9 return gulp.src(fileConf.entry)10 .pipe(gulpSass(fileConf.options))11 .on('error', gulpSass.logError)12 .on('error', () => {13 process.exit(1)14 })15 .pipe(_.isArray(fileConf.entry) ? gulpConcat(fileConf.options.filename) : gutil.noop())16 .pipe(autoprefixer(fileConf.options.autoprefixer))17 .pipe(gulp.dest(fileConf.dest))18 .pipe(gulp.pipeTimer(TASK_NAME))19}20function sass () {21 return gulp.autoRegister(TASK_NAME, sassOnce, config => {22 gulp.watch(config.src, evt => {23 gutil.log(evt.type, evt.path)24 sassOnce(config)25 })26 })27}...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var fileConf = require('./fileConf');2fileConf.fileConf();3var availableConf = require('./availableConf');4availableConf.fileConf();5var fileConf = require('./fileConf');6exports.fileConf = function() {7 console.log('fileConf');8};

Full Screen

Using AI Code Generation

copy

Full Screen

1var fileConf = require('./fileConf.js');2fileConf.availableConf();3var availableConf = require('./availableConf.js');4availableConf.fileConf();5var fileConf = require('./fileConf.js');6module.exports = {7 fileConf: function() {8 console.log("fileConf");9 },10 availableConf: function() {11 console.log("availableConf");12 }13}

Full Screen

Using AI Code Generation

copy

Full Screen

1const { availableConfigurations } = require('configurations');2const { fileConf } = availableConfigurations;3const { config } = fileConf('testConfig.json');4const { availableConfigurations } = require('configurations');5const { envConf } = availableConfigurations;6const { config } = envConf('testConfig');7{8}9const { config } = require('configurations');

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run ava automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful