Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (isLocal) {
if (isLocal && (!process.env.BS_USER || !process.env.BS_KEY)) {
console.log(
'Hey!\n',
'You are missing credentials for Browserstack.\n',
'If you are a contributor, this is normal, credentials are private. These tests must be run by a maintainer of vue-router',
'If you are a maintainer, make sure to create your `.env` file with both `BS_USER` and `BS_KEY` variables!'
)
// fail if testing locally
process.exit(process.env.CI ? 0 : 1)
}
let bsLocal
const browserstack = require('browserstack-local')
Nightwatch.bs_local = bsLocal = new browserstack.Local()
bsLocal.start({ key: process.env.BS_KEY }, error => {
if (error) throw error
console.log('Connected. Now testing...')
try {
Nightwatch.cli(argv => {
adaptArgv(argv)
Nightwatch.CliRunner(argv)
.setup(null, () => {
// NOTE: I don't know when this is running or if it does
// Code to stop browserstack local after end of parallel test
bsLocal.stop(() => {
server && server.close()
process.exit(0)
})
})
#!/usr/bin/env node
var Nightwatch = require("nightwatch")
var browserstack = require("browserstack-local")
var bs_local
try {
process.mainModule.filename = "./node_modules/nightwatch/bin/nightwatch"
// Code to start browserstack local before start of test
console.log("Connecting local")
Nightwatch.bs_local = bs_local = new browserstack.Local()
bs_local.start(
{
key: process.env.BROWSERSTACK_ACCESS_KEY
},
function(error) {
if (error) throw error
console.log("Connected. Now testing...")
Nightwatch.cli(function(argv) {
Nightwatch.CliRunner(argv)
.setup(null, function() {
// Code to stop browserstack local after end of parallel test
bs_local.stop(function() {})
})
.runTests(function() {
// Code to stop browserstack local after end of single test
const globals = require('./nightwatch.globals');
const cp = require('child_process');
const httpServer = require('http-server');
const browserstack = require('browserstack-local');
const nightwatch = require('nightwatch');
const chromedriver = require('chromedriver');
const server = httpServer.createServer(); // {root:'./'}
const configs = Object.keys(conf.test_settings);
let bsLocal = null;
if (~process.argv.indexOf('--bs') || process.env.NIGHTWATCH_BROWSERSTACK) {
bsLocal = nightwatch.bs_local = new browserstack.Local;
}
beforeTests().then(doTests).then(afterTest).then(process.exit);
function beforeTests() {
server.listen(globals.port, globals.host);
return new Promise(res => {
if (bsLocal) {
bsLocal.start({}, err => {
if (err) {
if (err.message.indexOf('another browserstack local')) {
console.log('re-using running bs-local instance');
#!/usr/bin/env node
var Nightwatch = require('nightwatch');
var browserstack = require('browserstack-local');
var bs_local;
try {
process.mainModule.filename = "./node_modules/nightwatch/bin/nightwatch"
// Code to start browserstack local before start of test
console.log("Connecting local");
Nightwatch.bs_local = bs_local = new browserstack.Local();
bs_local.start({'key': process.env.BROWSERSTACK_ACCESS_KEY }, function(error) {
if (error) throw error;
console.log('Connected. Now testing...');
Nightwatch.cli(function(argv) {
Nightwatch.CliRunner(argv)
.setup(null, function(){
// Code to stop browserstack local after end of parallel test
bs_local.stop(function(){});
})
.runTests(function(){
// Code to stop browserstack local after end of single test
bs_local.stop(function(){});
});
});
});
e => {
return [
e.browser,
e.browser_version,
e.os,
e.os_version
].join('_').replace(/\./g, '-').replace(/ /g, '_');
}
);
try {
process.mainModule.filename = './node_modules/nightwatch/bin/nightwatch';
// Code to start browserstack local before start of test
console.log('Connecting localhost to Browserstack...');
Nightwatch.bs_local = bs_local = new browserstack.Local();
bs_local.start({
key: process.env.BROWSERSTACK_ACCESS_KEY,
localIdentifier: ('wvtester19234' + process.env.BROWSERSTACK_USER).replace(/[^a-zA-Z0-9]/g, ''),
force: 'true' // if you want to kill existing ports
}, function(error) {
if (error) throw new Error(error);
console.log('Connected. Running tests...');
console.log('Go to https://www.browserstack.com/automate to view tests in progress.');
Nightwatch.cli(argv => {
var envString = environment_names.join(',');
argv.e = envString;
argv.env = envString;
Nightwatch.CliRunner(argv)
.setup(null, () => {
bs_local.stop(() => {
/*eslint no-console: "allow"*/
const gulp = require('gulp');
require('../gulpfile.js');
const webpack = require('webpack');
const compiler = webpack(require('../webpack.config.js'));
const WebpackDevServer = require('webpack-dev-server');
const Nightwatch = require('nightwatch');
const browserstack = require('browserstack-local');
const server = new WebpackDevServer(compiler, {
contentBase: '../src/docs/',
stats: 'errors-only',
});
const local = new browserstack.Local();
Nightwatch.bs_local = local;
const browserStackConfig = {
key: process.env.BROWSERSTACK_ACCESS_KEY,
};
try {
process.mainModule.filename = './node_modules/.bin/nightwatch'
console.log('generate docs');
gulp.start('docs-build', () => {
console.log('start webpack server');
server.listen(8080, 'localhost', err => {
if (err) {
console.log('webpack server start error');