Repository: oppia/oppia

Issue:
Frontend tests are failing because of long timeout on CircleCI
**Description:**
Frontend tests are failing because of too long timeout on CircleCI and pass the test on restart. This has happened multiple times as of now.

(Add :+1: to this comment if you see this happens for your/any PR!)

**Log:**

```
#!/bin/bash -eo pipefail
python -m scripts.run_frontend_tests --run_minified_tests --skip_install
Checking if node.js is installed in /home/circleci/oppia/../oppia_tools
Checking if yarn is installed in /home/circleci/oppia/../oppia_tools
Environment setup completed.
Checking whether Google App Engine is installed in /home/circleci/oppia/../oppia_tools/google_appengine_1.9.67/google_appengine
Checking whether google-cloud-sdk is installed in /home/circleci/oppia/../oppia_tools/google-cloud-sdk-251.0.0/google-cloud-sdk
Running build task with concatenation and minification
Building third party libs at third_party/generated/
Compiling ts files...
Minifying and creating sourcemap for third_party/generated/js/third_party.js
Computing hashes for files in /home/circleci/oppia/assets/
Computing hashes for files in /home/circleci/oppia/extensions/
Computing hashes for files in /home/circleci/oppia/local_compiled_js/extensions/
Computing hashes for files in /home/circleci/oppia/core/templates/dev/head/
Computing hashes for files in /home/circleci/oppia/local_compiled_js/core/templates/dev/head/
Computing hashes for files in /home/circleci/oppia/third_party/generated/
Building webpack
Starting type checking service...
Using 1 worker with 2048MB memory limit
Too long with no output (exceeded 10m0s)
```
Frontend tests are failing because of long timeout on CircleCI
**Description:**
Frontend tests are failing because of too long timeout on CircleCI and pass the test on restart. This has happened multiple times as of now.

(Add :+1: to this comment if you see this happens for your/any PR!)

**Log:**

```
#!/bin/bash -eo pipefail
python -m scripts.run_frontend_tests --run_minified_tests --skip_install
Checking if node.js is installed in /home/circleci/oppia/../oppia_tools
Checking if yarn is installed in /home/circleci/oppia/../oppia_tools
Environment setup completed.
Checking whether Google App Engine is installed in /home/circleci/oppia/../oppia_tools/google_appengine_1.9.67/google_appengine
Checking whether google-cloud-sdk is installed in /home/circleci/oppia/../oppia_tools/google-cloud-sdk-251.0.0/google-cloud-sdk
Running build task with concatenation and minification
Building third party libs at third_party/generated/
Compiling ts files...
Minifying and creating sourcemap for third_party/generated/js/third_party.js
Computing hashes for files in /home/circleci/oppia/assets/
Computing hashes for files in /home/circleci/oppia/extensions/
Computing hashes for files in /home/circleci/oppia/local_compiled_js/extensions/
Computing hashes for files in /home/circleci/oppia/core/templates/dev/head/
Computing hashes for files in /home/circleci/oppia/local_compiled_js/core/templates/dev/head/
Computing hashes for files in /home/circleci/oppia/third_party/generated/
Building webpack
Starting type checking service...
Using 1 worker with 2048MB memory limit
Too long with no output (exceeded 10m0s)
```


Discussion:

Resolving patch:
diff --git a/scripts/build.py b/scripts/build.py
--- a/scripts/build.py
+++ b/scripts/build.py
@@ -1381,10 +1381,10 @@ def main(args=None):
             'minify_third_party_libs_only should not be set in non-prod mode.')
     if options.prod_mode:
         minify_third_party_libs(THIRD_PARTY_GENERATED_DEV_DIR)
-        hashes = generate_hashes()
-        build_using_webpack()
-        generate_app_yaml()
         if not options.minify_third_party_libs_only:
+            hashes = generate_hashes()
+            build_using_webpack()
+            generate_app_yaml()
             generate_build_directory(hashes)
 
     save_hashes_to_file(dict())
diff --git a/scripts/install_third_party_libs.py b/scripts/install_third_party_libs.py
--- a/scripts/install_third_party_libs.py
+++ b/scripts/install_third_party_libs.py
@@ -40,7 +40,6 @@
 # pylint: disable=wrong-import-order
 import python_utils  # isort:skip
 
-from . import build  # isort:skip
 from . import common  # isort:skip
 from . import install_third_party  # isort:skip
 from . import pre_commit_hook  # isort:skip
@@ -186,23 +185,6 @@ def install_skulpt(parsed_args):
             os.path.join(common.THIRD_PARTY_DIR, 'static/skulpt-0.10.0'))
 
 
-def maybe_install_dependencies(
-        skip_installing_third_party_libs, run_minified_tests):
-    """Parse additional command line arguments."""
-    if skip_installing_third_party_libs is False:
-        # Install third party dependencies.
-        main(args=[])
-        # Ensure that generated JS and CSS files are in place before running the
-        # tests.
-        python_utils.PRINT('Running build task with concatenation only')
-        build.main(args=[])
-
-    if run_minified_tests is True:
-        python_utils.PRINT(
-            'Running build task with concatenation and minification')
-        build.main(args=['--prod_env'])
-
-
 def ensure_pip_library_is_installed(package, version, path):
     """Installs the pip library after ensuring its not already installed.
 


Test patch:
diff --git a/scripts/run_frontend_tests.py b/scripts/run_frontend_tests.py
--- a/scripts/run_frontend_tests.py
+++ b/scripts/run_frontend_tests.py
@@ -54,8 +54,9 @@ def main(args=None):
     setup.main(args=[])
     setup_gae.main(args=[])
 
-    install_third_party_libs.maybe_install_dependencies(
-        parsed_args.skip_install, parsed_args.run_minified_tests)
+    if not parsed_args.skip_install:
+        install_third_party_libs.main()
+
     common.print_each_string_after_two_new_lines([
         'View interactive frontend test coverage reports by navigating to',
         '../karma_coverage_reports',
diff --git a/scripts/run_performance_tests.py b/scripts/run_performance_tests.py
--- a/scripts/run_performance_tests.py
+++ b/scripts/run_performance_tests.py
@@ -95,8 +95,8 @@ def main(args=None):
     setup.main(args=[])
     setup_gae.main(args=[])
 
-    install_third_party_libs.maybe_install_dependencies(
-        parsed_args.skip_install, parsed_args.run_minified_tests)
+    if not parsed_args.skip_install:
+        install_third_party_libs.main()
 
     if common.is_port_open(USUAL_PORT_NUMBER_FOR_GAE_SERVER_IN_START):
         common.print_each_string_after_two_new_lines([