Skip to content

Commit

Permalink
Fix AVA config
Browse files Browse the repository at this point in the history
  • Loading branch information
pokusew committed Apr 15, 2023
1 parent b5a0b30 commit 171ba7f
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 60 deletions.
13 changes: 6 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,12 @@ jobs:
# (see https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md)
run: yarn --frozen-lockfile

# TODO: re-enable once we fix AVA config
# - name: Run unit tests
# # https://askubuntu.com/a/731237
# run: |
# mkdir -p temp
# yarn test |& tee temp/ava-test-output.txt
# shell: bash
- name: Run unit tests
# https://askubuntu.com/a/731237
run: |
mkdir -p temp
yarn test |& tee temp/ava-test-output.txt
shell: bash

- name: Run ESLint
if: ${{ success() || failure() }}
Expand Down
88 changes: 36 additions & 52 deletions ava.config.js
Original file line number Diff line number Diff line change
@@ -1,61 +1,45 @@
"use strict";

// AVA configuration
// see https://github.com/avajs/ava
// see https://github.com/avajs/ava/blob/master/docs/06-configuration.md#configuration
// see https://github.com/avajs/ava/blob/master/docs/06-configuration.md#avaconfigjs
// run AVA
// npx ava --match='*foo'
// ./node_modules/.bin/ava --match='*foo'
// see https://github.com/avajs/ava/blob/main/docs/05-command-line.md

// TODO: consider using precompiled tests/sources

// noinspection JSUnusedGlobalSymbols
export default {
// see https://github.com/avajs/ava/blob/master/docs/recipes/babel.md
// see https://github.com/avajs/babel
babel: {
compileEnhancements: false, // we add them ourselves below via @ava/babel/transform-test-files
extensions: [
'ts',
],
testOptions: {
babelrc: false,
configFile: false,
presets: [
[
'module:@ava/babel/stage-4',
false,
],
[
'@babel/preset-env',
{
targets: {
node: 'current',
},
// see https://babeljs.io/docs/en/babel-preset-env#browserslist-integration
ignoreBrowserslistConfig: true,
useBuiltIns: 'usage',
corejs: 3,
debug: false,
},
],
'@babel/preset-typescript',
// '@babel/preset-react',
'@ava/babel/transform-test-files',
],
},
// https://github.com/avajs/ava/blob/main/docs/06-configuration.md
module.exports = {
// https://github.com/avajs/ava/blob/main/docs/recipes/typescript.md
extensions: {
// https://github.com/avajs/ava/blob/main/docs/06-configuration.md#configuring-module-formats
js: true,
ts: 'commonjs',
},
// extensions: ['.js', '.ts'],
require: [
'./test/_register.js',
],
files: [
'test/**/*',
'./test/**/*',
],
// to see what triggered the the rests to rerun:
// DEBUG=ava:watcher npx ava --verbose --watch
ignoredByWatcher: [
'**/.idea/**/*', // .idea/workspace.xml is changed on every file edit
'**/node_modules/**/*',
'temp/**/*',
'dist/**/*',
],
require: [
// this will transpile all source code files (app/
'./test/_register.js',
//
// some files and directories are ignored by default,
// see https://github.com/avajs/ava/blob/main/docs/recipes/watch-mode.md#ignoring-changes
//
// note:
// AVA dependency tracking (https://github.com/avajs/ava/blob/main/docs/recipes/watch-mode.md#dependency-tracking)
// currently does not work with native ES modules.
// See
// https://github.com/avajs/ava/issues/2388
// https://github.com/avajs/ava/pull/3123
// https://github.com/avajs/ava/issues/2905
//
// use the following to debug:
// DEBUG=ava:watcher npx ava --watch
// or
// DEBUG=ava:* npx ava --watch
//
'./.idea/',
'./temp/',
'./dist/',
],
};
1 change: 0 additions & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ module.exports = api => ({
ignore: [
'**/*.no-babel.js',
/node_modules/,
/test\//,
'**/dist',
],
sourceMaps: true,
Expand Down

0 comments on commit 171ba7f

Please sign in to comment.