@@ -2,7 +2,6 @@ import {promises as fs} from 'node:fs';
22import { resolve } from 'node:path' ;
33import mustache from 'mustache' ;
44import deepmerge from 'deepmerge' ;
5- import * as mkdir from 'make-dir' ;
65import * as camelcase from 'camelcase' ;
76import * as cucumberScaffolder from '@form8ion/cucumber-scaffolder' ;
87
@@ -14,7 +13,6 @@ import scaffoldTesting from './testing.js';
1413
1514vi . mock ( 'node:fs' ) ;
1615vi . mock ( 'mustache' ) ;
17- vi . mock ( 'make-dir' ) ;
1816vi . mock ( 'camelcase' ) ;
1917vi . mock ( 'deepmerge' ) ;
2018vi . mock ( '@form8ion/cucumber-scaffolder' ) ;
@@ -24,7 +22,6 @@ describe('testing', () => {
2422 const projectName = any . word ( ) ;
2523 const packageName = any . word ( ) ;
2624 const camelizedProjectName = any . word ( ) ;
27- const pathToCreatedDirectory = any . string ( ) ;
2825
2926 afterEach ( ( ) => {
3027 vi . clearAllMocks ( ) ;
@@ -35,9 +32,6 @@ describe('testing', () => {
3532 const mergedResults = any . simpleObject ( ) ;
3633 const renderedContent = any . string ( ) ;
3734 const templateContent = any . string ( ) ;
38- when ( mkdir . default )
39- . calledWith ( `${ projectRoot } /test/integration/features/step_definitions` )
40- . mockResolvedValue ( pathToCreatedDirectory ) ;
4135 when ( cucumberScaffolder . scaffold ) . calledWith ( { projectRoot} ) . mockReturnValue ( cucumberResults ) ;
4236 when ( fs . readFile )
4337 . calledWith ( resolve ( __dirname , '..' , 'templates' , 'common-steps.mustache' ) , 'utf8' )
@@ -55,7 +49,12 @@ describe('testing', () => {
5549
5650 expect ( await scaffoldTesting ( { projectRoot, projectName, packageName, tests : { integration : true } } ) )
5751 . toEqual ( mergedResults ) ;
58- expect ( fs . writeFile ) . toHaveBeenCalledWith ( `${ pathToCreatedDirectory } /common-steps.js` , renderedContent ) ;
52+ expect ( fs . mkdir )
53+ . toHaveBeenCalledWith ( `${ projectRoot } /test/integration/features/step_definitions` , { recursive : true } ) ;
54+ expect ( fs . writeFile ) . toHaveBeenCalledWith (
55+ `${ projectRoot } /test/integration/features/step_definitions/common-steps.js` ,
56+ renderedContent
57+ ) ;
5958 } ) ;
6059
6160 it ( 'should not create a canary test when the project will not be integration tested' , async ( ) => {
0 commit comments