11import assert from 'node:assert' ;
2- import { Module } from 'node:module' ;
32import sinon from 'sinon' ;
43import { after , afterEach , before , beforeEach , describe , esmocha , expect , it } from 'esmocha' ;
5- import quibble from 'quibble' ;
64import helpers , { getCreateEnv as getCreateEnvironment } from './helpers.js' ;
75import { greaterThan5 } from './generator-versions.js' ;
8- import * as execaModule from 'execa' ;
96
10- if ( ! Module . register ) {
11- throw new Error ( 'Node greater than v18.19.0 or v20.6.0 is required to test this module.' ) ;
12- }
13-
14- const commitSharedFsTask = esmocha . fn ( ) ;
15- const packageManagerInstallTask = esmocha . fn ( ) ;
16- const execa = esmocha . fn ( ) ;
17- await quibble . esm ( '../src/commit.ts' , { commitSharedFsTask } ) ;
18- await quibble . esm ( '../src/package-manager.ts' , { packageManagerInstallTask } ) ;
19- await quibble . esm ( 'execa' , { ...execaModule , execa } ) ;
7+ const { commitSharedFsTask } = await esmocha . mock ( '../src/commit.js' , import ( '../src/commit.js' ) ) ;
8+ const { packageManagerInstallTask } = await esmocha . mock ( '../src/package-manager.js' , import ( '../src/package-manager.js' ) ) ;
9+ const { execa } = await esmocha . mock ( 'execa' , import ( 'execa' ) ) ;
2010const { default : BasicEnvironment } = await import ( '../src/environment-base.js' ) ;
2111
2212for ( const generatorVersion of greaterThan5 ) {
@@ -28,7 +18,7 @@ for (const generatorVersion of greaterThan5) {
2818 esmocha . resetAllMocks ( ) ;
2919 } ) ;
3020 after ( ( ) => {
31- quibble . reset ( ) ;
21+ esmocha . reset ( true ) ;
3222 } ) ;
3323
3424 describe ( 'customCommitTask feature' , ( ) => {
0 commit comments