From ac2d3f2e65b781194792819e3321337b3a6f5670 Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Fri, 3 May 2024 18:55:20 -0400 Subject: [PATCH] refactor theme pack specs to support latest Node 18.20.x --- .../theme-pack-context-plugin.js | 13 ++++--------- .../develop.plugins.context/greenwood.config.js | 4 +++- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/packages/cli/test/cases/build.plugins.context/theme-pack-context-plugin.js b/packages/cli/test/cases/build.plugins.context/theme-pack-context-plugin.js index bff573f54..2227fbad2 100644 --- a/packages/cli/test/cases/build.plugins.context/theme-pack-context-plugin.js +++ b/packages/cli/test/cases/build.plugins.context/theme-pack-context-plugin.js @@ -1,20 +1,15 @@ import fs from 'fs/promises'; -import os from 'os'; -import { spawnSync } from 'child_process'; const packageJson = JSON.parse(await fs.readFile(new URL('./package.json', import.meta.url), 'utf-8')); -const myThemePackPlugin = () => [{ +const myThemePackPlugin = (options = {}) => [{ type: 'context', name: 'my-theme-pack:context', provider: () => { const { name } = packageJson; - const command = os.platform() === 'win32' ? 'npm.cmd' : 'npm'; - const ls = spawnSync(command, ['ls', name]); - const isInstalled = ls.stdout.toString().indexOf('(empty)') < 0; - const templateLocation = isInstalled - ? new URL(`./node_modules/${name}/dist/layouts/`, import.meta.url) - : new URL('./fixtures/layouts/', import.meta.url); + const templateLocation = options.__isDevelopment // eslint-disable-line no-underscore-dangle + ? new URL('./fixtures/layouts/', import.meta.url) + : new URL(`./node_modules/${name}/dist/layouts/`, import.meta.url); return { templates: [ diff --git a/packages/cli/test/cases/develop.plugins.context/greenwood.config.js b/packages/cli/test/cases/develop.plugins.context/greenwood.config.js index 74c311257..60eaf3c94 100644 --- a/packages/cli/test/cases/develop.plugins.context/greenwood.config.js +++ b/packages/cli/test/cases/develop.plugins.context/greenwood.config.js @@ -24,7 +24,9 @@ class MyThemePackDevelopmentResource extends ResourceInterface { export default { plugins: [ - ...myThemePackPlugin(), + ...myThemePackPlugin({ + __isDevelopment: true + }), { type: 'resource', name: 'my-theme-pack:resource',