Skip to content

Update dependencies & fix reporter tests #2618

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

Merged
merged 7 commits into from
Nov 30, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading