Skip to content

Commit

Permalink
adjusts
Browse files Browse the repository at this point in the history
  • Loading branch information
mshima committed Oct 14, 2024
1 parent 9665fff commit 8356b53
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 24 deletions.
5 changes: 2 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"@types/semver": "^7.5.3",
"c8": "^10.1.2",
"cpy-cli": "^5.0.0",
"esmocha": "^2.0.0",
"esmocha": "mshima/esmocha#mocks",
"fs-extra": "^11.1.1",
"jsdoc": "^4.0.2",
"prettier": "3.0.3",
Expand Down
11 changes: 2 additions & 9 deletions test/generator-features.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
import assert from 'node:assert';
import { Module } from 'node:module';
import sinon from 'sinon';
import { after, afterEach, before, beforeEach, describe, esmocha, expect, it } from 'esmocha';
import quibble from 'quibble';
import helpers, { getCreateEnv as getCreateEnvironment } from './helpers.js';
import { greaterThan5 } from './generator-versions.js';
import * as execaModule from 'execa';

if (!Module.register) {
throw new Error('Node greater than v18.19.0 or v20.6.0 is required to test this module.');
}

const commitSharedFsTask = esmocha.fn();
const packageManagerInstallTask = esmocha.fn();
const execa = esmocha.fn();
await quibble.esm('../src/commit.ts', { commitSharedFsTask });
await quibble.esm('../src/package-manager.ts', { packageManagerInstallTask });
await quibble.esm('execa', { ...execaModule, execa });
const { execa } = await esmocha.mock('execa', import('execa'));
const { default: BasicEnvironment } = await import('../src/environment-base.js');

for (const generatorVersion of greaterThan5) {
Expand All @@ -28,7 +21,7 @@ for (const generatorVersion of greaterThan5) {
esmocha.resetAllMocks();
});
after(() => {
quibble.reset();
esmocha.reset(true);
});

describe('customCommitTask feature', () => {
Expand Down
14 changes: 3 additions & 11 deletions test/package-manager.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
import { Module } from 'node:module';
import path, { dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
import sinon from 'sinon';
import { after, afterEach, beforeEach, describe, esmocha, expect, it } from 'esmocha';
import quibble from 'quibble';

if (!Module.register) {
throw new Error('Node greater than v18.19.0 or v20.6.0 is required to test this module.');
}

const execa = esmocha.fn();
await quibble.esm('execa', { execa });
const whichPackageManager = esmocha.fn();
await quibble.esm('which-package-manager', { whichPackageManager });
const { execa } = await esmocha.mock('execa', import('execa'));
const { whichPackageManager } = await esmocha.mock('which-package-manager', import('which-package-manager'));

const { packageManagerInstallTask } = await import('../src/package-manager.js');

Expand Down Expand Up @@ -43,7 +35,7 @@ describe('environment (package-manager)', () => {
esmocha.resetAllMocks();
});
after(() => {
quibble.reset();
esmocha.reset();
});

describe('#packageManagerInstallTask()', () => {
Expand Down

0 comments on commit 8356b53

Please sign in to comment.