Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify configuration and how the preset gets its config values #15

Merged
merged 4 commits into from
Feb 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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