ci: write ava.config for ava@2

This commit is contained in:
LongYinan 2020-10-14 11:44:37 +08:00
parent 826ebd9847
commit 24919d72be
No known key found for this signature in database
GPG key ID: A3FFE134A3E20881
4 changed files with 27 additions and 0 deletions

View file

@ -5,6 +5,7 @@ parserOptions:
jsx: true
ecmaVersion: 2020
sourceType: module
extraFileExtensions: ['.cjs']
project: ./tsconfig.json
env:
@ -220,3 +221,10 @@ overrides:
- '@typescript-eslint'
parserOptions:
project: ./bench/tsconfig.json
- files:
- ./*.{cjs,js}
plugins:
- '@typescript-eslint'
parserOptions:
project: ./tsconfig.root-lint.json

View file

@ -73,6 +73,11 @@ jobs:
command: test
args: -p napi-sys --lib -- --nocapture
- name: Write ava.config.js for ava@2
run: |
node write-ava-config.js
cat ava.config.js
- name: Unit tests
run: |
yarn --cwd ./test_module --ignore-engines build

4
tsconfig.root-lint.json Normal file
View file

@ -0,0 +1,4 @@
{
"extends": "./tsconfig.json",
"files": ["./ava.config.cjs", "./write-ava-config.js"]
}

10
write-ava-config.js Normal file
View file

@ -0,0 +1,10 @@
const { writeFileSync } = require('fs')
const { join } = require('path')
const config = require('./ava.config.cjs')
const code = `
export default ${JSON.stringify(config, null, 2)}
`
writeFileSync(join(__dirname, 'ava.config.js'), code)