Skip to content

Commit 70255cb

Browse files
committed
fix(deps): remove usage of make-dir in favor of fs.mkdir
1 parent 2c6dfe6 commit 70255cb

File tree

5 files changed

+14
-17
lines changed

5 files changed

+14
-17
lines changed

package-lock.json

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
"@form8ion/cucumber-scaffolder": "^5.0.0-beta.2",
6060
"camelcase": "^8.0.0",
6161
"deepmerge": "^4.2.2",
62-
"make-dir": "^4.0.0",
6362
"mustache": "^4.0.1"
6463
},
6564
"devDependencies": {

src/testing.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,19 @@ import {fileURLToPath} from 'node:url';
44
import deepmerge from 'deepmerge';
55
import mustache from 'mustache';
66
import camelcase from 'camelcase';
7-
import mkdir from 'make-dir';
87
import {scaffold as scaffoldCucumber} from '@form8ion/cucumber-scaffolder';
98

109
const __dirname = dirname(fileURLToPath(import.meta.url)); // eslint-disable-line no-underscore-dangle
1110

1211
export default async function ({projectRoot, projectName, packageName, tests}) {
1312
if (tests.integration) {
14-
const [stepDefinitionsDirectory, cucumberResults] = await Promise.all([
15-
mkdir(`${projectRoot}/test/integration/features/step_definitions`),
16-
scaffoldCucumber({projectRoot})
13+
const [cucumberResults] = await Promise.all([
14+
scaffoldCucumber({projectRoot}),
15+
fs.mkdir(`${projectRoot}/test/integration/features/step_definitions`, {recursive: true})
1716
]);
1817

1918
await fs.writeFile(
20-
`${stepDefinitionsDirectory}/common-steps.js`,
19+
`${projectRoot}/test/integration/features/step_definitions/common-steps.js`,
2120
mustache.render(
2221
await fs.readFile(resolve(__dirname, '..', 'templates', 'common-steps.mustache'), 'utf8'),
2322
{projectName: camelcase(projectName), packageName}

src/testing.test.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import {promises as fs} from 'node:fs';
22
import {resolve} from 'node:path';
33
import mustache from 'mustache';
44
import deepmerge from 'deepmerge';
5-
import * as mkdir from 'make-dir';
65
import * as camelcase from 'camelcase';
76
import * as cucumberScaffolder from '@form8ion/cucumber-scaffolder';
87

@@ -14,7 +13,6 @@ import scaffoldTesting from './testing.js';
1413

1514
vi.mock('node:fs');
1615
vi.mock('mustache');
17-
vi.mock('make-dir');
1816
vi.mock('camelcase');
1917
vi.mock('deepmerge');
2018
vi.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 () => {

thirdparty-wrappers/make-dir.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)