diff --git a/.changeset/odd-trainers-exercise.md b/.changeset/odd-trainers-exercise.md new file mode 100644 index 0000000..c4dc410 --- /dev/null +++ b/.changeset/odd-trainers-exercise.md @@ -0,0 +1,7 @@ +--- +"cachu": patch +--- + +refactor: edit testing + +Edit Jest config and test script, and add a `test` workflow. diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..6c34b62 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,34 @@ +name: 'Test' + +on: [ 'push', 'pull_request' ] + +jobs: + publish: + name: 'Test' + runs-on: 'ubuntu-latest' + steps: + - name: 'Git Checkout' + uses: 'actions/checkout@v3' + + - name: 'Setup Node.js' + uses: 'actions/setup-node@v3' + with: + node-version: '18.x' + cache: 'npm' + + - uses: 'actions/cache@v3' + id: 'cache' + with: + path: | + node_modules + */*/node_modules + key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: 'Install Dependencies' + if: steps.cache.outputs.cache-hit != 'true' + run: 'npm ci' + + - name: 'Test' + run: 'npm test' diff --git a/jest.config.json b/jest.config.json new file mode 100644 index 0000000..2717f58 --- /dev/null +++ b/jest.config.json @@ -0,0 +1,4 @@ +{ + "preset": "ts-jest", + "testEnvironment": "node" +} diff --git a/jest.config.ts b/jest.config.ts deleted file mode 100644 index 045354b..0000000 --- a/jest.config.ts +++ /dev/null @@ -1,4 +0,0 @@ -export default { - preset: 'ts-jest', - testEnvironment: 'node' -} diff --git a/package.json b/package.json index 72eb221..0d08d36 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "lint": "eslint src", "format": "eslint src --fix", "build": "empty dist && esbuild src/index.ts --bundle --minify --format=esm --legal-comments=none --outfile=dist/index.js", - "test": "jest" + "test": "jest --config jest.config.json" }, "license": "Apache-2.0", "repository": "azurystudio/cachu",