kpdecker / jsdiff

A javascript text differencing implementation.
BSD 3-Clause "New" or "Revised" License
7.69k stars 491 forks source link

Bump Mocha one major version #507

Closed ExplodingCabbage closed 3 months ago

ExplodingCabbage commented 3 months ago

The latest tiny step in my attempts to upgrade the build pipeline used by this project. (I want it all up to date so that when I introduce TypeScript, I can rely on the latest docs for the tools being used. I am not very knowledgeable about JavaScript build tools and if I have to try to figure out how to make stuff work with versions of them that are years out of date then I'm going to end up tearing my hair out.)

Upgrading to version 8 breaks stuff, currently, which is why I'm only going up one major version at the moment. Output of yarn test with version 8 is as follows:

Running "mocha_istanbul:coverage" (mocha_istanbul) task

/home/mark/jsdiff/test/convert/dmp.js:1
import {convertChangesToDMP} from '../../lib/convert/dmp';
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at internalCompileFunction (node:internal/vm:77:18)
    at wrapSafe (node:internal/modules/cjs/loader:1288:20)
    at Module._compile (node:internal/modules/cjs/loader:1340:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module._extensions.<computed> [as .js] (/home/mark/jsdiff/node_modules/istanbul/lib/hook.js:109:37)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at exports.requireOrImport (/home/mark/jsdiff/node_modules/mocha/lib/esm-utils.js:42:12)
    at exports.loadFilesAsync (/home/mark/jsdiff/node_modules/mocha/lib/esm-utils.js:55:34)
    at Mocha.loadFilesAsync (/home/mark/jsdiff/node_modules/mocha/lib/mocha.js:473:19)
    at singleRun (/home/mark/jsdiff/node_modules/mocha/lib/cli/run-helpers.js:125:15)
    at exports.runMocha (/home/mark/jsdiff/node_modules/mocha/lib/cli/run-helpers.js:190:10)
    at exports.handler (/home/mark/jsdiff/node_modules/mocha/lib/cli/run.js:362:11)
    at /home/mark/jsdiff/node_modules/yargs/build/index.cjs:443:71
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
No coverage information was collected, exit without writing coverage information

I am not really sure why the above happens; is it an incompatibility between version 8 and Kevin's Istanbul fork? Or between version 8 and the (ancient, abandoned) grunt-mocha-test package? Or something else, maybe? Will have to investigate - or maybe try to rip out grunt to sidestep the issue!