@@ -23,6 +23,10 @@ import { supported, next, nextNext, deprecated } from '../../lib/enterprise-serv
2323import { getLiquidConditionals } from '../../script/helpers/get-liquid-conditionals.js'
2424import allowedVersionOperators from '../../lib/liquid-tags/ifversion-supported-operators.js'
2525import semver from 'semver'
26+ import { jest } from '@jest/globals'
27+ import { getDiffFiles } from '../utils.js'
28+
29+ jest . useFakeTimers ( 'legacy' )
2630
2731const __dirname = path . dirname ( fileURLToPath ( import . meta. url ) )
2832const enterpriseServerVersions = Object . keys ( allVersions ) . filter ( ( v ) =>
@@ -357,28 +361,18 @@ function getContent(content) {
357361 return null
358362}
359363
360- // Filter out entries from an array like this:
361- //
362- // [
363- // [relativePath, absolutePath],
364- // ...
365- // so it's only the files mentioned in the DIFF_FILES environment
366- // variable, but only if it's set and present.
367-
368- // Setting an environment varible called `DIFF_FILES` is optional.
369- // But if and only if it's set, we will respect it.
370- // And if it set, turn it into a cleaned up Set so it's made available
371- // every time we use it.
372- if ( process . env . DIFF_FILES ) {
373- // Parse and turn that environment variable string into a set.
364+ const diffFiles = getDiffFiles ( )
365+
366+ // If present, and not empty, leverage it because in most cases it's empty.
367+ if ( diffFiles . length > 0 ) {
374368 // It's faster to do this once and then re-use over and over in the
375369 // .filter() later on.
376370 const only = new Set (
377371 // If the environment variable encodes all the names
378372 // with quotation marks, strip them.
379373 // E.g. Turn `"foo" "bar"` into ['foo', 'bar']
380374 // Note, this assumes no possible file contains a space.
381- process . env . DIFF_FILES . split ( / \s + / g ) . map ( ( name ) => {
375+ diffFiles . map ( ( name ) => {
382376 if ( / ^ [ ' " ] / . test ( name ) && / [ ' " ] $ / . test ( name ) ) {
383377 return name . slice ( 1 , - 1 )
384378 }
0 commit comments