Skip to content

Commit

Permalink
chore: fix ci
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaohuoni authored May 11, 2023
1 parent fb09425 commit 0dfecfc
Showing 1 changed file with 12 additions and 18 deletions.
30 changes: 12 additions & 18 deletions tests/doctor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,32 +30,30 @@ test('doctor: warn checkups', async () => {
});

// DUP_IN_PEER_DEPS
expect(console.log).toHaveBeenCalledWith(
expect(logSpy).toHaveBeenCalledWith(
expect.stringContaining('peerDependency'),
);

// EFFECTS_IN_SIDE_EFFECTS
expect(console.log).toHaveBeenCalledWith(
expect(logSpy).toHaveBeenCalledWith(
expect.stringContaining('sideEffect syntax'),
);

// PREFER_BABEL_RUNTIME
expect(console.log).toHaveBeenCalledWith(
expect(logSpy).toHaveBeenCalledWith(
expect.stringContaining('@babel/runtime'),
);

// PREFER_PACK_FILES
expect(console.log).toHaveBeenCalledWith(
expect(logSpy).toHaveBeenCalledWith(
expect.stringContaining('No `files` field'),
);

// PREFER_NO_CSS_MODULES
expect(console.log).toHaveBeenCalledWith(
expect.stringContaining('CSS Modules'),
);
expect(logSpy).toHaveBeenCalledWith(expect.stringContaining('CSS Modules'));

// PREFER_PEER_DEPS
expect(console.log).toHaveBeenCalledWith(
expect(logSpy).toHaveBeenCalledWith(
expect.stringContaining('multi-instance risk'),
);
});
Expand All @@ -67,30 +65,28 @@ test('doctor: error checkups', async () => {
});

// PHANTOM_DEPS
expect(console.log).toHaveBeenCalledWith(
expect(logSpy).toHaveBeenCalledWith(
expect.stringContaining('Source depends on'),
);

// PHANTOM_DEPS no standard library
expect(console.log).toHaveBeenCalledWith(
expect(logSpy).toHaveBeenCalledWith(
expect.not.stringContaining('child_process'),
);

// EFFECTS_IN_SIDE_EFFECTS
expect(console.log).toHaveBeenCalledWith(
expect.stringContaining('styles lost'),
);
expect(logSpy).toHaveBeenCalledWith(expect.stringContaining('styles lost'));

// PACK_FILES_MISSING
expect(console.log).toHaveBeenCalledWith(
expect(logSpy).toHaveBeenCalledWith(
expect.stringContaining('will not be published'),
);

// CASE_SENSITIVE_PATHS
// why only win32 and drawin?
// because Windows and macOS are case-insensitive by default
if (['win32', 'drawin'].includes(process.platform)) {
expect(console.log).toHaveBeenCalledWith(
expect(logSpy).toHaveBeenCalledWith(
expect.stringContaining('the corresponding path'),
);
}
Expand All @@ -110,7 +106,5 @@ test('doctor: health', async () => {
args: { _: ['doctor'], $0: 'node' },
});

expect(console.log).toHaveBeenCalledWith(
expect.stringContaining('looks fine'),
);
expect(logSpy).toHaveBeenCalledWith(expect.stringContaining('looks fine'));
});

0 comments on commit 0dfecfc

Please sign in to comment.