Skip to content

Commit

Permalink
Merge pull request #15 from pitch-io/simplify-preset
Browse files Browse the repository at this point in the history
Simplify configuration and how the preset gets its config values
  • Loading branch information
jo-sm authored Feb 20, 2023
2 parents cf93af1 + d763095 commit 5d10670
Show file tree
Hide file tree
Showing 19 changed files with 181 additions and 640 deletions.
37 changes: 0 additions & 37 deletions .github/workflows/cljest-tests.yml

This file was deleted.

30 changes: 28 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "jest-preset-cljest: Lint and run tests"
name: Lint and tests

on:
push:
Expand All @@ -12,7 +12,33 @@ concurrency:
cancel-in-progress: true

jobs:
lint-and-test:
cljest-tests:
runs-on: ubuntu-latest
defaults:
run:
working-directory: cljest

steps:
- uses: actions/checkout@v3
- name: Setup java
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: '17'
- name: Setup Clojure
uses: DeLaGuardo/[email protected]
with:
cli: 1.11.1.1224
- name: Link jest-preset-cljest
run: npm link ../jest-preset-cljest
- name: Install npm dependencies
run: npm install
- name: Build Jest code
run: clojure -X cljest.compilation/compile
- name: Run cljest tests
run: npm run jest:ci

jest-preset-cljest-tests:
runs-on: ubuntu-latest
defaults:
run:
Expand Down
12 changes: 0 additions & 12 deletions cljest/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
const path = require('path')
const { getPathsFromDepsEdn } = require('jest-preset-cljest/utils')

const shadowOutputDir = path.resolve(__dirname, '.jest')

module.exports = {
setupFilesAfterEnv: [path.resolve(__dirname, 'jest.setup.js')],
testRegex: ['(.*)_spec.cljs'],
modulePaths: [shadowOutputDir],
rootDir: shadowOutputDir,
roots: getPathsFromDepsEdn(),
reporters: ['default', ['jest-junit', { outputDirectory: 'reports/jest' }]],
clearMocks: true,

globals: {
shadowOutputDir,
serverUrl: 'http://localhost:9111',
},

preset: 'jest-preset-cljest',
}
2 changes: 1 addition & 1 deletion cljest/jest.setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const path = require('path')
const fs = require('fs')
const config = require('./jest.config')

const preloadFile = path.resolve(config.globals.shadowOutputDir, 'cljest.preloads.js')
const preloadFile = path.resolve('.jest/cljest.preloads.js')

// The preloads files may not exist if the initial compilation failed
if (fs.existsSync(preloadFile)) {
Expand Down
Loading

0 comments on commit 5d10670

Please sign in to comment.