Skip to content

Commit 48002bc

Browse files
authored
chore: remove touch as dev dependency (#5023)
* chore: remove touch as dev dependency * Update test/integration/helpers.js
1 parent 45e97af commit 48002bc

File tree

3 files changed

+8
-51
lines changed

3 files changed

+8
-51
lines changed

package-lock.json

Lines changed: 0 additions & 48 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@
131131
"sinon": "^9.0.3",
132132
"strip-ansi": "^6.0.0",
133133
"svgo": "^1.3.2",
134-
"touch": "^3.1.0",
135134
"unexpected": "^11.14.0",
136135
"unexpected-eventemitter": "^2.2.0",
137136
"unexpected-map": "^2.0.0",

test/integration/helpers.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ const {format} = require('util');
77
const path = require('path');
88
const Base = require('../../lib/reporters/base');
99
const debug = require('debug')('mocha:test:integration:helpers');
10-
const touch = require('touch');
1110

1211
/**
1312
* Path to `mocha` executable
@@ -479,6 +478,8 @@ async function runMochaWatchJSONAsync(args, opts, change) {
479478
);
480479
}
481480

481+
const touchRef = new Date();
482+
482483
/**
483484
* Synchronously touch a file. Creates
484485
* the file and all its parent directories if necessary.
@@ -487,7 +488,12 @@ async function runMochaWatchJSONAsync(args, opts, change) {
487488
*/
488489
function touchFile(filepath) {
489490
fs.ensureDirSync(path.dirname(filepath));
490-
touch.sync(filepath);
491+
try {
492+
fs.utimesSync(filepath, touchRef, touchRef);
493+
} catch (e) {
494+
const fd = fs.openSync(filepath, 'a');
495+
fs.closeSync(fd);
496+
}
491497
}
492498

493499
/**

0 commit comments

Comments
 (0)