diff --git a/.circleci/config/base.yml b/.circleci/config/base.yml index 185ae9b8e72c..b2cce0fb7934 100644 --- a/.circleci/config/base.yml +++ b/.circleci/config/base.yml @@ -452,7 +452,7 @@ step-get-more-space-on-mac: &step-get-more-space-on-mac fi background: true -# On macOS delete all .git directories under src/ expect for +# On macOS delete all .git directories under src/ except for # third_party/angle/ and third_party/dawn/ because of build time generation of files # gen/angle/commit.h depends on third_party/angle/.git/HEAD # https://chromium-review.googlesource.com/c/angle/angle/+/2074924 @@ -1492,7 +1492,7 @@ commands: export LLVM_SYMBOLIZER_PATH=$PWD/third_party/llvm-build/Release+Asserts/bin/llvm-symbolizer export MOCHA_TIMEOUT=180000 echo "Piping output to ASAN_SYMBOLIZE ($ASAN_SYMBOLIZE)" - (cd electron && node script/yarn test --runners=main --trace-uncaught --enable-logging --files $(circleci tests glob spec/*-spec.ts | circleci tests split --split-by=timings)) 2>&1 | $ASAN_SYMBOLIZE + (cd electron && (circleci tests glob "spec/*-spec.ts" | circleci tests run --command="xargs node script/yarn test --runners=main --trace-uncaught --enable-logging --files" --split-by=timings 2>&1)) | $ASAN_SYMBOLIZE else if [ "$TARGET_ARCH" == "arm" ] || [ "$TARGET_ARCH" == "arm64" ]; then export ELECTRON_SKIP_NATIVE_MODULE_TESTS=true @@ -1501,18 +1501,9 @@ commands: if [ "$TARGET_ARCH" == "ia32" ]; then npm_config_arch=x64 node electron/node_modules/dugite/script/download-git.js fi - (cd electron && node script/yarn test --runners=main --trace-uncaught --enable-logging --files $(circleci tests glob spec/*-spec.ts | circleci tests split --split-by=timings)) + (cd electron && (circleci tests glob "spec/*-spec.ts" | circleci tests run --command="xargs node script/yarn test --runners=main --trace-uncaught --enable-logging --files" --split-by=timings)) fi fi - - run: - name: Check test results existence - command: | - cd src - - # Check if test results exist and are not empty. - if [ ! -s "junit/test-results-main.xml" ]; then - exit 1 - fi - store_test_results: path: src/junit diff --git a/spec/index.js b/spec/index.js index 8e9b2aa155fa..d2b94f2e50cf 100644 --- a/spec/index.js +++ b/spec/index.js @@ -107,6 +107,11 @@ app.whenReady().then(async () => { if (argv.grep) mocha.grep(argv.grep); if (argv.invert) mocha.invert(); + const baseElectronDir = path.resolve(__dirname, '..'); + const validTestPaths = argv.files && argv.files.map(file => + path.isAbsolute(file) + ? path.relative(baseElectronDir, file) + : file); const filter = (file) => { if (!/-spec\.[tj]s$/.test(file)) { return false; @@ -121,8 +126,7 @@ app.whenReady().then(async () => { return false; } - const baseElectronDir = path.resolve(__dirname, '..'); - if (argv.files && !argv.files.includes(path.relative(baseElectronDir, file))) { + if (validTestPaths && !validTestPaths.includes(path.relative(baseElectronDir, file))) { return false; } @@ -135,6 +139,12 @@ app.whenReady().then(async () => { mocha.addFile(file); }); + if (validTestPaths && validTestPaths.length > 0 && testFiles.length === 0) { + console.error('Test files were provided, but they did not match any searched files'); + console.error('provided file paths (relative to electron/):', validTestPaths); + process.exit(1); + } + const cb = () => { // Ensure the callback is called after runner is defined process.nextTick(() => {