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

Foundation for test files to use TypeScript #85

Merged
merged 1 commit into from
Jan 17, 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
1 change: 1 addition & 0 deletions .eslintignore-js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules
packages/*
!packages/check-compose
packages/check-compose/index.js
packages/*/__test__/*
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,6 @@ Session.vim

# Typescript
*.tsbuildinfo

##### VS Code
*.code-workspace
195 changes: 195 additions & 0 deletions package-lock.json

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

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
"ci": "npm run test",
"test": "jest",
"posttest": "npm run lint",
"postinstall": "npm run bootstrap & npm run build-clean",
"bootstrap": "lerna bootstrap",
"postinstall": "npm run build-clean",
"publish": "lerna publish -i -- --access=public",
"updated": "lerna updated",
"clean": "lerna clean",
Expand All @@ -38,6 +37,7 @@
"node": ">= 10.18.0"
},
"devDependencies": {
"@types/jest": "^29.2.5",
"@typescript-eslint/eslint-plugin": "^5.48.0",
"@typescript-eslint/parser": "^5.48.0",
"del-cli": "^3.0.0",
Expand All @@ -53,9 +53,11 @@
"jest": "^29.3.1",
"lerna": "^6.4.0",
"prettier": "^2.8.2",
"ts-jest": "^29.0.5",
"typescript": "^4.9.4"
},
"jest": {
"preset": "ts-jest",
"testEnvironment": "node",
"coverageReporters": [
"html",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@

'use strict';

const fs = require('fs');
const test = require('tape');
import fs from 'fs';
import ttest from 'tape';

module.exports = (compose) => {
function checkCompose<CM>(compose: CM) {
if (typeof compose !== 'function') throw new Error('"compose" must be a function');

const files = fs.readdirSync(__dirname).filter(RegExp.prototype.test.bind(/.+-tests\.js$/));

const failures = [];
const failures: any[] = [];

return new Promise((resolve) => {
test
ttest
.createStream({ objectMode: true })
.on('data', (assert) => {
if (assert.error) failures.push(assert);
Expand All @@ -28,3 +28,8 @@ module.exports = (compose) => {
});
});
};

export default checkCompose;

module.exports = checkCompose;
Object.defineProperty(module.exports, 'default', { enumerable: false, value: checkCompose });
7 changes: 7 additions & 0 deletions packages/check-compose/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,16 @@
"bin": {
"check-compose": "./bin/check-compose.js"
},
"scripts": {
"build": "tsc",
"link": "npm run build && lerna link"
},
"dependencies": {
"lodash": "^4.17.15",
"prettyjson": "^1.2.1",
"tape": "^4.11.0"
},
"devDependencies": {
"@types/tape": "^4.13.2"
}
}
Loading