Skip to content

Commit

Permalink
build: replace multimatch dependency with glob ignore option
Browse files Browse the repository at this point in the history
The `multimatch` package was only used in the saucelabs test bundling
script to filter out spec files that should be ignored during saucelabs
testing. This functionality can be replace with `fast-glob` package's
`ignore` option. This removes the need for the `multimatch` package within
the repository.
  • Loading branch information
clydin committed Dec 9, 2023
1 parent e3a6bf9 commit d83f0d0
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 50 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@
"karma-sauce-launcher": "^4.3.6",
"madge": "^6.0.0",
"marked": "^10.0.0",
"multimatch": "^7.0.0",
"patch-package": "^7.0.0",
"prettier": "^3.0.0",
"sauce-connect": "https://saucelabs.com/downloads/sc-4.9.1-linux.tar.gz",
Expand Down
59 changes: 29 additions & 30 deletions tools/legacy-saucelabs/build-saucelabs-test-bundle.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* found in the LICENSE file at https://angular.io/license
*/

import multimatch from 'multimatch';
import esbuild from 'esbuild';
import fs from 'fs';
import glob from 'fast-glob';
Expand Down Expand Up @@ -72,35 +71,35 @@ async function main() {
* part of the legacy Saucelabs test job.
*/
async function findSpecFiles() {
const baseTestFiles = glob.sync('**/*_spec.js', {absolute: true, cwd: legacyOutputDir});

return multimatch(baseTestFiles, [
'**/*',
`!${legacyOutputDir}/_testing_init/**`,
`!${legacyOutputDir}/**/e2e_test/**`,
`!${legacyOutputDir}/**/*node_only_spec.js`,
`!${legacyOutputDir}/benchpress/**`,
`!${legacyOutputDir}/compiler-cli/**`,
`!${legacyOutputDir}/compiler-cli/src/ngtsc/**`,
`!${legacyOutputDir}/compiler-cli/test/compliance/**`,
`!${legacyOutputDir}/compiler-cli/test/ngtsc/**`,
`!${legacyOutputDir}/compiler/test/aot/**`,
`!${legacyOutputDir}/compiler/test/render3/**`,
`!${legacyOutputDir}/core/test/bundling/**`,
`!${legacyOutputDir}/core/schematics/test/**`,
`!${legacyOutputDir}/core/test/render3/ivy/**`,
`!${legacyOutputDir}/core/test/render3/jit/**`,
`!${legacyOutputDir}/core/test/render3/perf/**`,
`!${legacyOutputDir}/elements/schematics/**`,
`!${legacyOutputDir}/examples/**/e2e_test/*`,
`!${legacyOutputDir}/language-service/**`,
`!${legacyOutputDir}/platform-server/**`,
`!${legacyOutputDir}/localize/**/test/**`,
`!${legacyOutputDir}/localize/schematics/**`,
`!${legacyOutputDir}/router/**/test/**`,
`!${legacyOutputDir}/zone.js/**/test/**`,
`!${legacyOutputDir}/platform-browser/testing/e2e_util.js`,
]);
const baseDirPattern = glob.convertPathToPattern(legacyOutputDir);
const ignore = [
'/_testing_init/**',
'/**/e2e_test/**',
'/**/*node_only_spec.js',
'/benchpress/**',
'/compiler-cli/**',
'/compiler-cli/src/ngtsc/**',
'/compiler-cli/test/compliance/**',
'/compiler-cli/test/ngtsc/**',
'/compiler/test/aot/**',
'/compiler/test/render3/**',
'/core/test/bundling/**',
'/core/schematics/test/**',
'/core/test/render3/ivy/**',
'/core/test/render3/jit/**',
'/core/test/render3/perf/**',
'/elements/schematics/**',
'/examples/**/e2e_test/*',
'/language-service/**',
'/platform-server/**',
'/localize/**/test/**',
'/localize/schematics/**',
'/router/**/test/**',
'/zone.js/**/test/**',
'/platform-browser/testing/e2e_util.js',
].map((partial) => baseDirPattern + partial);

return glob.sync('**/*_spec.js', {absolute: true, cwd: legacyOutputDir, ignore});
}

/**
Expand Down
19 changes: 0 additions & 19 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4821,11 +4821,6 @@ arr-union@^3.1.0:
resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4"
integrity sha512-sKpyeERZ02v1FeCZT8lrfJq5u6goHCtpTAzPwJYe7c8SPFOboNjNg1vz2L4VTn9T4PQxEx13TbXLmYUcS6Ug7Q==

array-differ@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/array-differ/-/array-differ-4.0.0.tgz#aa3c891c653523290c880022f45b06a42051b026"
integrity sha512-Q6VPTLMsmXZ47ENG3V+wQyZS1ZxXMxFyYzA+Z/GMrJ6yIutAIEf9wTyroTzmGjNfox9/h3GdGBCVh43GVFx4Uw==

array-each@^1.0.0, array-each@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/array-each/-/array-each-1.0.1.tgz#a794af0c05ab1752846ee753a1f211a05ba0c44f"
Expand Down Expand Up @@ -4892,11 +4887,6 @@ array-union@^2.1.0:
resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d"
integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==

array-union@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/array-union/-/array-union-3.0.1.tgz#da52630d327f8b88cfbfb57728e2af5cd9b6b975"
integrity sha512-1OvF9IbWwaeiM9VhzYXVQacMibxpXOMYVNIvMtKRyX9SImBXpKcFr8XvFDeEslCyuH/t6KRt7HEO94AlP8Iatw==

array-uniq@^1.0.1:
version "1.0.3"
resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6"
Expand Down Expand Up @@ -11738,15 +11728,6 @@ multicast-dns@^7.2.5:
dns-packet "^5.2.2"
thunky "^1.0.2"

multimatch@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/multimatch/-/multimatch-7.0.0.tgz#d0a1bf144db9106b8d19e3cb8cabec1a8986c27f"
integrity sha512-SYU3HBAdF4psHEL/+jXDKHO95/m5P2RvboHT2Y0WtTttvJLP4H/2WS9WlQPFvF6C8d6SpLw8vjCnQOnVIVOSJQ==
dependencies:
array-differ "^4.0.0"
array-union "^3.0.1"
minimatch "^9.0.3"

mute-stdout@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/mute-stdout/-/mute-stdout-1.0.1.tgz#acb0300eb4de23a7ddeec014e3e96044b3472331"
Expand Down

0 comments on commit d83f0d0

Please sign in to comment.