Skip to content

Commit f993975

Browse files
crisbetoAndrewKushnir
authored andcommitted
build: skip simulated file system tests on Windows (angular#51738)
The code for detecting a Windows CI run from angular#51701 didn't work, because Bazel isolates the environment variables. These changes work around the issue by passing in a custom variable with the `--test_env` flag. PR Close angular#51738
1 parent 635318f commit f993975

2 files changed

Lines changed: 6 additions & 9 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,10 @@ jobs:
8989
- name: Install node modules
9090
run: yarn install --frozen-lockfile --network-timeout 100000
9191
- name: Test all windows CI targets
92-
run: bazel test --test_tag_filters="-browser:chromium-local" //packages/compiler-cli/...
92+
# Skip the simulated file system tests on Windows, because they tend to be flaky.
93+
# Note that we need to pass `NG_SKIP_SIMULATED_FS` using `--test_env`, because the
94+
# environment variable doesn't get picked up in Bazel when specified through `env` in GHA.
95+
run: bazel test --test_tag_filters="-browser:chromium-local" --test_env=NG_SKIP_SIMULATED_FS=true //packages/compiler-cli/...
9396

9497
test:
9598
runs-on: ubuntu-latest-4core

packages/compiler-cli/src/ngtsc/file_system/testing/src/test_helper.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88
/// <reference types="jasmine"/>
9-
import {platform} from 'os';
109
import ts from 'typescript';
1110

1211
import {absoluteFrom, setFileSystem} from '../../src/helpers';
@@ -39,13 +38,8 @@ const FS_WINDOWS = 'Windows';
3938
const FS_ALL = [FS_OS_X, FS_WINDOWS, FS_UNIX, FS_NATIVE];
4039

4140
function runInEachFileSystemFn(callback: (os: string) => void) {
42-
const isOnCi = !!(process.env['CI'] || process.env['CIRCLECI'] || process.env['GITHUB_ACTION']);
43-
44-
// At the time of writing, running the compiler tests on the CI on Windows is flaky and it
45-
// appears to be related to mocking out the file system. Since we're running the mocked file
46-
// system on the other platforms, we don't have to do so on Windows as well. This logic
47-
// disables the mocking to try and reduce the amount of flakes.
48-
if (isOnCi && platform() === 'win32') {
41+
// Some CI checks need to disable the simulated file system tests.
42+
if (process.env['NG_SKIP_SIMULATED_FS']) {
4943
runInFileSystem(FS_NATIVE, callback, false);
5044
} else {
5145
FS_ALL.forEach(os => runInFileSystem(os, callback, false));

0 commit comments

Comments
 (0)