def test_compiled_js_dir_is_deleted_before_compilation(self):
    'Test that compiled_js_dir is deleted before a fresh compilation.'

    def mock_check_call(unused_cmd):
        pass

    def mock_require_compiled_js_dir_to_be_valid():
        pass
    with self.swap(build, 'COMPILED_JS_DIR', MOCK_COMPILED_JS_DIR), self.swap(build, 'require_compiled_js_dir_to_be_valid', mock_require_compiled_js_dir_to_be_valid):
        if (not os.path.exists(os.path.dirname(MOCK_COMPILED_JS_DIR))):
            os.mkdir(os.path.dirname(MOCK_COMPILED_JS_DIR))
        with self.swap(subprocess, 'check_call', mock_check_call):
            build.compile_typescript_files('.')
            self.assertFalse(os.path.exists(os.path.dirname(MOCK_COMPILED_JS_DIR)))
Test that compiled_js_dir is deleted before a fresh compilation.
def test_compiled_js_dir_is_deleted_before_compilation(self):
    

    def mock_check_call(unused_cmd):
        pass

    def mock_require_compiled_js_dir_to_be_valid():
        pass
    with self.swap(build, 'COMPILED_JS_DIR', MOCK_COMPILED_JS_DIR), self.swap(build, 'require_compiled_js_dir_to_be_valid', mock_require_compiled_js_dir_to_be_valid):
        if (not os.path.exists(os.path.dirname(MOCK_COMPILED_JS_DIR))):
            os.mkdir(os.path.dirname(MOCK_COMPILED_JS_DIR))
        with self.swap(subprocess, 'check_call', mock_check_call):
            build.compile_typescript_files('.')
            self.assertFalse(os.path.exists(os.path.dirname(MOCK_COMPILED_JS_DIR)))