mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-18 07:33:12 +09:00
Fix test failures on Windows
Fix broken regex, too tight time check, and lack of shell expansion on Windows causing test cases to fail or not run at all.
This commit is contained in:
1 parent
01e442c42e
commit
09c3f82226
5 files changed
+23
-19
No files matched your search
+2
-1
@@ -23,7 +23,8 @@ describe("lib/helpers", function() {
|
||||
await libHelpers.wait(100);
|
||||
let duration = Number(hrtime() - startNs) / 1e6;
|
||||
|
||||
assert(duration > 90 && duration < 110, `duration waited (${duration}ms) 10% of expected (100ms)`);
|
||||
// On windows the time waited is normally up to 15 ms late with outliers in the 20ms range.
|
||||
assert(duration > 90 && duration < 130, `duration (${duration}ms) not within (90-130)`);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ const fs = require("fs-extra");
|
||||
const path = require("path");
|
||||
|
||||
const libPluginLoader = require("@clusterio/lib/plugin_loader");
|
||||
const { escapeRegExp } = require("@clusterio/lib/helpers");
|
||||
|
||||
|
||||
describe("lib/plugin_loader", function() {
|
||||
@@ -34,7 +35,7 @@ describe("lib/plugin_loader", function() {
|
||||
it("should throw on missing plugin", async function() {
|
||||
await assert.rejects(
|
||||
libPluginLoader.loadPluginInfos(new Map([["missing", missingPlugin]]), []),
|
||||
new RegExp(`^Error: PluginError: Cannot find module '${missingPlugin}/info'`)
|
||||
new RegExp(`^Error: PluginError: Cannot find module '${escapeRegExp(missingPlugin)}/info'`)
|
||||
);
|
||||
});
|
||||
it("should load test plugin", async function() {
|
||||
|
||||
Reference in new issue
Block a user