Skip to content

Commit

Permalink
chore(deps): upgrade deps
Browse files Browse the repository at this point in the history
BREAKING CHANGE

This PR updates the dev dependencies to use `@appium/support`, `@appium/gulp-plugins` and `@appium/eslint-config-appium`,
away from the unmaintained (non-scoped) packages.

Due to the requirements of these deps, it's unlikely that a dev environment older than Node.js v14 / npm v6 will work.  Thus, Node.js v8, v10, and v12 are officially dropped (though they may still work; this change should not affect the published, "production" library).

An organizational change was needed for the `@appium/gulp-plugins` upgrade; `index.js` moved to `lib/index.js`, and `index.js` is now a CJS file which re-exports `build/lib/index.js`.

In addition:

- modified some tests to ensure that child processes were being cleanly shut down
- modified the `bad_exit.sh` fixture for BSD `sleep` compat
  • Loading branch information
boneskull committed Aug 8, 2022
1 parent a4ae96c commit 253e6ea
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"extends": "appium"
"extends": "@appium/eslint-config-appium"
}
2 changes: 1 addition & 1 deletion .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

strategy:
matrix:
node-version: [10.x, 12.x, 14.x]
node-version: [14, 16, 18]

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const gulp = require('gulp');
const boilerplate = require('appium-gulp-plugins').boilerplate.use(gulp);
const boilerplate = require('@appium/gulp-plugins').boilerplate.use(gulp);

boilerplate({build: 'teen_process'});
12 changes: 1 addition & 11 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1 @@
// transpile:main
import * as cp from 'child_process';
import * as spIndex from './lib/subprocess';
import * as execIndex from './lib/exec';


const { spawn } = cp;
const { SubProcess } = spIndex;
const { exec } = execIndex;

export { exec, spawn, SubProcess };
module.exports = require('./build/lib/index.js');
11 changes: 11 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// transpile:main
import * as cp from 'child_process';
import * as spIndex from './subprocess';
import * as execIndex from './exec';


const { spawn } = cp;
const { SubProcess } = spIndex;
const { exec } = execIndex;

export { exec, spawn, SubProcess };
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@
"bugs": {
"url": "https://github.com/appium/node-teen_process/issues"
},
"engines": [
"node"
],
"main": "./build/index.js",
"engines": {
"node": ">=14",
"npm": ">=6"
},
"main": "./index.js",
"bin": {},
"directories": {
"lib": "lib"
},
"files": [
"index.js",
"lib",
"build/index.js",
"build/lib"
],
"dependencies": {
Expand All @@ -53,15 +53,15 @@
"precommit-test"
],
"devDependencies": {
"@appium/eslint-config-appium": "^6.0.2",
"@appium/gulp-plugins": "^7.0.2",
"@appium/support": "^2.59.2",
"@types/bluebird": "^3.5.36",
"@types/lodash": "^4.14.177",
"@types/node": "^17.0.0",
"@types/shell-quote": "^1.7.1",
"appium-gulp-plugins": "^5.4.1",
"appium-support": "^2.0.10",
"chai": "^4.1.2",
"chai-as-promised": "^7.1.1",
"eslint-config-appium": "^4.0.0",
"gulp": "^4.0.0",
"pre-commit": "^1.2.2"
}
Expand Down
4 changes: 2 additions & 2 deletions test/exec-specs.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// transpile:mocha

import path from 'path';
import { exec } from '..';
import { exec } from '../lib';
import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';
import { getFixture } from './helpers';
import { system } from 'appium-support';
import { system } from '@appium/support';
import _ from 'lodash';


Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/bad_exit.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

echo "foo"
sleep 1s
sleep 1
1>&2 echo "bar"
exit 1
2 changes: 1 addition & 1 deletion test/helpers.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import path from 'path';
import { system } from 'appium-support';
import { system } from '@appium/support';


function getFixture (fix) {
Expand Down
19 changes: 16 additions & 3 deletions test/subproc-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import B from 'bluebird';
import path from 'path';
import { exec, SubProcess } from '..';
import { exec, SubProcess } from '../lib';
import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';
import { getFixture } from './helpers';
import { system } from 'appium-support';
import { system } from '@appium/support';


const should = chai.should();
Expand Down Expand Up @@ -60,11 +60,23 @@ describe('SubProcess', function () {
lines.should.include('bad_exit.sh');
lines.should.contain('bigbuffer.js');
lines.should.contain('echo.sh');
await subproc.stop();
});

describe('#start', function () {
/** @type {SubProcess} */
let s;

afterEach(async function() {
if (s) {
try {
await s.stop();
} catch {}
}
});

it('should throw an error if command fails on startup', async function () {
let s = new SubProcess('blargimarg');
s = new SubProcess('blargimarg');
await s.start().should.eventually.be.rejected;
});
it('should have a default startDetector of waiting for output', async function () {
Expand Down Expand Up @@ -181,6 +193,7 @@ describe('SubProcess', function () {
reject(e);
}
});

await subproc.stop(stopSignal);
});
});
Expand Down

0 comments on commit 253e6ea

Please # to comment.