From 387847b41c46d3761c77c2b26ccf0e4946f7120f Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Mon, 17 Jul 2023 08:23:39 -0400 Subject: [PATCH] Move the helpers in to a directory, so they aren't confused with top-level config --- tests/helpers.ts | 4 ++++ tests/{ => helpers}/assertions.ts | 0 tests/{ => helpers}/fixtures.ts | 2 +- tests/{test-helpers.ts => helpers/meta-helpers.ts} | 0 tests/{ => helpers}/utils.ts | 0 tests/smoke-tests/--addon-location.test.ts | 9 +++++++-- tests/smoke-tests/--addon-only.test.ts | 2 +- tests/smoke-tests/--test-app-location.test.ts | 9 +++++++-- tests/smoke-tests/--typescript.test.ts | 4 ++-- tests/smoke-tests/defaults.test.ts | 4 ++-- .../within-existing-monorepo/custom-locations.test.ts | 11 ++++++++--- .../within-existing-monorepo/defaults.test.ts | 6 +++--- 12 files changed, 35 insertions(+), 16 deletions(-) create mode 100644 tests/helpers.ts rename tests/{ => helpers}/assertions.ts (100%) rename tests/{ => helpers}/fixtures.ts (97%) rename tests/{test-helpers.ts => helpers/meta-helpers.ts} (100%) rename tests/{ => helpers}/utils.ts (100%) diff --git a/tests/helpers.ts b/tests/helpers.ts new file mode 100644 index 00000000..ae90a921 --- /dev/null +++ b/tests/helpers.ts @@ -0,0 +1,4 @@ +export * from './helpers/assertions.js'; +export * from './helpers/fixtures.js'; +export * from './helpers/meta-helpers.js'; +export * from './helpers/utils.js'; diff --git a/tests/assertions.ts b/tests/helpers/assertions.ts similarity index 100% rename from tests/assertions.ts rename to tests/helpers/assertions.ts diff --git a/tests/fixtures.ts b/tests/helpers/fixtures.ts similarity index 97% rename from tests/fixtures.ts rename to tests/helpers/fixtures.ts index cc814a07..7eb68b02 100644 --- a/tests/fixtures.ts +++ b/tests/helpers/fixtures.ts @@ -6,7 +6,7 @@ import { fileURLToPath } from 'node:url'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); -const fixturesPath = path.join(__dirname, 'fixtures'); +const fixturesPath = path.join(__dirname, '../fixtures'); /** * Returns the contents of a file from the "tests/fixtures" directory. diff --git a/tests/test-helpers.ts b/tests/helpers/meta-helpers.ts similarity index 100% rename from tests/test-helpers.ts rename to tests/helpers/meta-helpers.ts diff --git a/tests/utils.ts b/tests/helpers/utils.ts similarity index 100% rename from tests/utils.ts rename to tests/helpers/utils.ts diff --git a/tests/smoke-tests/--addon-location.test.ts b/tests/smoke-tests/--addon-location.test.ts index fc181738..e380ba19 100644 --- a/tests/smoke-tests/--addon-location.test.ts +++ b/tests/smoke-tests/--addon-location.test.ts @@ -2,8 +2,13 @@ import fs from 'node:fs/promises'; import path from 'node:path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; -import { assertGeneratedCorrectly } from '../assertions.js'; -import { createAddon, createTmp, install, runScript } from '../utils.js'; +import { + assertGeneratedCorrectly, + createAddon, + createTmp, + install, + runScript, +} from '../helpers.js'; describe('--addon-location', () => { let cwd = ''; diff --git a/tests/smoke-tests/--addon-only.test.ts b/tests/smoke-tests/--addon-only.test.ts index a96ff47f..c3a97766 100644 --- a/tests/smoke-tests/--addon-only.test.ts +++ b/tests/smoke-tests/--addon-only.test.ts @@ -2,7 +2,7 @@ import fse from 'fs-extra'; import path from 'node:path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; -import { AddonHelper } from '../test-helpers.js'; +import { AddonHelper } from '../helpers.js'; describe('--addon-only', () => { let helper = new AddonHelper({ packageManager: 'pnpm', args: ['--addon-only'] }); diff --git a/tests/smoke-tests/--test-app-location.test.ts b/tests/smoke-tests/--test-app-location.test.ts index e5bd1d0e..01e44915 100644 --- a/tests/smoke-tests/--test-app-location.test.ts +++ b/tests/smoke-tests/--test-app-location.test.ts @@ -2,8 +2,13 @@ import fs from 'node:fs/promises'; import path from 'node:path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; -import { assertGeneratedCorrectly } from '../assertions.js'; -import { createAddon, createTmp, install, runScript } from '../utils.js'; +import { + assertGeneratedCorrectly, + createAddon, + createTmp, + install, + runScript, +} from '../helpers.js'; describe('--test-app-location', () => { let cwd = ''; diff --git a/tests/smoke-tests/--typescript.test.ts b/tests/smoke-tests/--typescript.test.ts index 57328eab..a9cb843e 100644 --- a/tests/smoke-tests/--typescript.test.ts +++ b/tests/smoke-tests/--typescript.test.ts @@ -2,15 +2,15 @@ import fs from 'node:fs/promises'; import path from 'node:path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; -import { assertGeneratedCorrectly } from '../assertions.js'; import { + assertGeneratedCorrectly, createAddon, createTmp, dirContents, install, runScript, SUPPORTED_PACKAGE_MANAGERS, -} from '../utils.js'; +} from '../helpers.js'; for (let packageManager of SUPPORTED_PACKAGE_MANAGERS) { describe(`--typescript with ${packageManager}`, () => { diff --git a/tests/smoke-tests/defaults.test.ts b/tests/smoke-tests/defaults.test.ts index 063fc9ba..7ad458ca 100644 --- a/tests/smoke-tests/defaults.test.ts +++ b/tests/smoke-tests/defaults.test.ts @@ -3,15 +3,15 @@ import fs from 'node:fs/promises'; import path from 'node:path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; -import { assertGeneratedCorrectly } from '../assertions.js'; import { + assertGeneratedCorrectly, createAddon, createTmp, dirContents, install, runScript, SUPPORTED_PACKAGE_MANAGERS, -} from '../utils.js'; +} from '../helpers.js'; for (let packageManager of SUPPORTED_PACKAGE_MANAGERS) { describe(`defaults with ${packageManager}`, () => { diff --git a/tests/smoke-tests/within-existing-monorepo/custom-locations.test.ts b/tests/smoke-tests/within-existing-monorepo/custom-locations.test.ts index 4a5becd1..06fbc184 100644 --- a/tests/smoke-tests/within-existing-monorepo/custom-locations.test.ts +++ b/tests/smoke-tests/within-existing-monorepo/custom-locations.test.ts @@ -3,9 +3,14 @@ import fs from 'node:fs/promises'; import path from 'node:path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; -import { assertGeneratedCorrectly } from '../../assertions.js'; -import { readFixture } from '../../fixtures.js'; -import { createAddon, createTmp, install, runScript } from '../../utils.js'; +import { + assertGeneratedCorrectly, + createAddon, + createTmp, + install, + readFixture, + runScript, +} from '../../helpers.js'; let commonFixtures = { '.prettierrc.js': await readFixture('.prettierrc.js'), diff --git a/tests/smoke-tests/within-existing-monorepo/defaults.test.ts b/tests/smoke-tests/within-existing-monorepo/defaults.test.ts index b507f088..9f5ad44f 100644 --- a/tests/smoke-tests/within-existing-monorepo/defaults.test.ts +++ b/tests/smoke-tests/within-existing-monorepo/defaults.test.ts @@ -3,15 +3,15 @@ import fs from 'node:fs/promises'; import path from 'node:path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; -import { assertGeneratedCorrectly } from '../../assertions.js'; -import { readFixture } from '../../fixtures.js'; import { + assertGeneratedCorrectly, createAddon, createTmp, install, + readFixture, runScript, SUPPORTED_PACKAGE_MANAGERS, -} from '../../utils.js'; +} from '../../helpers.js'; let commonFixtures = { '.prettierrc.js': await readFixture('.prettierrc.js'),