question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

IntelliJ doesn't save code changes before running tests

See original GitHub issue

Environment info:

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.5.4-hotfix.2, on Microsoft Windows [Version 10.0.17763.557], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[√] Android Studio (version 3.4)
[√] IntelliJ IDEA Ultimate Edition (version 2019.1)
[√] VS Code (version 1.33.1)

Steps to reproduce problem:

  1. Create Flutter project
  2. Create unit/calculator.dart:
int calculate(int a) {
  return a + 3;
}
  1. Create unit/test.dart
import 'package:flutter_test/flutter_test.dart';

import 'calculator.dart';

void main() {
  group('simple', () {
    test('calculate', () {
      final value = calculate(2);

      expect(value, 5);
    });
  });
}
  1. Place breakpoint on the line with expect to see the value of the variable value.
  2. Run the program with SHIFT + F10 This is the command executed: flutter\bin\flutter.bat --no-color test --machine test\unit\test.dart
  3. Change the added value in the calculator:
int calculate(int a) {
  return a + 30;
}
  1. Run debug with SHIFT + F9 This is the command executed: flutter\bin\flutter.bat --no-color test --machine --start-paused test\unit\test.dart

  2. Problem: Old value is shown, code did not compile again.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:14 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
ThinkDigitalSoftwarecommented, May 14, 2020

I tested and verified the same behavior. I did this by doing a watch -d -n 1 cat my_file_test.dart in an external terminal window and running tests. I simply would add some nonsense that wouldn’t compile and ran the test without switching windows and it would compile successfully. The watch showed no changes. As soon as I clicked outside of IntelliJ (clicking the internal terminal didn’t work for me) then the watch updated and the tests would no longer compile. Good catch, @andrasferenczi!

1reaction
andrasferenczicommented, May 14, 2020

@TahaTesser I would say this describes the way I was trying to reproduce the issue on the command line and I am getting exactly the same thing as you did for the output

Read more comments on GitHub >

github_iconTop Results From Across the Web

IntelliJ doesn't save code changes before running tests
In my Run test using set in IntelliJ IDEA, IntelliJ doesn't save code changes before running tests. My Run tests using.
Read more >
Save and revert changes | IntelliJ IDEA Documentation
In the Settings/Preferences dialog ( Ctrl+Alt+S ), select Tools | Actions on Save. Select the checkboxes next to the actions that you want...
Read more >
Code change is not being reflected in the idea plugin
Hello, I am developing an Intellij plugin (tutorials) which shows the current git branch in the notification. Below are the steps I...
Read more >
Run tests | IntelliJ IDEA Documentation - JetBrains
When you run a test, IntelliJ IDEA creates a temporary run configuration. You can save temporary run configurations, change their settings, ...
Read more >
Intellij is not updating junit test file changes causing unreliable ...
Try re-creating project configuratoin by re-importing project from existing sources: https://www.jetbrains.com/help/idea/import-project-or- ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found