Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
abhishekkrthakur committed Dec 18, 2024
1 parent a9c2a1a commit 811b29a
Show file tree
Hide file tree
Showing 11 changed files with 867 additions and 6 deletions.
9 changes: 9 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"presets": [
["@babel/preset-env", {
"targets": {
"node": "current"
}
}]
]
}
44 changes: 44 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Test

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
test:
runs-on: ubuntu-latest

services:
vllm:
image: vllm/vllm-openai:latest
options: >-
--ipc=host
env:
MODEL: HuggingFaceTB/SmolLM2-135M-Instruct
ports:
- 8000:8000

steps:
- uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Wait for vLLM to be ready
run: |
timeout 300 bash -c '
until curl -s http://localhost:8000/health; do
echo "Waiting for vLLM..."
sleep 5
done'
- name: Run tests
run: npm test
12 changes: 12 additions & 0 deletions babel.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
presets: [
['@babel/preset-env', {
targets: {
node: 'current'
}
}]
],
plugins: [
'@babel/plugin-transform-modules-commonjs'
]
};
14 changes: 14 additions & 0 deletions jest.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
testEnvironment: 'jsdom',
transform: {
'^.+\\.js$': ['babel-jest', { configFile: './babel.config.cjs' }]
},
moduleNameMapper: {
'\\.(css|less)$': '<rootDir>/tests/mocks/styleMock.cjs'
},
setupFiles: ['<rootDir>/tests/setup.js'],
testMatch: ['**/__tests__/**/*.js', '**/?(*.)+(spec|test).js'],
transformIgnorePatterns: [
'node_modules/(?!(module-that-needs-to-be-transformed)/)'
]
};
Loading

0 comments on commit 811b29a

Please sign in to comment.