From ae61b08ae5bdf3c738dbda9e6b8d438323386383 Mon Sep 17 00:00:00 2001 From: ento Date: Fri, 11 Dec 2020 02:12:01 -0800 Subject: [PATCH] Fix browser testing (#5254) * jasmine: specify 'after' only in Node The commands module is never executed in browsers and the 'after' constraint caused a regression where tests were never run in the browser. * jasmine: give the startup module a name like all others --- plugins/tiddlywiki/jasmine/jasmine-plugin.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/tiddlywiki/jasmine/jasmine-plugin.js b/plugins/tiddlywiki/jasmine/jasmine-plugin.js index 34c5b5831..f508b8f03 100644 --- a/plugins/tiddlywiki/jasmine/jasmine-plugin.js +++ b/plugins/tiddlywiki/jasmine/jasmine-plugin.js @@ -9,19 +9,20 @@ The main module of the Jasmine test plugin for TiddlyWiki5 (function(){ /*jslint node: true, browser: true */ -/*global $tw: false */ +/*global $tw: true */ "use strict"; var TEST_TIDDLER_FILTER = "[type[application/javascript]tag[$:/tags/test-spec]]"; +exports.name = "jasmine"; // Ensure this startup module is executed in the right order. -// Jasmine calls `process.exit()` with a non-zero exit code if there's +// In Node.js, Jasmine calls `process.exit()` with a non-zero exit code if there's // any failed tests. Because of that, we want to make sure all critical // startup modules are run before this one. // * The "commands" module handles the --rendertiddler command-line flag, -// which is typically given to export an HTML file that can be opened with +// which is typically given in order to export an HTML file that can be opened with // a browser to run tests. -exports.after = ["commands"]; +exports.after = $tw.node ? ["commands"] : []; /* Startup function for running tests