Skip to content

Commit

Permalink
Remove support for the AVA 3.0 provider protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
novemberborn committed Jul 4, 2021
1 parent 4d3e220 commit aba4a44
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
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

0 comments on commit aba4a44

Please sign in to comment.