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

Remove support for the AVA 3.0 provider protocol #2782

Merged
merged 1 commit into from
Jul 4, 2021
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
7 changes: 2 additions & 5 deletions lib/globs.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
normalizePattern,
normalizePatterns
} from './glob-helpers.cjs';
import providerManager from './provider-manager.js';

export {
classify,
Expand Down Expand Up @@ -69,10 +68,8 @@ export function normalizeGlobs({extensions, files: filePatterns, ignoredByWatche

ignoredByWatcherPatterns = ignoredByWatcherPatterns ? [...defaultIgnoredByWatcherPatterns, ...normalizePatterns(ignoredByWatcherPatterns)] : [...defaultIgnoredByWatcherPatterns];

for (const {level, main} of providers) {
if (level >= providerManager.levels.pathRewrites) {
({filePatterns, ignoredByWatcherPatterns} = main.updateGlobs({filePatterns, ignoredByWatcherPatterns}));
}
for (const {main} of providers) {
({filePatterns, ignoredByWatcherPatterns} = main.updateGlobs({filePatterns, ignoredByWatcherPatterns}));
}

return {extensions, filePatterns, ignoredByWatcherPatterns};
Expand Down
10 changes: 6 additions & 4 deletions lib/provider-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ import * as globs from './globs.js';
import pkg from './pkg.cjs';

const levels = {
ava3: 1,
pathRewrites: 2
// As the protocol changes, comparing levels by integer allows AVA to be
// compatible with different versions. Currently there is only one supported
// version, so this is effectively unused. The infrastructure is retained for
// future use.
levelIntegersAreCurrentlyUnused: 0
};

const levelsByProtocol = {
'ava-3': levels.ava3,
'ava-3.2': levels.pathRewrites
'ava-3.2': levels.levelIntegersAreCurrentlyUnused
};

async function load(providerModule, projectDir) {
Expand Down
3 changes: 1 addition & 2 deletions lib/watcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import flatten from 'lodash/flatten.js';

import {chalk} from './chalk.js';
import {applyTestFileFilter, classify, getChokidarIgnorePatterns} from './globs.js';
import providerManager from './provider-manager.js';

let chokidar = chokidar_;
export function _testOnlyReplaceChokidar(replacement) {
Expand Down Expand Up @@ -99,7 +98,7 @@ export default class Watcher {

const patternFilters = filter.map(({pattern}) => pattern);

this.providers = providers.filter(({level}) => level >= providerManager.levels.pathRewrites);
this.providers = providers;
this.run = (specificFiles = [], updateSnapshots = false) => {
const clearLogOnNextRun = this.clearLogOnNextRun && this.runVector > 0;
if (this.runVector > 0) {
Expand Down
Loading