Skip to content

Commit a6ecc25

Browse files
authored
Update deps; Bump version (v1.13.0) (#117)
* Update deps; Bump version (v1.13.0) * Use const
1 parent 0caddd3 commit a6ecc25

9 files changed

Lines changed: 54 additions & 61 deletions

File tree

.eslintrc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{
2-
"parser": "babel-eslint",
2+
"parserOptions": {
3+
"ecmaVersion": 2018,
4+
"sourceType": "module"
5+
},
36
"extends": "eslint:recommended",
47
"rules": {
58
"no-alert": "error",

Gulpfile.js

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1-
var path = require('path');
2-
var gulp = require('gulp');
3-
var babel = require('gulp-babel');
4-
var del = require('del');
5-
var execa = require('execa');
1+
const path = require('path');
2+
const { spawn } = require('child_process');
3+
const gulp = require('gulp');
4+
const eslint = require('gulp-eslint');
5+
const del = require('del');
66

77

8-
var PACKAGE_PARENT_DIR = path.join(__dirname, '../');
9-
var PACKAGE_SEARCH_PATH = (process.env.NODE_PATH ? process.env.NODE_PATH + path.delimiter : '') + PACKAGE_PARENT_DIR;
8+
const PACKAGE_PARENT_DIR = path.join(__dirname, '../');
9+
const PACKAGE_SEARCH_PATH = (process.env.NODE_PATH ? process.env.NODE_PATH + path.delimiter : '') + PACKAGE_PARENT_DIR;
1010

1111

1212
function clean () {
1313
return del('lib');
1414
}
1515

1616
function lint () {
17-
var eslint = require('gulp-eslint');
1817

1918
return gulp
2019
.src([
@@ -28,10 +27,7 @@ function lint () {
2827
}
2928

3029
function build () {
31-
return gulp
32-
.src('src/**/*.js')
33-
.pipe(babel())
34-
.pipe(gulp.dest('lib'));
30+
return spawn('npx tsc -p src/tsconfig.json', { stdio: 'inherit', shell: true });
3531
}
3632

3733
function ensureAuthCredentials () {
@@ -44,9 +40,7 @@ function ensureAuthCredentials () {
4440
function testMocha () {
4541
ensureAuthCredentials();
4642

47-
var mochaCmd = path.join(__dirname, 'node_modules/.bin/mocha');
48-
49-
var mochaOpts = [
43+
const mochaOpts = [
5044
'--ui', 'bdd',
5145
'--reporter', 'spec',
5246
'--timeout', typeof v8debug === 'undefined' ? 2000 : Infinity,
@@ -57,7 +51,7 @@ function testMocha () {
5751
// to find the plugin. So this function starts mocha with proper NODE_PATH.
5852
process.env.NODE_PATH = PACKAGE_SEARCH_PATH;
5953

60-
return execa(mochaCmd, mochaOpts, { stdio: 'inherit' });
54+
return spawn(`npx mocha ${mochaOpts.join(' ')}`, { stdio: 'inherit', shell: true });
6155
}
6256

6357
function testMochaRest () {
@@ -75,9 +69,7 @@ function testMochaAutomate () {
7569
function testTestcafe (browsers) {
7670
ensureAuthCredentials();
7771

78-
var testCafeCmd = path.join(__dirname, 'node_modules/.bin/testcafe');
79-
80-
var testCafeOpts = [
72+
const testCafeOpts = [
8173
browsers,
8274
'test/testcafe/**/*test.js',
8375
'-s', '.screenshots'
@@ -87,7 +79,7 @@ function testTestcafe (browsers) {
8779
// to find the plugin. So this function starts testcafe with proper NODE_PATH.
8880
process.env.NODE_PATH = PACKAGE_SEARCH_PATH;
8981

90-
return execa(testCafeCmd, testCafeOpts, { stdio: 'inherit' });
82+
return spawn(`npx testcafe ${testCafeOpts.join(' ')}`, { stdio: 'inherit', shell: true });
9183
}
9284

9385
function testTestcafeRest () {
@@ -105,6 +97,10 @@ function testTestcafeAutomate () {
10597
exports.clean = clean;
10698
exports.lint = lint;
10799
exports.build = gulp.parallel(gulp.series(clean, build), lint);
108-
exports.test = gulp.series(exports.build, testMochaRest, testMochaAutomate, testTestcafeAutomate);
109-
exports.testTestcafeRest = gulp.series(exports.build, testTestcafeRest);
100+
101+
exports.testMochaRest = testMochaRest;
102+
exports.testMochaAutomate = testMochaAutomate;
103+
exports.testTestcafeRest = gulp.series(exports.build, testTestcafeRest);
110104
exports.testTestcafeAutomate = gulp.series(exports.build, testTestcafeAutomate);
105+
106+
exports.test = gulp.series(exports.build, testMochaRest, testMochaAutomate, testTestcafeRest, testTestcafeAutomate);

package.json

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "testcafe-browser-provider-browserstack",
3-
"version": "1.13.0-alpha.1",
3+
"version": "1.13.0",
44
"description": "browserstack TestCafe browser provider plugin.",
55
"repository": "https://github.com/DevExpress/testcafe-browser-provider-browserstack",
66
"engines": {
@@ -30,12 +30,11 @@
3030
],
3131
"license": "MIT",
3232
"dependencies": {
33-
"babel-runtime": "^6.11.6",
3433
"browserstack-local": "^1.3.6",
3534
"dedent": "^0.7.0",
3635
"desired-capabilities": "^0.1.0",
3736
"firefox-profile": "^1.3.1",
38-
"jimp": "^0.9.6",
37+
"jimp": "^0.10.3",
3938
"lodash": "^4.17.15",
4039
"mime-db": "^1.43.0",
4140
"os-family": "^1.0.0",
@@ -45,18 +44,11 @@
4544
"tmp": "0.0.31"
4645
},
4746
"devDependencies": {
48-
"babel-eslint": "^6.1.2",
49-
"babel-plugin-add-module-exports": "^0.2.1",
50-
"babel-plugin-transform-runtime": "^6.12.0",
51-
"babel-preset-es2015": "^6.13.2",
52-
"babel-preset-es2015-loose": "^7.0.0",
53-
"babel-preset-stage-3": "^6.11.0",
5447
"chai": "^3.5.0",
5548
"del": "^2.2.2",
56-
"execa": "^0.9.0",
49+
"eslint-plugin-no-only-tests": "^2.4.0",
5750
"gulp": "^4.0.0",
58-
"gulp-babel": "^6.1.2",
59-
"gulp-eslint": "^3.0.1",
51+
"gulp-eslint": "^6.0.0",
6052
"mocha": "^7.1.1",
6153
"publish-please": "^5.4.3",
6254
"testcafe": "latest"

src/.babelrc

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/backends/automate.js

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { inspect } from 'util';
2-
import Promise from 'pinkie';
32
import jimp from 'jimp';
43
import BaseBackend from './base';
54
import requestApiBase from '../utils/request-api';
@@ -177,15 +176,12 @@ export default class AutomateBackend extends BaseBackend {
177176
}
178177

179178
async takeScreenshot (id, screenshotPath) {
180-
return new Promise(async (resolve, reject) => {
181-
var base64Data = await requestApi(BROWSERSTACK_API_PATHS.screenshot(this.sessions[id].sessionId));
182-
var buffer = Buffer.from(base64Data.value, 'base64');
183-
184-
jimp
185-
.read(buffer)
186-
.then(image => image.write(screenshotPath, resolve))
187-
.catch(reject);
188-
});
179+
var base64Data = await requestApi(BROWSERSTACK_API_PATHS.screenshot(this.sessions[id].sessionId));
180+
var buffer = Buffer.from(base64Data.value, 'base64');
181+
182+
const image = await jimp.read(buffer);
183+
184+
await image.write(screenshotPath);
189185
}
190186

191187
async resizeWindow (id, width, height, currentWidth, currentHeight) {

src/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { parse as parseUrl } from 'url';
22
import Promise from 'pinkie';
33
import { promisify } from 'util';
44
import parseCapabilities from 'desired-capabilities';
5-
import { filter } from 'lodash';
5+
import { pickBy } from 'lodash';
66
import BrowserstackConnector from './connector';
77
import JSTestingBackend from './backends/js-testing';
88
import AutomateBackend from './backends/automate';
@@ -25,7 +25,7 @@ function getMimeTypes () {
2525
}).join(',');
2626
}
2727

28-
export default {
28+
module.exports = {
2929
// Multiple browsers support
3030
isMultiBrowser: true,
3131

@@ -146,7 +146,7 @@ export default {
146146
},
147147

148148
_getAdditionalCapabilities () {
149-
const capabilitiesFromEnvironment = filter(this._getCapabilitiesFromEnvironment(), value => value !== void 0);
149+
const capabilitiesFromEnvironment = pickBy(this._getCapabilitiesFromEnvironment(), value => value !== void 0);
150150

151151
return { ...this._getCapabilitiesFromConfig(), ...capabilitiesFromEnvironment };
152152
},

src/tsconfig.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"compilerOptions": {
3+
"outDir": "../lib",
4+
"target": "es2017",
5+
"module": "commonjs",
6+
"strict": true,
7+
"esModuleInterop": true,
8+
"allowJs": true,
9+
"checkJs": false,
10+
"inlineSourceMap": true,
11+
"inlineSources": true
12+
}
13+
}

test/.eslintrc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
{
2+
"plugins": [
3+
"no-only-tests"
4+
],
25
"rules": {
3-
"no-unused-expressions": 0
6+
"no-unused-expressions": "off",
7+
"no-only-tests/no-only-tests": "error"
48
},
59
"env": {
610
"mocha": true,

test/mocha/browserstack-capabilities-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ describe('Browserstack capabilities', function () {
4343
});
4444
});
4545

46-
it.only('Should read aditional capabilities from a config file', () => {
46+
it('Should read aditional capabilities from a config file', () => {
4747
process.env.BROWSERSTACK_CAPABILITIES_CONFIG_PATH = require.resolve('./data/capabilities-config.json');
4848

4949
const capabilities = browserStackProvider._getAdditionalCapabilities();

0 commit comments

Comments
 (0)