Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
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