Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions crates/mdbook-driver/src/mdbook.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,11 +263,6 @@ impl MDBook {
}
}

// Index Preprocessor is disabled so that chapter paths
// continue to point to the actual markdown files.
self.preprocessors = determine_preprocessors(&self.config, &self.root)?;
self.preprocessors
.shift_remove_entry(IndexPreprocessor::NAME);
let (book, _) = self.preprocess_book(&TestRenderer)?;

let color_output = std::io::stderr().is_terminal();
Expand Down
14 changes: 14 additions & 0 deletions tests/testsuite/preprocessor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,20 @@ fn runs_preprocessors() {
assert_eq!(inner.rendered_with, ["html"]);
}

// Run tests with a custom preprocessor.
#[test]
fn test_with_custom_preprocessor() {
let test = BookTest::init(|_| {});
let spy: Arc<Mutex<Inner>> = Default::default();
let mut book = test.load_book();
book.with_preprocessor(Spy(Arc::clone(&spy)));
book.test(vec![]).unwrap();

let inner = spy.lock().unwrap();
assert_eq!(inner.run_count, 1);
assert_eq!(inner.rendered_with, ["test"]);
}

// No-op preprocessor works.
#[test]
fn nop_preprocessor() {
Expand Down