Skip to content

Commit

Permalink
chore: bump hoek (#1060)
Browse files Browse the repository at this point in the history
  • Loading branch information
Marsup authored Feb 11, 2023
1 parent 346dc02 commit f6c36ba
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 23 deletions.
5 changes: 2 additions & 3 deletions bin/_lab
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

'use strict';

const Fs = require('fs/promises');
const Util = require('util');
const Cpr = require('cpr');
const Rimraf = require('rimraf');


if (process.env.ROOT_SPAWN) {
Expand Down Expand Up @@ -46,6 +46,5 @@ main();

process.on('exit', async () => {

const rimraf = Util.promisify(Rimraf);
await rimraf('./test_runner');
await Fs.rm('./test_runner', { recursive: true, force: true });
});
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@babel/eslint-parser": "^7.16.0",
"@hapi/bossy": "^6.0.0",
"@hapi/eslint-plugin": "^6.0.0",
"@hapi/hoek": "^10.0.0",
"@hapi/hoek": "^11.0.2",
"diff": "^5.0.0",
"eslint": "8.x.x",
"find-rc": "4.x.x",
Expand All @@ -37,7 +37,7 @@
"will-call": "1.x.x"
},
"peerDependencies": {
"@hapi/eslint-plugin": "^5.1.0",
"@hapi/eslint-plugin": "^6.0.0",
"typescript": ">=3.6.5"
},
"peerDependenciesMeta": {
Expand All @@ -51,10 +51,9 @@
"@types/node": "^18.11.17",
"cpr": "3.x.x",
"lab-event-reporter": "1.x.x",
"rimraf": "3.x.x",
"semver": "7.x.x",
"typescript": "^4.5.4",
"tsconfig-paths": "^4.0.0"
"tsconfig-paths": "^4.0.0",
"typescript": "^4.5.4"
},
"bin": {
"lab": "./bin/lab"
Expand Down
28 changes: 13 additions & 15 deletions test/reporters.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
'use strict';

const Crypto = require('crypto');
const Fs = require('fs');
const Fs = require('fs/promises');
const Os = require('os');
const Path = require('path');
const Stream = require('stream');
const Util = require('util');

const Rimraf = require('rimraf');
const Code = require('@hapi/code');
const _Lab = require('../test_runner');
const Lab = require('../');
Expand Down Expand Up @@ -105,8 +103,8 @@ describe('Reporter', () => {
const filename = Path.join(Os.tmpdir(), [Date.now(), process.pid, Crypto.randomBytes(8).toString('hex')].join('-'));
const { code, output } = await Lab.report(script, { output: filename });
expect(code).to.equal(0);
expect(output).to.equal(Fs.readFileSync(filename).toString());
Fs.unlinkSync(filename);
expect(output).to.equal(await Fs.readFile(filename, 'utf8'));
await Fs.unlink(filename);
});

it('outputs to a file in a directory', async () => {
Expand All @@ -123,9 +121,9 @@ describe('Reporter', () => {
const { code, output } = await Lab.report(script, { output: filename });

expect(code).to.equal(0);
expect(output).to.equal(Fs.readFileSync(filename).toString());
expect(output).to.equal(await Fs.readFile(filename, 'utf8'));

await Util.promisify(Rimraf)(folder);
await Fs.rmdir(folder, { recursive: true });
});

it('outputs to a file with output is passed as an array and reporter is an array', async () => {
Expand All @@ -140,8 +138,8 @@ describe('Reporter', () => {
const { code, output } = await Lab.report(script, { reporter: ['console'], output: [filename] });

expect(code).to.equal(0);
expect(output).to.equal(Fs.readFileSync(filename).toString());
Fs.unlinkSync(filename);
expect(output).to.equal(await Fs.readFile(filename, 'utf8'));
await Fs.unlink(filename);
});

it('exits with error code when leak detected', async () => {
Expand Down Expand Up @@ -1990,9 +1988,9 @@ describe('Reporter', () => {

const { code, output } = await Lab.report(script, { reporter: ['lcov', 'console'], output: [filename, recorder], coverage: true });
expect(code).to.equal(0);
expect(output.lcov).to.equal(Fs.readFileSync(filename).toString());
expect(output.lcov).to.equal(await Fs.readFile(filename, 'utf8'));
expect(output.console).to.equal(recorder.content);
Fs.unlinkSync(filename);
await Fs.unlink(filename);
});

it('has correct exit code when test fails', async () => {
Expand Down Expand Up @@ -2034,11 +2032,11 @@ describe('Reporter', () => {

const { code, output } = await Lab.report(script, { reporter: ['lcov', 'html', 'console'], output: [filename, htmlRecorder, consoleRecorder], coverage: true, coveragePath: Path.join(__dirname, './coverage/basic.js') });
expect(code).to.equal(1);
expect(output.lcov).to.equal(Fs.readFileSync(filename).toString());
expect(output.lcov).to.equal(await Fs.readFile(filename, 'utf8'));
expect(output.html).to.equal(htmlRecorder.content);
expect(consoleRecorder.content).to.contain(internals.colors('Coverage: \u001b[32m100.00%'));

Fs.unlinkSync(filename);
await Fs.unlink(filename);
});

it('can run a single reporter', async () => {
Expand Down Expand Up @@ -2106,9 +2104,9 @@ describe('Reporter', () => {
const { code, output } = await Lab.report(script, { reporter: ['console', 'console'], output: [filename, recorder], coverage: true });

expect(code).to.equal(0);
expect(output.console).to.equal(Fs.readFileSync(filename).toString());
expect(output.console).to.equal(await Fs.readFile(filename, 'utf8'));
expect(output.console2).to.equal(recorder.content);
Fs.unlinkSync(filename);
await Fs.unlink(filename);
});
});

Expand Down

0 comments on commit f6c36ba

Please sign in to comment.