From 0d314c2418399821b2059d29004ada5167cc4eb1 Mon Sep 17 00:00:00 2001 From: Hiroshi Ogawa Date: Tue, 23 Jul 2024 18:32:52 +0900 Subject: [PATCH] test: copy test --- .../sass-modern-compiler.spec.ts | 1 + .../css/vite.config-sass-modern-compiler.js | 31 +++++++++++++++++++ playground/css/vite.config-sass-modern.js | 2 +- playground/vitestGlobalSetup.ts | 4 +++ 4 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 playground/css/__tests__/sass-modern-compiler/sass-modern-compiler.spec.ts create mode 100644 playground/css/vite.config-sass-modern-compiler.js diff --git a/playground/css/__tests__/sass-modern-compiler/sass-modern-compiler.spec.ts b/playground/css/__tests__/sass-modern-compiler/sass-modern-compiler.spec.ts new file mode 100644 index 00000000000000..90a9b9774d3ebc --- /dev/null +++ b/playground/css/__tests__/sass-modern-compiler/sass-modern-compiler.spec.ts @@ -0,0 +1 @@ +import '../css.spec' diff --git a/playground/css/vite.config-sass-modern-compiler.js b/playground/css/vite.config-sass-modern-compiler.js new file mode 100644 index 00000000000000..9759d58506f597 --- /dev/null +++ b/playground/css/vite.config-sass-modern-compiler.js @@ -0,0 +1,31 @@ +import { defineConfig } from 'vite' +import baseConfig from './vite.config.js' + +export default defineConfig({ + ...baseConfig, + css: { + ...baseConfig.css, + preprocessorOptions: { + ...baseConfig.css.preprocessorOptions, + scss: { + api: 'modern-compiler', + additionalData: `$injectedColor: orange;`, + importers: [ + { + canonicalize(url) { + return url === 'virtual-dep' + ? new URL('custom-importer:virtual-dep') + : null + }, + load() { + return { + contents: ``, + syntax: 'scss', + } + }, + }, + ], + }, + }, + }, +}) diff --git a/playground/css/vite.config-sass-modern.js b/playground/css/vite.config-sass-modern.js index 9f7acb3a098179..9759d58506f597 100644 --- a/playground/css/vite.config-sass-modern.js +++ b/playground/css/vite.config-sass-modern.js @@ -8,7 +8,7 @@ export default defineConfig({ preprocessorOptions: { ...baseConfig.css.preprocessorOptions, scss: { - api: 'modern', + api: 'modern-compiler', additionalData: `$injectedColor: orange;`, importers: [ { diff --git a/playground/vitestGlobalSetup.ts b/playground/vitestGlobalSetup.ts index 1cf405f84120fd..b884df52160187 100644 --- a/playground/vitestGlobalSetup.ts +++ b/playground/vitestGlobalSetup.ts @@ -45,6 +45,10 @@ export async function setup({ provide }: GlobalSetupContext): Promise { path.resolve(tempDir, 'css'), path.resolve(tempDir, 'css__sass-modern'), ) + await fs.copy( + path.resolve(tempDir, 'css'), + path.resolve(tempDir, 'css__sass-modern-compiler'), + ) } export async function teardown(): Promise {