Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: reports broken tests #26

Merged
merged 3 commits into from
Mar 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions .github/workflows/pull-requests.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Pull Request Verification
name: tests

on:
push:
Expand Down Expand Up @@ -39,13 +39,10 @@ jobs:
npm i -g pnpm
pnpm install

- name: Build Browser Distribution
run: pnpm run build --if-present
- name: Lint the repo
run: pnpm run lint

- name: Run Tests
env:
CI: true
run: pnpm run test:coverage:ci

- name: Lint the repo
run: pnpm run lint
17 changes: 12 additions & 5 deletions bin/supposed.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@

const supposed = require('supposed')

supposed.Suite({ reporter: 'noop' }).runner().run()
const suite = supposed.Suite({ reporter: 'noop' })
const runner = suite.runner()
const plan = runner.plan()

plan.then(runner.runTests)
.then((results) => {
if (results.totals.failed > 0) {
if (results.broken.length > 0) {
results.broken.forEach((err) => console.log(err)) // eslint-disable-line no-console
process.exit(results.broken.length)
} else if (results.totals.failed > 0) {
process.exit(results.totals.failed)
}
}).catch((err) => {
// eslint-disable-next-line no-console
console.log(err)
})
.catch((err) => {
console.log(err) // eslint-disable-line no-console
process.exit(1)
})
56 changes: 31 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,23 @@
},
"scripts": {
"build": "node build.browser.js",
"// linting": "SECTION =====================================================",
"lint": "eslint .",
"test": "pnpm run test:ts -- -r nyan && node test-browser -r nyan && node test-examples && node test -r nyan",
"test:ts": "tsc -p ./tsconfig.json && node tests.typescript/index.js",
"test:coverage": "nyc node test.js",
"test:coverage:ci": "mkdir ./coverage && touch ./coverage/lcov.info && node test-browser.js -r tap && npm run test:ts -- -r tap && nyc node test.js -r tap,summary && nyc report --reporter=text-lcov > ./coverage/lcov.info",
"watch": "nodemon -e js --exec 'node test.js -r nyan'"
"lint:fix": "eslint . --fix",
"// testing": "SECTION =====================================================",
"test": "pnpm run test:examples && pnpm run test:ts && pnpm run test:browser && pnpm run test:cjs",
"test:ci": "pnpm run test:ts:ci && pnpm run test:browser:ci && pnpm run test:cjs:ci",
"test:browser": "node test-browser -r nyan",
"test:browser:ci": "node test-browser -r tap",
"test:cjs": "node test -r nyan",
"test:cjs:ci": "node test -r tap",
"test:examples": "node test-examples",
"test:ts": "tsc -p ./tsconfig.json && node tests.typescript/index.js -r nyan",
"test:ts:ci": "tsc -p ./tsconfig.json && node tests.typescript/index.js -r tap",
"watch": "nodemon -e js --exec 'node test.js -r nyan'",
"// coverage": "SECTION ====================================================",
"test:coverage:ci": "c8 --reporter=text --reporter=text-summary pnpm run test:ci",
"coverage:ci": "mkdir -p ./coverage && touch ./coverage/lcov.info; c8 report --reporter=text-lcov > ./coverage/lcov.info"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -44,26 +55,21 @@
},
"homepage": "https://github.com/losandes/supposed#readme",
"devDependencies": {
"@babel/core": "~7.17.9",
"@babel/preset-env": "~7.16.11",
"@types/chai": "~4.3.0",
"@types/node": "~17.0.23",
"chai": "~4.3.6",
"eslint": "~8.10.0",
"eslint-config-standard": "~16.0.3",
"eslint-plugin-import": "~2.25.4",
"eslint-plugin-node": "~11.1.0",
"eslint-plugin-promise": "~6.0.0",
"nyc": "~15.1.0",
"puppeteer": "~13.4.1",
"@babel/core": "^7.21.0",
"@babel/preset-env": "^7.20.2",
"@types/chai": "^4.3.4",
"@types/node": "^18.14.4",
"c8": "^7.13.0",
"chai": "^4.3.7",
"eslint": "^8.35.0",
"eslint-config-standard": "^17.0.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-n": "^15.6.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^6.1.1",
"puppeteer": "^19.7.2",
"supposed": "link:",
"tap-parser": "~11.0.1",
"typescript": "~4.6.3"
},
"pnpm": {
"overrides": {
"shelljs@<0.8.5": ">=0.8.5",
"minimist@<1.2.6": ">=1.2.6"
}
"tap-parser": "^12.0.1",
"typescript": "^4.9.5"
}
}
Loading