Skip to content

Commit

Permalink
code review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
mrm007 committed Feb 4, 2024
1 parent b73747d commit dbf178d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/integration/src/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ const scanModule = (entryModule: ModuleNode) => {
const watchFiles = new Set<string>();

for (const moduleNode of queue) {
if (!moduleNode.id || moduleNode.id.includes('@vanilla-extract/')) {
if (moduleNode.id?.includes('@vanilla-extract/')) {
continue;
}

if (cssFileFilter.test(moduleNode.id)) {
if (moduleNode.id && cssFileFilter.test(moduleNode.id)) {
cssDeps.add(moduleNode.id);
}
if (moduleNode.file) {
Expand Down
6 changes: 3 additions & 3 deletions tests/compiler/compiler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ describe('compiler', () => {

test('throws on getCssForFile when file does not exist', async () => {
const compiler = compilers.default;
let error: Error | undefined;
let error: Error;

try {
compiler.getCssForFile('does-not-exist.css.ts');
Expand All @@ -234,8 +234,8 @@ describe('compiler', () => {
}

expect(
// We know `error.message` is defined, and we want make the snapshot consistent across machines
normalizePath(error!.message!.replace(__dirname, '{{__dirname}}')),
// We know `error.message` is defined here
normalizePath(error!.message),
).toMatchInlineSnapshot(
`No CSS for file: {{__dirname}}/does-not-exist.css.ts`,
);
Expand Down
2 changes: 2 additions & 0 deletions tests/compiler/compiler.vitest.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ expect.addSnapshotSerializer({
'"',
});

// ! These tests are to ensure that the compiler works correctly in Vitest.
// ! Please add tests to `compiler.test.ts` going forward.
describe('compiler running in Vitest', () => {
let compilers: Record<
'default' | 'vitePlugins' | 'viteResolve',
Expand Down
2 changes: 1 addition & 1 deletion tests/compiler/fixtures/tsconfig-paths/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { box } from 'main.css';

document.getElementById('root')!.innerHTML = `
<div class=${box}>hello world</div>
<div class="${box}">hello world</div>
`;

0 comments on commit dbf178d

Please sign in to comment.