rejeep / ert-runner.el

Opinionated Ert testing workflow
85 stars 19 forks source link

Running with --win or --no-win produces no output #24

Open DarwinAwardWinner opened 8 years ago

DarwinAwardWinner commented 8 years ago

I'm trying to convert my package, ido-ubiquitous, to ert-runner. My package cannot function in batch-mode, so presumably I need to use the --no-win or --win option. However, when I do this, an Emacs window pops up for a fraction of a second and then disappears, leaving no output of any kind on the command line. The command exits with code 1. Can you shed any light on what's going wrong here?

swsnr commented 8 years ago

Sorry, but I don't really understand what you're trying to do. The whole purpose of this project is to run tests in batch mode, so if your package doesn't support that then what are you trying to use ert-runner for?

I'm sorry if I'm asking a stupid question 😊 but I think you might be better off with an interactive emacs -Q session and M-x ert.

rejeep commented 8 years ago

@DarwinAwardWinner Seems to be some issue with the printing. Will look in to it!

The whole purpose of this project is to run tests in batch mode,

@lunaryorn It can actually run in two other modes --no-win and --win.

DarwinAwardWinner commented 8 years ago

Despite being a package dedicated entirely to user interaction, ido-ubiquitous has an ert test suite that runs non-interactively by pushing keys onto unread-command-events to simulate user input. However, this method of simulating user input doesn't work in batch mode, and neither does ido-ubiquitous itself. So if the non-batch-mode options worked for ert-runner, I would be able to run my tests from the command line.

rejeep commented 8 years ago

And ohh, it might take some time as I'm currently using Spacemacs for the second day. :smile:

rejeep commented 8 years ago

I guess it has to do with this: https://github.com/rejeep/ert-runner.el/commit/734729e06c9da1279feaf061b3b55bfdc73b8d5e

rejeep commented 8 years ago

@jorgenschaefer do you remember why that part was removed? Seems like a mistake, right?

DarwinAwardWinner commented 7 years ago

Is there any way I can help get this fixed?

rejeep commented 7 years ago

@DarwinAwardWinner Without looking too much at the code, it seems the ert-runner-message function should use the ert-runner-output-file when set. I'm thinking something like this:

(defun ert-runner-message (format &rest args)
  "..."
  (let ((message (apply #'format format args)))
    (if ert-runner-output-file
        (f-append-text message 'utf-8 ert-runner-output-file)
      (princ message t))))

It shouldn't be that hard to get it working. Give it a shot and let us know if you need any help. Then open a PR and I'd be happy to merge it!

DarwinAwardWinner commented 7 years ago

Your suggested code seems to work with no modifications. I don't think I should submit a PR listing me as the author since it's 100% your own code.

rejeep commented 7 years ago

It's not the whole truth because I still think tests should be written so that we don't make the mistake of doing this again. I don't mind if you take my code.

DarwinAwardWinner commented 7 years ago

Ok, I'll try to write some tests for this and submit a PR.

rejeep commented 7 years ago

Awesome! 👍