Skip to content

Commit

Permalink
chore: applying review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Hines committed Aug 15, 2023
1 parent f61fd98 commit b488dd3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
8 changes: 2 additions & 6 deletions packages/vitest/src/node/plugins/cssEnabler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { toArray } from '../../utils'
const cssLangs = '\\.(css|less|sass|scss|styl|stylus|pcss|postcss)($|\\?)'
const cssLangRE = new RegExp(cssLangs)
const cssModuleRE = new RegExp(`\\.module${cssLangs}`)
const cssInlineRE = /[?&]inline(&|$)/

function isCSS(id: string) {
return cssLangRE.test(id)
Expand All @@ -19,12 +20,7 @@ function isCSSModule(id: string) {
// inline css requests are expected to just return the
// string content directly and not the proxy module
function isInline(id: string) {
const queryStart = id.indexOf('?');
if (queryStart === -1) {
return false;
}
const queryParts = id.substring(queryStart + 1).split('&');
return queryParts.some(part => part === 'inline');
return cssInlineRE.test(id);

Check failure on line 23 in packages/vitest/src/node/plugins/cssEnabler.ts

View workflow job for this annotation

GitHub Actions / lint

Extra semicolon
}

function getCSSModuleProxyReturn(strategy: CSSModuleScopeStrategy, filename: string) {
Expand Down
6 changes: 3 additions & 3 deletions test/css/testing.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import { startVitest } from 'vitest/node'
const configs = [
['test/default-css', {}],
['test/process-css', { include: [/App\.css/] }],
['test/process-module', { include: [/App\.module\.css/] }],
['test/process-inline', { include: [/App\.module\.css/] }],
[['test/process-module', 'test/process-inline'], { include: [/App\.module\.css/] }],
['test/scope-module', { include: [/App\.module\.css/], modules: { classNameStrategy: 'scoped' } }],
['test/non-scope-module', { include: [/App\.module\.css/], modules: { classNameStrategy: 'non-scoped' } }],
]

async function runTests() {
for (const [name, config] of configs) {
await startVitest('test', [name], {
const names = Array.isArray(name) ? name : [name];
await startVitest('test', names, {
run: true,
css: config,
update: false,
Expand Down

0 comments on commit b488dd3

Please sign in to comment.