Skip to content

chore: Replace mocha/expect/nyc with node:test harness - #90

Open
FotoVerite wants to merge 8 commits into
gulpjs:mainfrom
FotoVerite:main
Open

FotoVerite wants to merge 8 commits into
gulpjs:mainfrom
FotoVerite:main

Conversation

@FotoVerite

Copy link
Copy Markdown
Contributor

Closes #89

This is not complete yet, there are some tests that seem to do nothing. I have kept them commented out so they are easily looked at

t.plan might not work the same as assertions so the first debounce test might need to be written

and #46 is happening again?

@FotoVerite FotoVerite self-assigned this Oct 23, 2026
@FotoVerite
FotoVerite requested a review from phated October 23, 2026 16:06
@FotoVerite

Copy link
Copy Markdown
Contributor Author

So I've been able to fix most tests, I'm using a promise to await before checking runs which seems like a sane choice to deal with the assert swallowing I found wish it was a bit more elegant but it isn't cludge.

I removed t.plan(1) from the debounce test because I can't figure out the purpose of it originally and it always should have been 2 from my reading of the mocha the other test is showing a regression

// #46
it("ignoring globs also works with cwd option", function (t, done) {
watcher = watch(["fixtures/**", "!fixtures/*.js"], { cwd: "test" });

watcher.once("change", function (filepath) {
  // It should never reach here
  assert.ok(!filepath);
  done();
});

// We default `ignoreInitial` to true, so always wait for `on('ready')`
watcher.on("ready", changeFile);

setTimeout(done, 1500);

});

i'm unsure why this passed in the mocha and looks like it's related to chokidar and probably needs actual code changes and or an update to chokidar which is on 6.

@phated phated left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some changes still needed and I will think about the promise usage.

Comment thread test/lib/debounce.test.js

describe("lib/debounce", function () {
it("should call an original function with specified delay", function (done) {
expect.assertions(1);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like the plan was 1 and it was lost

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It calls t.plan is called twice I'm confused how it would only call one. I think mocha might work different but even with done being called the assert is still counted.

Comment thread test/lib/debounce.test.js Outdated
Comment thread .gitignore

# Test results
test.xunit
test/lcov.info No newline at end of file

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
test/lcov.info
test/lcov.info
test/fixtures/

Fixtures are generated during test so they should be ignored

Comment thread test/lib/normalize-args.test.js Outdated
Comment thread test/index.js Outdated
Comment thread test/index.js
Comment on lines 10 to +11
var normalizePath = require("normalize-path");
var through = require("through2");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var normalizePath = require("normalize-path");
var through = require("through2");
var through = require("through2");
var normalizePath = require("normalize-path");

diff nit

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why normalize over through originally? Not alphabetical?

Comment thread test/index.js
setTimeout(changeFile, timeout * 2);
});

await promise;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting use of this. Let me think about it a bit.

FotoVerite and others added 3 commits October 25, 2026 14:17
Co-authored-by: Blaine Bublitz <blaine.bublitz@gmail.com>
Co-authored-by: Blaine Bublitz <blaine.bublitz@gmail.com>
Co-authored-by: Blaine Bublitz <blaine.bublitz@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update test harness

2 participants