 core/modules/node/src/Tests/NodeEntityViewModeAlterTest.php | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/core/modules/node/src/Tests/NodeEntityViewModeAlterTest.php b/core/modules/node/src/Tests/NodeEntityViewModeAlterTest.php
index 232fde7..dc0d02c 100644
--- a/core/modules/node/src/Tests/NodeEntityViewModeAlterTest.php
+++ b/core/modules/node/src/Tests/NodeEntityViewModeAlterTest.php
@@ -7,6 +7,8 @@
 
 namespace Drupal\node\Tests;
 
+use Drupal\Core\Cache\Cache;
+
 /**
  * Tests changing view modes for nodes.
  *
@@ -37,6 +39,7 @@ function testNodeViewModeChange() {
 
     // Set the flag to alter the view mode and view the node.
     \Drupal::state()->set('node_test_change_view_mode', 'teaser');
+    Cache::invalidateTags(['rendered']);
     $this->drupalGet('node/' . $node->id());
 
     // Check that teaser mode is viewed.
