Skip to content

Commit

Permalink
chore: remove touch as dev dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
Uzlopak committed Nov 6, 2023
1 parent ee2b70e commit 9790cf6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 52 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 @@ -132,7 +132,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
11 changes: 8 additions & 3 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,9 +488,13 @@ 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);
}
}

/**
* Synchronously replace all substrings matched by `pattern` with
* `replacement` in the contents of file at `filepath`
Expand Down

0 comments on commit 9790cf6

Please sign in to comment.