Skip to content

Commit

Permalink
chore: normalize test config (#643)
Browse files Browse the repository at this point in the history
- Upgrades `ava`.
- Renames all test file extensions to `.spec.js`.
- Relocate all Ava config into the `package.json` of each workspace.
- Change some commented-out tests to skipped tests.
- Add config to run all tests via e.g. `npm exec ava` from the workspace root
  • Loading branch information
boneskull committed Aug 21, 2023
1 parent 6ef1593 commit b941c04
Show file tree
Hide file tree
Showing 50 changed files with 232 additions and 332 deletions.
145 changes: 9 additions & 136 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"@commitlint/cli": "^17.6.7",
"@commitlint/config-conventional": "^17.6.7",
"@metamask/eslint-config-nodejs": "^11.0.1",
"ava": "^5.2.0",
"ava": "^5.3.1",
"conventional-changelog-conventionalcommits": "^6.1.0",
"cross-env": "^7.0.3",
"depcheck": "^1.4.0",
Expand Down Expand Up @@ -52,5 +52,11 @@
"lerna>nx>@parcel/watcher": false,
"$root$": true
}
},
"ava": {
"files": [
"packages/*/test/*.spec.js"
],
"timeout": "2m"
}
}
8 changes: 7 additions & 1 deletion packages/aa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"scripts": {
"test": "npm run test:run",
"test:run": "ava --timeout=30s test/index.js",
"test:run": "ava",
"lint": "npm run lint:eslint && npm run lint:deps",
"lint:eslint": "eslint .",
"lint:fix": "eslint . --fix",
Expand All @@ -33,5 +33,11 @@
"author": "kumavis",
"engines": {
"node": ">=14.0.0"
},
"ava": {
"files": [
"test/*.spec.js"
],
"timeout": "30s"
}
}
File renamed without changes.
10 changes: 8 additions & 2 deletions packages/allow-scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
},
"scripts": {
"test": "npm run test:run",
"test:run": "ava --timeout=30s test/index.js",
"test:run": "ava",
"test:prep": "for d in ./test/projects/*/ ; do (cd \"$d\" && ../../../src/cli.js auto --experimental-bins); done",
"lint": "npm run lint:eslint && npm run lint:deps",
"lint:eslint": "eslint .",
Expand All @@ -48,5 +48,11 @@
"homepage": "https://github.com/LavaMoat/LavaMoat/tree/main/packages/allow-scripts",
"engines": {
"node": ">=14.0.0"
}
},
"ava": {
"files": [
"test/*.spec.js"
],
"timeout": "30s"
}
}
File renamed without changes.
7 changes: 0 additions & 7 deletions packages/browserify/ava.config.cjs

This file was deleted.

9 changes: 8 additions & 1 deletion packages/browserify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"watchify": "^4.0.0"
},
"scripts": {
"test": "ava --timeout 2m --concurrency 1",
"test": "ava",
"test:prep": "WRITE_AUTO_POLICY=1 ./test/fixtures/secureBundling/run.sh",
"lint": "npm run lint:eslint && npm run lint:deps",
"lint:eslint": "eslint .",
Expand All @@ -61,5 +61,12 @@
"allowScripts": {
"keccak": false
}
},
"ava": {
"files": [
"test/*.spec.js"
],
"timeout": "2m",
"concurrency": 1
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 7 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"lint:eslint": "eslint .",
"lint:fix": "eslint --fix .",
"lint:deps": "depcheck",
"test": "ava --timeout=30s test/index.js",
"test": "ava",
"lib:ses": "echo 'disabled SES overwrite in this branch'; exit 1 #cp ../../node_modules/ses/dist/lockdown.umd.js ./lib/lockdown.umd.js"
},
"author": "kumavis",
Expand All @@ -42,5 +42,11 @@
"templateRequire": "readonly",
"lockdown": "readonly"
}
},
"ava": {
"files": [
"test/*.spec.js"
],
"timeout": "30s"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 0 additions & 7 deletions packages/core/test/index.js

This file was deleted.

File renamed without changes.
File renamed without changes.
10 changes: 7 additions & 3 deletions packages/lavapack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@
"lint:eslint": "eslint .",
"lint:fix": "eslint . --fix",
"lint:deps": "depcheck",
"test": "npm run test:ava && npm run test:ecma",
"test:ava": "ava --timeout=30s test/index.js",
"test:ecma": "node test/runtimeEcma.js",
"test": "ava",
"rebuild": "npm run build",
"build": "node ./src/build-runtime.js"
},
Expand All @@ -46,5 +44,11 @@
"url": "https://github.com/LavaMoat/lavamoat/issues"
},
"homepage": "https://github.com/LavaMoat/lavamoat#readme",
"ava": {
"files": [
"test/*.spec.js"
],
"timeout": "30s"
},
"gitHead": "28a238fc4c3d55650bd2ba9a3603b1f275567286"
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const test = require('ava')
const { pipe, from, concat } = require('mississippi')
const { SourceMapConsumer } = require('source-map')
const convertSourceMap = require('convert-source-map')
const pack = require('../')
const pack = require('../src')


test('dummy test', (t) => {
Expand Down Expand Up @@ -70,7 +70,7 @@ test('sourcemap test', async (t) => {
const bundleLine = bundleString.split('\n')[bundleStartPos.line - 1]
console.log(`${sourceFile}:\n${bundleLine}`)
})

consumer.destroy()
t.pass('no error thrown')
})
Expand All @@ -89,4 +89,4 @@ function deferred () {
}
})
return result
}
}
18 changes: 0 additions & 18 deletions packages/lavapack/test/runtimeEcma.js

This file was deleted.

Loading

0 comments on commit b941c04

Please sign in to comment.