Skip to content

Commit

Permalink
Update dependencies & fix reporter tests
Browse files Browse the repository at this point in the history
* Fix reporter tests under Node.js 15

Fixes #2616.

* Update dev dependencies

* Update XO

* Update TypeScript

* Update dependencies

* Rebuild package lock

* Churn reporter logs
  • Loading branch information
novemberborn committed Nov 30, 2020
1 parent 09c5568 commit 73015e5
Show file tree
Hide file tree
Showing 42 changed files with 854 additions and 952 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ts-version: [~3.7.5, ~3.8, ~3.9, ~4.0]
ts-version: [~3.7.5, ~3.8, ~3.9, ~4.0, ~4.1]
steps:
- uses: actions/checkout@v1
with:
Expand Down
14 changes: 5 additions & 9 deletions lib/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,11 @@ class Api extends Emittery {
cacheDir = this._createCacheDir();
testFiles = await globs.findTests({cwd: this.options.projectDir, ...apiOptions.globs});
if (selectedFiles.length === 0) {
if (filter.length === 0) {
selectedFiles = testFiles;
} else {
selectedFiles = globs.applyTestFileFilter({
cwd: this.options.projectDir,
filter: filter.map(({pattern}) => pattern),
testFiles
});
}
selectedFiles = filter.length === 0 ? testFiles : globs.applyTestFileFilter({
cwd: this.options.projectDir,
filter: filter.map(({pattern}) => pattern),
testFiles
});
}
} catch (error) {
selectedFiles = [];
Expand Down
27 changes: 11 additions & 16 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -409,22 +409,17 @@ exports.run = async () => { // eslint-disable-line complexity
workerArgv: argv['--']
});

let reporter;
if (combined.tap && !combined.watch && debug === null) {
reporter = new TapReporter({
projectDir,
reportStream: process.stdout,
stdStream: process.stderr
});
} else {
reporter = new DefaultReporter({
projectDir,
reportStream: process.stdout,
stdStream: process.stderr,
watching: combined.watch,
verbose: debug !== null || combined.verbose || isCi || !process.stdout.isTTY
});
}
const reporter = combined.tap && !combined.watch && debug === null ? new TapReporter({
projectDir,
reportStream: process.stdout,
stdStream: process.stderr
}) : new DefaultReporter({
projectDir,
reportStream: process.stdout,
stdStream: process.stderr,
watching: combined.watch,
verbose: debug !== null || combined.verbose || isCi || !process.stdout.isTTY
});

api.on('run', plan => {
reporter.startRun(plan);
Expand Down
2 changes: 1 addition & 1 deletion lib/concordance-options.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
const util = require('util');
const util = require('util'); // eslint-disable-line unicorn/import-style
const ansiStyles = require('ansi-styles');
const stripAnsi = require('strip-ansi');
const cloneDeepWith = require('lodash/cloneDeepWith');
Expand Down
6 changes: 1 addition & 5 deletions lib/globs.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,7 @@ function normalizeGlobs({extensions, files: filePatterns, ignoredByWatcher: igno
filePatterns = defaultTestPatterns;
}

if (ignoredByWatcherPatterns) {
ignoredByWatcherPatterns = [...defaultIgnoredByWatcherPatterns, ...normalizePatterns(ignoredByWatcherPatterns)];
} else {
ignoredByWatcherPatterns = [...defaultIgnoredByWatcherPatterns];
}
ignoredByWatcherPatterns = ignoredByWatcherPatterns ? [...defaultIgnoredByWatcherPatterns, ...normalizePatterns(ignoredByWatcherPatterns)] : [...defaultIgnoredByWatcherPatterns];

for (const {level, main} of providers) {
if (level >= providerManager.levels.pathRewrites) {
Expand Down
2 changes: 1 addition & 1 deletion lib/plugin-support/shared-worker-loader.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const {EventEmitter, on} = require('events');
const v8 = require('v8');
const {workerData, parentPort} = require('worker_threads'); // eslint-disable-line node/no-unsupported-features/node-builtins
const {workerData, parentPort} = require('worker_threads');
const pkg = require('../../package.json');

// Used to forward messages received over the `parentPort`. Every subscription
Expand Down
2 changes: 1 addition & 1 deletion lib/plugin-support/shared-workers.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const serializeError = require('../serialize-error');

let Worker;
try {
({Worker} = require('worker_threads')); // eslint-disable-line node/no-unsupported-features/node-builtins
({Worker} = require('worker_threads'));
} catch {}

const LOADER = require.resolve('./shared-worker-loader');
Expand Down
13 changes: 3 additions & 10 deletions lib/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,11 +298,8 @@ class Test {
};
}

if (this.metadata.inline) {
throw new Error('`t.end()` is not supported inside `t.try()`');
} else {
throw new Error('`t.end()` is not supported in this context. To use `t.end()` as a callback, you must use "callback mode" via `test.cb(testName, fn)`');
}
const error_ = this.metadata.inline ? new Error('`t.end()` is not supported inside `t.try()`') : new Error('`t.end()` is not supported in this context. To use `t.end()` as a callback, you must use "callback mode" via `test.cb(testName, fn)`');
throw error_;
}

endCallback(error, savedError) {
Expand Down Expand Up @@ -736,11 +733,7 @@ class Test {
if (this.metadata.failing) {
passed = !passed;

if (passed) {
error = null;
} else {
error = new Error('Test was expected to fail, but succeeded, you should stop marking the test as failing');
}
error = passed ? null : new Error('Test was expected to fail, but succeeded, you should stop marking the test as failing');
}

return {
Expand Down

0 comments on commit 73015e5

Please sign in to comment.