Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: non-breaking updates #782

Merged
merged 4 commits into from Mar 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 2 additions & 3 deletions lib/git-clone.js
@@ -1,10 +1,9 @@
'use strict';

const path = require('path');
const { promisify } = require('util');
const { mkdir } = require('fs').promises;

const execa = require('execa');
const mkdirp = promisify(require('mkdirp'));

function getExecGit(path) {
return function execGit(args) {
Expand All @@ -20,7 +19,7 @@ async function gitClone(context) {
const gitRef = context.module.ref;

const modulePath = path.join(context.path, context.module.name);
await mkdirp(modulePath);
await mkdir(modulePath, { recursive: true });
const execGit = getExecGit(modulePath);

await execGit(['init']);
Expand Down
6 changes: 3 additions & 3 deletions lib/temp-directory.js
Expand Up @@ -2,8 +2,8 @@

const { promisify } = require('util');
let path = require('path'); // Mocked in tests
const { mkdir } = require('fs').promises;

const mkdirp = promisify(require('mkdirp'));
const osenv = require('osenv');
const rimraf = promisify(require('rimraf'));
const uuid = require('uuid');
Expand All @@ -24,8 +24,8 @@ async function create(context) {
context.homeDir = path.join(context.path, 'home');
context.npmConfigTmp = path.join(context.path, 'npm_config_tmp');

await mkdirp(context.homeDir);
await mkdirp(context.npmConfigTmp);
await mkdir(context.homeDir, { recursive: true });
await mkdir(context.npmConfigTmp, { recursive: true });
}

async function remove(context) {
Expand Down
4 changes: 2 additions & 2 deletions lib/unpack.js
Expand Up @@ -4,8 +4,8 @@ const fs = require('fs');
const path = require('path');
const { promisify } = require('util');
const zlib = require('zlib');
const { mkdir } = fs.promises;

const mkdirp = promisify(require('mkdirp'));
const stream = require('readable-stream');
const tar = require('tar');

Expand All @@ -19,7 +19,7 @@ async function unpack(context) {
throw new Error('Nothing to unpack... Ending');
}
const extractPath = path.join(context.path, context.module.name);
await mkdirp(extractPath);
await mkdir(extractPath, { recursive: true });
context.emit(
'data',
'silly',
Expand Down
21 changes: 10 additions & 11 deletions package.json
Expand Up @@ -33,41 +33,40 @@
"dependencies": {
"async": "^3.1.0",
"bl": "^4.0.0",
"chalk": "^2.4.2",
"chalk": "^3.0.0",
"columnify": "^1.5.4",
"execa": "^3.2.0",
"execa": "^4.0.0",
"lodash": "^4.17.15",
"make-promises-safe": "^5.1.0",
"mkdirp": "^0.5.1",
"normalize-git-url": "^3.0.2",
"npm-package-arg": "^6.1.1",
"npm-package-arg": "^8.0.0",
"npm-which": "^3.0.1",
"osenv": "^0.1.5",
"read-package-json": "^2.1.0",
"readable-stream": "^3.4.0",
"request": "^2.88.0",
"rimraf": "^3.0.0",
"root-check": "^1.0.0",
"semver": "^6.3.0",
"strip-ansi": "^5.2.0",
"semver": "^7.1.1",
"strip-ansi": "^6.0.0",
"supports-color": "^7.1.0",
"tar": "^5.0.5",
"tar": "^6.0.0",
"uid-number": "0.0.6",
"update-notifier": "^3.0.1",
"uuid": "^3.3.3",
"uuid": "^7.0.2",
"which": "^2.0.1",
"winston": "^3.2.1",
"xml-sanitizer": "^1.1.6",
"xmlbuilder": "^13.0.2",
"yargs": "^14.2.0",
"xmlbuilder": "^15.0.0",
"yargs": "^15.1.0",
"yarn": "^1.19.1"
},
"devDependencies": {
"eslint": "^6.5.1",
"eslint-config-prettier": "^6.4.0",
"eslint-plugin-prettier": "^3.1.1",
"fs-extra": "^8.1.0",
"prettier": "1.18.2",
"prettier": "^1.19.1",
"proxyquire": "^2.1.3",
"rewire": "^4.0.1",
"string-to-stream": "^3.0.1",
Expand Down
8 changes: 4 additions & 4 deletions test/fixtures/parsed-junit.json
Expand Up @@ -9,14 +9,14 @@
"name": "iPass-v4.2.2",
"time": "0.05"
},
"system-out": ["\n \n "]
"system-out": [""]
},
{
"$": {
"name": "iFlakyFail-v3.3.3",
"time": "0.05"
},
"system-out": ["\n Thanks for testing!\n "],
"system-out": [" Thanks for testing!"],
"skipped": [""],
"failure": [
{
Expand All @@ -32,7 +32,7 @@
"name": "iFail-v3.0.1",
"time": "0.05"
},
"system-out": ["\n Thanks for testing!\n "],
"system-out": [" Thanks for testing!"],
"failure": [
{
"_": "[object Object] ",
Expand All @@ -47,7 +47,7 @@
"name": "iSkipped",
"time": "NaN"
},
"system-out": ["\n \n "],
"system-out": [""],
"skipped": [""]
}
]
Expand Down
16 changes: 4 additions & 12 deletions test/fixtures/test-out-xml-failing.txt
@@ -1,26 +1,18 @@
<testsuite name="citgm">
<testcase name="iPass-v4.2.2" time="0.05">
<system-out>
<![CDATA[]]>
</system-out>
<system-out/>
</testcase>
<testcase name="iFlakyFail-v3.3.3" time="0.05">
<system-out>
<![CDATA[ Thanks for testing!]]>
</system-out>
<system-out><![CDATA[ Thanks for testing!]]></system-out>
<skipped/>
<failure message="module test suite failed">[object Object] </failure>
</testcase>
<testcase name="iFail-v3.0.1" time="0.05">
<system-out>
<![CDATA[ Thanks for testing!]]>
</system-out>
<system-out><![CDATA[ Thanks for testing!]]></system-out>
<failure message="module test suite failed">[object Object] </failure>
</testcase>
<testcase name="iSkipped" time="NaN">
<system-out>
<![CDATA[]]>
</system-out>
<system-out/>
<skipped/>
</testcase>
</testsuite>
8 changes: 2 additions & 6 deletions test/fixtures/test-out-xml-passing-append.txt
@@ -1,13 +1,9 @@
This is a test!
<testsuite name="citgm">
<testcase name="iPass-v4.2.2" time="0.05">
<system-out>
<![CDATA[]]>
</system-out>
<system-out/>
</testcase>
<testcase name="iFlakyPass-v3.0.1" time="0.05">
<system-out>
<![CDATA[ Thanks for testing!]]>
</system-out>
<system-out><![CDATA[ Thanks for testing!]]></system-out>
</testcase>
</testsuite>
8 changes: 2 additions & 6 deletions test/fixtures/test-out-xml-passing.txt
@@ -1,12 +1,8 @@
<testsuite name="citgm">
<testcase name="iPass-v4.2.2" time="0.05">
<system-out>
<![CDATA[]]>
</system-out>
<system-out/>
</testcase>
<testcase name="iFlakyPass-v3.0.1" time="0.05">
<system-out>
<![CDATA[ Thanks for testing!]]>
</system-out>
<system-out><![CDATA[ Thanks for testing!]]></system-out>
</testcase>
</testsuite>
4 changes: 2 additions & 2 deletions test/npm/test-npm-install.js
Expand Up @@ -2,11 +2,11 @@

const os = require('os');
const path = require('path');
const { mkdir } = require('fs').promises;
const { promisify } = require('util');

const { copy } = require('fs-extra');
const { test } = require('tap');
const mkdirp = promisify(require('mkdirp'));
const rimraf = promisify(require('rimraf'));

const packageManager = require('../../lib/package-manager');
Expand All @@ -26,7 +26,7 @@ let packageManagers;

test('npm-install: setup', async () => {
packageManagers = await packageManager.getPackageManagers();
await mkdirp(sandbox);
await mkdir(sandbox, { recursive: true });
await Promise.all([
copy(moduleFixtures, moduleTemp),
copy(extraParamFixtures, extraParamTemp),
Expand Down
4 changes: 2 additions & 2 deletions test/npm/test-npm-test.js
Expand Up @@ -2,11 +2,11 @@

const os = require('os');
const path = require('path');
const { mkdir } = require('fs').promises;
const { promisify } = require('util');

const { copy, existsSync } = require('fs-extra');
const { test } = require('tap');
const mkdirp = promisify(require('mkdirp'));
const rimraf = promisify(require('rimraf'));

const makeContext = require('../helpers/make-context');
Expand Down Expand Up @@ -35,7 +35,7 @@ let packageManagers;

test('npm-test: setup', async () => {
packageManagers = await packageManager.getPackageManagers();
await mkdirp(sandbox);
await mkdir(sandbox, { recursive: true });
await Promise.all([
copy(passFixtures, passTemp),
copy(failFixtures, failTemp),
Expand Down
4 changes: 2 additions & 2 deletions test/reporter/test-reporter-junit.js
@@ -1,12 +1,12 @@
'use strict';

const fs = require('fs');
const { mkdir } = fs.promises;
const path = require('path');
const os = require('os');
const { promisify } = require('util');

const { test } = require('tap');
const mkdirp = promisify(require('mkdirp'));
const rimraf = promisify(require('rimraf'));
const _ = require('lodash');
const parseString = promisify(require('xml2js').parseString);
Expand Down Expand Up @@ -52,7 +52,7 @@ const badOutput = fs.readFileSync(badOutputPath, 'utf-8');
const badOutputToo = fs.readFileSync(badOutputTooPath, 'utf-8');

test('reporter.junit(): setup', async () => {
await mkdirp(sandbox);
await mkdir(sandbox, { recursive: true });
});

test('reporter.junit(): passing', (t) => {
Expand Down
4 changes: 2 additions & 2 deletions test/reporter/test-reporter-tap.js
Expand Up @@ -2,12 +2,12 @@
'use strict';

const fs = require('fs');
const { mkdir } = fs.promises;
const path = require('path');
const os = require('os');
const { promisify } = require('util');

const { test } = require('tap');
const mkdirp = promisify(require('mkdirp'));
const rimraf = promisify(require('rimraf'));
const Parser = require('tap-parser');
const str = require('string-to-stream');
Expand Down Expand Up @@ -44,7 +44,7 @@ const failingExpectedPath = path.join(fixturesPath, 'test-out-tap-failing.txt');
const failingExpected = fs.readFileSync(failingExpectedPath, 'utf-8');

test('reporter.tap(): setup', async () => {
await mkdirp(sandbox);
await mkdir(sandbox, { recursive: true });
});

test('reporter.tap(): passing', (t) => {
Expand Down
4 changes: 2 additions & 2 deletions test/test-grab-project.js
Expand Up @@ -5,11 +5,11 @@

const os = require('os');
const path = require('path');
const { mkdir } = require('fs').promises;
const { promisify } = require('util');

const { stat } = require('fs-extra');
const { test } = require('tap');
const mkdirp = promisify(require('mkdirp'));
const rimraf = promisify(require('rimraf'));

const grabProject = require('../lib/grab-project');
Expand All @@ -18,7 +18,7 @@ const sandbox = path.join(os.tmpdir(), `citgm-${Date.now()}`);
const fixtures = path.join(__dirname, 'fixtures');

test('grab-project: setup', async () => {
await mkdirp(sandbox);
await mkdir(sandbox, { recursive: true });
});

test('grab-project: npm module', async (t) => {
Expand Down
5 changes: 1 addition & 4 deletions test/test-temp-directory.js
Expand Up @@ -74,10 +74,7 @@ test('tempDirectory.create: bad path', skipIfWin32, async (t) => {
try {
await tempDirectory.create(badContext);
} catch (e) {
t.ok(
e.message.includes(nullDevice),
`the message should include the path ${nullDevice}`
);
t.ok(e.message.includes('EEXIST'), `the message should include EEXIST`);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While being on this, we might also switch to using assert.rejects(). Otherwise we do not verify that the catch clause is actually reached.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to push to this PR, although if you do please use the built in tap asserts

https://node-tap.org/docs/api/asserts/#trejectspromise--fn-expectederror-message-extra

TBH the tests across the board could use a refactor so I'd prefer to save fixing this for a larger refactoring

t.ok(badContext.path, 'badContext should have a path');
tempDirectory.__set__('path', path);
}
Expand Down
4 changes: 2 additions & 2 deletions test/yarn/test-yarn-install.js
Expand Up @@ -2,11 +2,11 @@

const os = require('os');
const path = require('path');
const { mkdir } = require('fs').promises;
const { promisify } = require('util');

const { copy } = require('fs-extra');
const { test } = require('tap');
const mkdirp = promisify(require('mkdirp'));
const rimraf = promisify(require('rimraf'));

const packageManager = require('../../lib/package-manager');
Expand All @@ -26,7 +26,7 @@ let packageManagers;

test('yarn-install: setup', async () => {
packageManagers = await packageManager.getPackageManagers();
await mkdirp(sandbox);
await mkdir(sandbox, { recursive: true });
await Promise.all([
copy(moduleFixtures, moduleTemp),
copy(extraParamFixtures, extraParamTemp),
Expand Down
4 changes: 2 additions & 2 deletions test/yarn/test-yarn-test.js
Expand Up @@ -2,11 +2,11 @@

const os = require('os');
const path = require('path');
const { mkdir } = require('fs').promises;
const { promisify } = require('util');

const { copy, existsSync } = require('fs-extra');
const { test } = require('tap');
const mkdirp = promisify(require('mkdirp'));
const rimraf = promisify(require('rimraf'));

const makeContext = require('../helpers/make-context');
Expand Down Expand Up @@ -35,7 +35,7 @@ let packageManagers;

test('yarn-test: setup', async () => {
packageManagers = await packageManager.getPackageManagers();
await mkdirp(sandbox);
await mkdir(sandbox, { recursive: true });
await Promise.all([
copy(passFixtures, passTemp),
copy(failFixtures, failTemp),
Expand Down