Skip to content

Commit

Permalink
chore: remove touch as dev dependency (#5023)
Browse files Browse the repository at this point in the history
* chore: remove touch as dev dependency

* Update test/integration/helpers.js
  • Loading branch information
Uzlopak authored Nov 8, 2023
1 parent 45e97af commit 48002bc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 51 deletions.
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);
}
}

/**
Expand Down

0 comments on commit 48002bc

Please sign in to comment.