Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove touch as dev dependency #5023

Merged
merged 3 commits into from
Nov 8, 2023
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
48 changes: 0 additions & 48 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@
"sinon": "^9.0.3",
"strip-ansi": "^6.0.0",
"svgo": "^1.3.2",
"touch": "^3.1.0",
"unexpected": "^11.14.0",
"unexpected-eventemitter": "^2.2.0",
"unexpected-map": "^2.0.0",
Expand Down
10 changes: 8 additions & 2 deletions test/integration/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const {format} = require('util');
const path = require('path');
const Base = require('../../lib/reporters/base');
const debug = require('debug')('mocha:test:integration:helpers');
const touch = require('touch');

/**
* Path to `mocha` executable
Expand Down Expand Up @@ -479,6 +478,8 @@ async function runMochaWatchJSONAsync(args, opts, change) {
);
}

const touchRef = new Date();

/**
* Synchronously touch a file. Creates
* the file and all its parent directories if necessary.
Expand All @@ -487,7 +488,12 @@ async function runMochaWatchJSONAsync(args, opts, change) {
*/
function touchFile(filepath) {
fs.ensureDirSync(path.dirname(filepath));
touch.sync(filepath);
try {
fs.utimesSync(filepath, touchRef, touchRef);
} catch (e) {
const fd = fs.openSync(filepath, 'a');
fs.closeSync(fd);
}
}
Uzlopak marked this conversation as resolved.
Show resolved Hide resolved

Uzlopak marked this conversation as resolved.
Show resolved Hide resolved
/**
Expand Down