1
0
Fork 0

chore: Updated mocha settins and added terser reporter

This commit is contained in:
Joost De Cock 2022-02-19 09:48:23 +01:00
parent 952d83d93f
commit e817e1bd47
2 changed files with 24 additions and 11 deletions

View file

@ -2,7 +2,7 @@ _:
clean: 'rimraf dist' clean: 'rimraf dist'
build: 'rollup -c' build: 'rollup -c'
cibuild_step1: 'rollup -c' cibuild_step1: 'rollup -c'
test: 'echo "{{name}}: No tests configured. Perhaps you''d like to do this?" && exit 0' test: &notests 'echo "{{name}}: No tests configured. Perhaps you''d like to do this?" && exit 0'
pubtest: 'npm publish --registry http://localhost:6662' pubtest: 'npm publish --registry http://localhost:6662'
pubforce: 'npm publish' pubforce: 'npm publish'
symlink: 'mkdir -p ./node_modules/@freesewing && cd ./node_modules/@freesewing && ln -s -f ../../../* . && cd -' symlink: 'mkdir -p ./node_modules/@freesewing && cd ./node_modules/@freesewing && ln -s -f ../../../* . && cd -'
@ -10,11 +10,11 @@ _:
_types: _types:
pattern: pattern:
netlify: 'echo "Not configured yet"' netlify: 'echo "Not configured yet"'
test: 'BABEL_ENV=production ../../node_modules/.bin/_mocha tests/*.test.mjs --require @babel/register' test: &test 'BABEL_ENV=production ../../node_modules/.bin/_mocha tests/*.test.mjs --require @babel/register'
testci: 'BABEL_ENV=production ./node_modules/.bin/_mocha tests/*.test.mjs --require @babel/register' testci: &testci "BABEL_ENV=production ../../node_modules/.bin/_mocha tests/*.test.mjs --require @babel/register --jobs 4 --parallel --reporter ../../tests/reporters/terse.js"
plugin: plugin:
test: 'BABEL_ENV=production ../../node_modules/.bin/_mocha tests/*.test.mjs --require @babel/register' test: *test
testci: 'BABEL_ENV=production ../../node_modules/.bin/_mocha tests/*.test.mjs --require @babel/register' testci: *testci
prettier: "npx prettier --write 'src/*.js' 'tests/*.mjs'" prettier: "npx prettier --write 'src/*.js' 'tests/*.mjs'"
create-freesewing-pattern: create-freesewing-pattern:
clean: '!' clean: '!'
@ -22,14 +22,14 @@ create-freesewing-pattern:
modulebuild: '!' modulebuild: '!'
cibuild_step1: '!' cibuild_step1: '!'
build: '!' build: '!'
test: 'BABEL_ENV=production ../../node_modules/.bin/_mocha tests/*.test.mjs' test: *test
testci: 'BABEL_ENV=production ../../node_modules/.bin/_mocha tests/*.test.mjs' testci: *testci
css-theme: css-theme:
cibuild_step1: 'npx node-sass --output-style compressed src/theme.scss dist/theme.css' cibuild_step1: 'npx node-sass --output-style compressed src/theme.scss dist/theme.css'
build: 'npx node-sass --output-style compressed src/theme.scss dist/theme.css' build: 'npx node-sass --output-style compressed src/theme.scss dist/theme.css'
watch: 'npx node-sass --watch --output-style compressed src/theme.scss dist/theme.css' watch: 'npx node-sass --watch --output-style compressed src/theme.scss dist/theme.css'
components: components:
test: 'echo "{{name}}: No tests configured. Perhaps you''d like to do this?" && exit 0' test: *notests
storybook: 'start-storybook -p 6663' storybook: 'start-storybook -p 6663'
# react-scripts doesn't handle .mjs files correctly # react-scripts doesn't handle .mjs files correctly
modulebuild: '!' modulebuild: '!'
@ -40,14 +40,14 @@ components:
core: core:
testonly: 'BABEL_ENV=production mocha tests/*.test.js' testonly: 'BABEL_ENV=production mocha tests/*.test.js'
test: 'BABEL_ENV=production nyc -x node_modules -x tests/fixtures -x bin-pack mocha tests/*.test.js' test: 'BABEL_ENV=production nyc -x node_modules -x tests/fixtures -x bin-pack mocha tests/*.test.js'
testci: 'BABEL_ENV=production nyc -x node_modules -x tests/fixtures -x bin-pack mocha tests/*.test.js' testci: "BABEL_ENV=production ../../node_modules/.bin/_mocha tests/*.test.js --require @babel/register --jobs 4 --parallel --reporter ../../tests/reporters/terse.js"
report: 'BABEL_ENV=production nyc report --reporter=html' report: 'BABEL_ENV=production nyc report --reporter=html'
coverage: 'BABEL_ENV=production nyc npm test && nyc report --reporter=text-lcov > coverage.lcov && ./node_modules/.bin/codecov' coverage: 'BABEL_ENV=production nyc npm test && nyc report --reporter=text-lcov > coverage.lcov && ./node_modules/.bin/codecov'
i18n: i18n:
# react-scripts doesn't handle .mjs files correctly # react-scripts doesn't handle .mjs files correctly
modulebuild: '!' modulebuild: '!'
test: 'BABEL_ENV=production ../../node_modules/.bin/_mocha tests/*.test.js --require @babel/register' test: *test
testci: 'BABEL_ENV=production ../../node_modules/.bin/_mocha tests/*.test.js --require @babel/register' testci: *testci
prebuild: 'node src/prebuild.mjs' prebuild: 'node src/prebuild.mjs'
pattern-info: pattern-info:
cibuild_step1: '!' cibuild_step1: '!'

13
tests/reporters/terse.js Normal file
View file

@ -0,0 +1,13 @@
const Mocha = require('mocha')
const { EVENT_TEST_FAIL } = Mocha.Runner.constants
// This output very little info and is intended for CI runs
class TerseReporter {
constructor(runner) {
runner.on(EVENT_TEST_FAIL, (test, err) => {
console.log(` FAIL: ${test.fullTitle()}`)
})
}
}
module.exports = TerseReporter