Skip to content

Commit

Permalink
Merge branch 'vitest'
Browse files Browse the repository at this point in the history
Add vitest and small testing suite.
  • Loading branch information
bnjmnrsh committed Jan 18, 2024
2 parents 7009ffc + c2c9e9c commit 178363a
Show file tree
Hide file tree
Showing 12 changed files with 3,496 additions and 917 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ dist/

# Unit test reports
TEST*.xml
coverage/

# Generated by MacOS
.DS_Store
Expand Down
2,846 changes: 2,602 additions & 244 deletions package-lock.json

Large diffs are not rendered by default.

14 changes: 10 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{
"name": "searchlights.js",
"version": "0.0.2",
"version": "0.0.3",
"description": "A js plugin to turn your cursor into an array of searchlights.",
"source": "src/searchlights.js",
"main": "dist/searchlights.js",
"scripts": {
"build": "rollup -c",
"help": "rollup --help"
"help": "rollup --help",
"test": "vitest --coverage --pool=forks",
"update-tests": "vitest -u --coverage --pool=forks"
},
"browserslist": "> 0.5%, last 2 versions, not dead",
"repository": {
Expand All @@ -21,21 +23,25 @@
"name": "bnjmnrsh",
"website": "https://github.com/bnjmnrsh/searchlights"
},
"license": "WTFPL",
"license": "MIT",
"bugs": {
"url": "https://github.com/bnjmnrsh/searchlights/issues"
},
"homepage": "https://github.com/bnjmnrsh/searchlights#readme",
"devDependencies": {
"@rollup/plugin-terser": "^0.4.4",
"@vitest/coverage-v8": "^1.2.1",
"canvas": "^2.11.2",
"eslint": "^7.18.0",
"eslint-config-prettier": "^7.2.0",
"eslint-config-standard": "^16.0.2",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"jsdom": "^23.2.0",
"prettier": "^2.2.1",
"rollup": "^4.9.5",
"rollup-plugin-banner": "^0.2.1"
"rollup-plugin-banner": "^0.2.1",
"vitest": "^1.2.1"
}
}
10 changes: 9 additions & 1 deletion rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const pkg = JSON.parse(
// Configs
const configs = {
name: pkg.name,
files: ['searchlights.js'],
files: ['searchlights.js', 'searchlights.mjs'],
formats: ['iife'], //, 'es', 'amd', 'cjs'
default: 'iife',
pathIn: 'src/',
Expand Down Expand Up @@ -36,6 +36,12 @@ const createOutput = function (filename, minify) {
output.name = configs.name ? configs.name : pkg.name
output.name = output.name.trim().replace(/\W+/g, '_')
}
// A quick intervention for our one mjs file.
if (filename.includes('.mjs')) {
minify = false
output.format = 'es'
output.file = `${configs.pathOut}/${filename}`
}
if (minify) {
output.plugins = [terser()]
}
Expand Down Expand Up @@ -66,6 +72,8 @@ const createOutputs = function (filename) {

/**
* Create export object
*
* @param {*} file
* @return {Array} The export object
*/
const createExport = function (file) {
Expand Down
Loading

0 comments on commit 178363a

Please sign in to comment.