End-to-end CLI tests
This commit is contained in:
parent
1f3ecb5c58
commit
4d88dac40a
15 changed files with 343 additions and 7 deletions
64
package-lock.json
generated
64
package-lock.json
generated
|
@ -9,7 +9,6 @@
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@jscad/openjscad": "github:mrzealot/oldjscad",
|
"@jscad/openjscad": "github:mrzealot/oldjscad",
|
||||||
"chai-as-promised": "^7.1.1",
|
|
||||||
"fs-extra": "^9.0.1",
|
"fs-extra": "^9.0.1",
|
||||||
"js-yaml": "^3.14.0",
|
"js-yaml": "^3.14.0",
|
||||||
"kle-serial": "github:mrzealot/kle-serial",
|
"kle-serial": "github:mrzealot/kle-serial",
|
||||||
|
@ -24,6 +23,8 @@
|
||||||
"@rollup/plugin-commonjs": "^13.0.2",
|
"@rollup/plugin-commonjs": "^13.0.2",
|
||||||
"@rollup/plugin-replace": "^2.3.3",
|
"@rollup/plugin-replace": "^2.3.3",
|
||||||
"chai": "^4.2.0",
|
"chai": "^4.2.0",
|
||||||
|
"chai-as-promised": "^7.1.1",
|
||||||
|
"dir-compare": "^3.3.0",
|
||||||
"glob": "^7.1.6",
|
"glob": "^7.1.6",
|
||||||
"mocha": "^8.1.3",
|
"mocha": "^8.1.3",
|
||||||
"nyc": "^15.1.0",
|
"nyc": "^15.1.0",
|
||||||
|
@ -833,6 +834,7 @@
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz",
|
||||||
"integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==",
|
"integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==",
|
||||||
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "*"
|
"node": "*"
|
||||||
}
|
}
|
||||||
|
@ -932,6 +934,15 @@
|
||||||
"url": "https://opencollective.com/browserslist"
|
"url": "https://opencollective.com/browserslist"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/buffer-equal": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/buffer-equal/-/buffer-equal-1.0.0.tgz",
|
||||||
|
"integrity": "sha1-WWFrSYME1Var1GaWayLu2j7KX74=",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/caching-transform": {
|
"node_modules/caching-transform": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/caching-transform/-/caching-transform-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/caching-transform/-/caching-transform-4.0.0.tgz",
|
||||||
|
@ -969,6 +980,7 @@
|
||||||
"version": "4.3.4",
|
"version": "4.3.4",
|
||||||
"resolved": "https://registry.npmjs.org/chai/-/chai-4.3.4.tgz",
|
"resolved": "https://registry.npmjs.org/chai/-/chai-4.3.4.tgz",
|
||||||
"integrity": "sha512-yS5H68VYOCtN1cjfwumDSuzn/9c+yza4f3reKXlE5rUg7SFcCEy90gJvydNgOYtblyf4Zi6jIWRnXOgErta0KA==",
|
"integrity": "sha512-yS5H68VYOCtN1cjfwumDSuzn/9c+yza4f3reKXlE5rUg7SFcCEy90gJvydNgOYtblyf4Zi6jIWRnXOgErta0KA==",
|
||||||
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"assertion-error": "^1.1.0",
|
"assertion-error": "^1.1.0",
|
||||||
"check-error": "^1.0.2",
|
"check-error": "^1.0.2",
|
||||||
|
@ -985,6 +997,7 @@
|
||||||
"version": "7.1.1",
|
"version": "7.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/chai-as-promised/-/chai-as-promised-7.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/chai-as-promised/-/chai-as-promised-7.1.1.tgz",
|
||||||
"integrity": "sha512-azL6xMoi+uxu6z4rhWQ1jbdUhOMhis2PvscD/xjLqNMkv3BPPp2JyyuTHOrf9BOosGpNQ11v6BKv/g57RXbiaA==",
|
"integrity": "sha512-azL6xMoi+uxu6z4rhWQ1jbdUhOMhis2PvscD/xjLqNMkv3BPPp2JyyuTHOrf9BOosGpNQ11v6BKv/g57RXbiaA==",
|
||||||
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"check-error": "^1.0.2"
|
"check-error": "^1.0.2"
|
||||||
},
|
},
|
||||||
|
@ -1024,6 +1037,7 @@
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz",
|
||||||
"integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=",
|
"integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=",
|
||||||
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "*"
|
"node": "*"
|
||||||
}
|
}
|
||||||
|
@ -1225,6 +1239,7 @@
|
||||||
"version": "3.0.1",
|
"version": "3.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz",
|
||||||
"integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==",
|
"integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==",
|
||||||
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"type-detect": "^4.0.0"
|
"type-detect": "^4.0.0"
|
||||||
},
|
},
|
||||||
|
@ -1264,6 +1279,16 @@
|
||||||
"node": ">=0.3.1"
|
"node": ">=0.3.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/dir-compare": {
|
||||||
|
"version": "3.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/dir-compare/-/dir-compare-3.3.0.tgz",
|
||||||
|
"integrity": "sha512-J7/et3WlGUCxjdnD3HAAzQ6nsnc0WL6DD7WcwJb7c39iH1+AWfg+9OqzJNaI6PkBwBvm1mhZNL9iY/nRiZXlPg==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"buffer-equal": "^1.0.0",
|
||||||
|
"minimatch": "^3.0.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/electron-to-chromium": {
|
"node_modules/electron-to-chromium": {
|
||||||
"version": "1.3.778",
|
"version": "1.3.778",
|
||||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.778.tgz",
|
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.778.tgz",
|
||||||
|
@ -1493,6 +1518,7 @@
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz",
|
||||||
"integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=",
|
"integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=",
|
||||||
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "*"
|
"node": "*"
|
||||||
}
|
}
|
||||||
|
@ -2551,6 +2577,7 @@
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz",
|
||||||
"integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==",
|
"integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==",
|
||||||
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "*"
|
"node": "*"
|
||||||
}
|
}
|
||||||
|
@ -2966,6 +2993,7 @@
|
||||||
"version": "4.0.8",
|
"version": "4.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz",
|
"resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz",
|
||||||
"integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==",
|
"integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==",
|
||||||
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=4"
|
"node": ">=4"
|
||||||
}
|
}
|
||||||
|
@ -3962,7 +3990,8 @@
|
||||||
"assertion-error": {
|
"assertion-error": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz",
|
||||||
"integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw=="
|
"integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"astring": {
|
"astring": {
|
||||||
"version": "1.7.5",
|
"version": "1.7.5",
|
||||||
|
@ -4037,6 +4066,12 @@
|
||||||
"node-releases": "^1.1.71"
|
"node-releases": "^1.1.71"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"buffer-equal": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/buffer-equal/-/buffer-equal-1.0.0.tgz",
|
||||||
|
"integrity": "sha1-WWFrSYME1Var1GaWayLu2j7KX74=",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"caching-transform": {
|
"caching-transform": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/caching-transform/-/caching-transform-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/caching-transform/-/caching-transform-4.0.0.tgz",
|
||||||
|
@ -4064,6 +4099,7 @@
|
||||||
"version": "4.3.4",
|
"version": "4.3.4",
|
||||||
"resolved": "https://registry.npmjs.org/chai/-/chai-4.3.4.tgz",
|
"resolved": "https://registry.npmjs.org/chai/-/chai-4.3.4.tgz",
|
||||||
"integrity": "sha512-yS5H68VYOCtN1cjfwumDSuzn/9c+yza4f3reKXlE5rUg7SFcCEy90gJvydNgOYtblyf4Zi6jIWRnXOgErta0KA==",
|
"integrity": "sha512-yS5H68VYOCtN1cjfwumDSuzn/9c+yza4f3reKXlE5rUg7SFcCEy90gJvydNgOYtblyf4Zi6jIWRnXOgErta0KA==",
|
||||||
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"assertion-error": "^1.1.0",
|
"assertion-error": "^1.1.0",
|
||||||
"check-error": "^1.0.2",
|
"check-error": "^1.0.2",
|
||||||
|
@ -4077,6 +4113,7 @@
|
||||||
"version": "7.1.1",
|
"version": "7.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/chai-as-promised/-/chai-as-promised-7.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/chai-as-promised/-/chai-as-promised-7.1.1.tgz",
|
||||||
"integrity": "sha512-azL6xMoi+uxu6z4rhWQ1jbdUhOMhis2PvscD/xjLqNMkv3BPPp2JyyuTHOrf9BOosGpNQ11v6BKv/g57RXbiaA==",
|
"integrity": "sha512-azL6xMoi+uxu6z4rhWQ1jbdUhOMhis2PvscD/xjLqNMkv3BPPp2JyyuTHOrf9BOosGpNQ11v6BKv/g57RXbiaA==",
|
||||||
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"check-error": "^1.0.2"
|
"check-error": "^1.0.2"
|
||||||
}
|
}
|
||||||
|
@ -4105,7 +4142,8 @@
|
||||||
"check-error": {
|
"check-error": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz",
|
||||||
"integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII="
|
"integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"chokidar": {
|
"chokidar": {
|
||||||
"version": "3.5.1",
|
"version": "3.5.1",
|
||||||
|
@ -4261,6 +4299,7 @@
|
||||||
"version": "3.0.1",
|
"version": "3.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz",
|
||||||
"integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==",
|
"integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==",
|
||||||
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"type-detect": "^4.0.0"
|
"type-detect": "^4.0.0"
|
||||||
}
|
}
|
||||||
|
@ -4288,6 +4327,16 @@
|
||||||
"integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==",
|
"integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"dir-compare": {
|
||||||
|
"version": "3.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/dir-compare/-/dir-compare-3.3.0.tgz",
|
||||||
|
"integrity": "sha512-J7/et3WlGUCxjdnD3HAAzQ6nsnc0WL6DD7WcwJb7c39iH1+AWfg+9OqzJNaI6PkBwBvm1mhZNL9iY/nRiZXlPg==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"buffer-equal": "^1.0.0",
|
||||||
|
"minimatch": "^3.0.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
"electron-to-chromium": {
|
"electron-to-chromium": {
|
||||||
"version": "1.3.778",
|
"version": "1.3.778",
|
||||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.778.tgz",
|
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.778.tgz",
|
||||||
|
@ -4439,7 +4488,8 @@
|
||||||
"get-func-name": {
|
"get-func-name": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz",
|
||||||
"integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE="
|
"integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"get-package-type": {
|
"get-package-type": {
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
|
@ -5244,7 +5294,8 @@
|
||||||
"pathval": {
|
"pathval": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz",
|
||||||
"integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ=="
|
"integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"picomatch": {
|
"picomatch": {
|
||||||
"version": "2.3.0",
|
"version": "2.3.0",
|
||||||
|
@ -5551,7 +5602,8 @@
|
||||||
"type-detect": {
|
"type-detect": {
|
||||||
"version": "4.0.8",
|
"version": "4.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz",
|
"resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz",
|
||||||
"integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g=="
|
"integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"type-fest": {
|
"type-fest": {
|
||||||
"version": "0.8.1",
|
"version": "0.8.1",
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@jscad/openjscad": "github:mrzealot/oldjscad",
|
"@jscad/openjscad": "github:mrzealot/oldjscad",
|
||||||
"chai-as-promised": "^7.1.1",
|
|
||||||
"fs-extra": "^9.0.1",
|
"fs-extra": "^9.0.1",
|
||||||
"js-yaml": "^3.14.0",
|
"js-yaml": "^3.14.0",
|
||||||
"kle-serial": "github:mrzealot/kle-serial",
|
"kle-serial": "github:mrzealot/kle-serial",
|
||||||
|
@ -28,6 +27,8 @@
|
||||||
"@rollup/plugin-commonjs": "^13.0.2",
|
"@rollup/plugin-commonjs": "^13.0.2",
|
||||||
"@rollup/plugin-replace": "^2.3.3",
|
"@rollup/plugin-replace": "^2.3.3",
|
||||||
"chai": "^4.2.0",
|
"chai": "^4.2.0",
|
||||||
|
"chai-as-promised": "^7.1.1",
|
||||||
|
"dir-compare": "^3.3.0",
|
||||||
"glob": "^7.1.6",
|
"glob": "^7.1.6",
|
||||||
"mocha": "^8.1.3",
|
"mocha": "^8.1.3",
|
||||||
"nyc": "^15.1.0",
|
"nyc": "^15.1.0",
|
||||||
|
|
1
test/cli/basic/command
Normal file
1
test/cli/basic/command
Normal file
|
@ -0,0 +1 @@
|
||||||
|
node src/cli.js test/fixtures/minimal.yaml
|
13
test/cli/basic/log
Normal file
13
test/cli/basic/log
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
Ergogen v2.0.0 CLI
|
||||||
|
|
||||||
|
Interpreting format: YAML
|
||||||
|
Preprocessing input...
|
||||||
|
Calculating variables...
|
||||||
|
Parsing points...
|
||||||
|
Generating outlines...
|
||||||
|
Extruding cases...
|
||||||
|
Scaffolding PCBs...
|
||||||
|
Output would be empty, rerunning in debug mode...
|
||||||
|
Writing output to disk...
|
||||||
|
Done.
|
||||||
|
|
7
test/cli/basic/reference/canonical.yaml
Normal file
7
test/cli/basic/reference/canonical.yaml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
points:
|
||||||
|
zones:
|
||||||
|
matrix:
|
||||||
|
columns:
|
||||||
|
col: {}
|
||||||
|
rows:
|
||||||
|
row: {}
|
98
test/cli/basic/reference/points/demo.dxf
Normal file
98
test/cli/basic/reference/points/demo.dxf
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
0
|
||||||
|
SECTION
|
||||||
|
2
|
||||||
|
HEADER
|
||||||
|
9
|
||||||
|
$INSUNITS
|
||||||
|
70
|
||||||
|
4
|
||||||
|
0
|
||||||
|
ENDSEC
|
||||||
|
0
|
||||||
|
SECTION
|
||||||
|
2
|
||||||
|
TABLES
|
||||||
|
0
|
||||||
|
TABLE
|
||||||
|
2
|
||||||
|
LTYPE
|
||||||
|
0
|
||||||
|
LTYPE
|
||||||
|
72
|
||||||
|
65
|
||||||
|
70
|
||||||
|
64
|
||||||
|
2
|
||||||
|
CONTINUOUS
|
||||||
|
3
|
||||||
|
______
|
||||||
|
73
|
||||||
|
0
|
||||||
|
40
|
||||||
|
0
|
||||||
|
0
|
||||||
|
ENDTAB
|
||||||
|
0
|
||||||
|
TABLE
|
||||||
|
2
|
||||||
|
LAYER
|
||||||
|
0
|
||||||
|
ENDTAB
|
||||||
|
0
|
||||||
|
ENDSEC
|
||||||
|
0
|
||||||
|
SECTION
|
||||||
|
2
|
||||||
|
ENTITIES
|
||||||
|
0
|
||||||
|
LINE
|
||||||
|
8
|
||||||
|
0
|
||||||
|
10
|
||||||
|
-9
|
||||||
|
20
|
||||||
|
9
|
||||||
|
11
|
||||||
|
9
|
||||||
|
21
|
||||||
|
9
|
||||||
|
0
|
||||||
|
LINE
|
||||||
|
8
|
||||||
|
0
|
||||||
|
10
|
||||||
|
9
|
||||||
|
20
|
||||||
|
9
|
||||||
|
11
|
||||||
|
9
|
||||||
|
21
|
||||||
|
-9
|
||||||
|
0
|
||||||
|
LINE
|
||||||
|
8
|
||||||
|
0
|
||||||
|
10
|
||||||
|
9
|
||||||
|
20
|
||||||
|
-9
|
||||||
|
11
|
||||||
|
-9
|
||||||
|
21
|
||||||
|
-9
|
||||||
|
0
|
||||||
|
LINE
|
||||||
|
8
|
||||||
|
0
|
||||||
|
10
|
||||||
|
-9
|
||||||
|
20
|
||||||
|
-9
|
||||||
|
11
|
||||||
|
-9
|
||||||
|
21
|
||||||
|
9
|
||||||
|
0
|
||||||
|
ENDSEC
|
||||||
|
0
|
||||||
|
EOF
|
69
test/cli/basic/reference/points/demo.json
Normal file
69
test/cli/basic/reference/points/demo.json
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
{
|
||||||
|
"models": {
|
||||||
|
"export": {
|
||||||
|
"models": {
|
||||||
|
"matrix_col_row": {
|
||||||
|
"paths": {
|
||||||
|
"top": {
|
||||||
|
"type": "line",
|
||||||
|
"origin": [
|
||||||
|
-9,
|
||||||
|
9
|
||||||
|
],
|
||||||
|
"end": [
|
||||||
|
9,
|
||||||
|
9
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"right": {
|
||||||
|
"type": "line",
|
||||||
|
"origin": [
|
||||||
|
9,
|
||||||
|
9
|
||||||
|
],
|
||||||
|
"end": [
|
||||||
|
9,
|
||||||
|
-9
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"bottom": {
|
||||||
|
"type": "line",
|
||||||
|
"origin": [
|
||||||
|
9,
|
||||||
|
-9
|
||||||
|
],
|
||||||
|
"end": [
|
||||||
|
-9,
|
||||||
|
-9
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"left": {
|
||||||
|
"type": "line",
|
||||||
|
"origin": [
|
||||||
|
-9,
|
||||||
|
-9
|
||||||
|
],
|
||||||
|
"end": [
|
||||||
|
-9,
|
||||||
|
9
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"origin": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"origin": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"units": "mm",
|
||||||
|
"origin": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
]
|
||||||
|
}
|
1
test/cli/basic/reference/points/demo.svg
Normal file
1
test/cli/basic/reference/points/demo.svg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<svg width="18mm" height="18mm" viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg"><g id="svgGroup" stroke-linecap="round" fill-rule="evenodd" font-size="9pt" stroke="#000" stroke-width="0.25mm" fill="none" style="stroke:#000;stroke-width:0.25mm;fill:none"><path d="M 0 0 L 18 0 L 18 18 L 0 18 L 0 0 Z" vector-effect="non-scaling-stroke"/></g></svg>
|
After Width: | Height: | Size: 353 B |
34
test/cli/basic/reference/points/points.json
Normal file
34
test/cli/basic/reference/points/points.json
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
{
|
||||||
|
"matrix_col_row": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"r": 0,
|
||||||
|
"meta": {
|
||||||
|
"shift": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"rotate": 0,
|
||||||
|
"padding": 19,
|
||||||
|
"width": 1,
|
||||||
|
"height": 1,
|
||||||
|
"skip": false,
|
||||||
|
"asym": "both",
|
||||||
|
"name": "matrix_col_row",
|
||||||
|
"colrow": "col_row",
|
||||||
|
"col": {
|
||||||
|
"stagger": 0,
|
||||||
|
"spread": 0,
|
||||||
|
"rotate": 0,
|
||||||
|
"origin": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"rows": {},
|
||||||
|
"key": {},
|
||||||
|
"name": "col"
|
||||||
|
},
|
||||||
|
"row": "row"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
test/cli/basic/reference/raw.txt
Normal file
3
test/cli/basic/reference/raw.txt
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
points.zones.matrix:
|
||||||
|
columns.col: {}
|
||||||
|
rows.row: {}
|
5
test/cli/basic/reference/units.json
Normal file
5
test/cli/basic/reference/units.json
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"u": 19,
|
||||||
|
"cx": 18,
|
||||||
|
"cy": 17
|
||||||
|
}
|
1
test/cli/missing_input/command
Normal file
1
test/cli/missing_input/command
Normal file
|
@ -0,0 +1 @@
|
||||||
|
node src/cli.js
|
1
test/cli/missing_input/error
Normal file
1
test/cli/missing_input/error
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Usage: ergogen <config_file> [options]
|
|
@ -32,6 +32,7 @@ const cap = s => s.charAt(0).toUpperCase() + s.slice(1)
|
||||||
|
|
||||||
const test = function(input_path) {
|
const test = function(input_path) {
|
||||||
this.timeout(120000)
|
this.timeout(120000)
|
||||||
|
this.slow(120000)
|
||||||
title = path.basename(input_path, '.yaml').split('_').join(' ')
|
title = path.basename(input_path, '.yaml').split('_').join(' ')
|
||||||
it(title, async function() {
|
it(title, async function() {
|
||||||
const input = yaml.load(fs.readFileSync(input_path).toString())
|
const input = yaml.load(fs.readFileSync(input_path).toString())
|
||||||
|
@ -100,3 +101,49 @@ if (what) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// End-to-end tests to actually drive the CLI as well
|
||||||
|
// --what filter is 'cli'
|
||||||
|
// --dump is meaningless (just use the CLI itself)
|
||||||
|
|
||||||
|
const read = (d, p) => fs.readFileSync(path.join(d, p)).toString()
|
||||||
|
const exists = (d, p) => fs.existsSync(path.join(d, p))
|
||||||
|
const { execSync } = require('child_process')
|
||||||
|
const dircompare = require('dir-compare')
|
||||||
|
|
||||||
|
if (!what || what.includes('cli')) {
|
||||||
|
describe('CLI', function() {
|
||||||
|
this.timeout(120000)
|
||||||
|
this.slow(120000)
|
||||||
|
for (const t of glob.sync(path.join(__dirname, 'cli/*'))) {
|
||||||
|
it(cap(path.basename(t).split('_').join(' ')), function() {
|
||||||
|
const command = read(t, 'command')
|
||||||
|
const output_path = exists(t, 'path') ? read(t, 'path') : 'output'
|
||||||
|
const version_regex = /\bv\d+\.\d+\.\d+\b/
|
||||||
|
// correct execution
|
||||||
|
if (exists(t, 'log')) {
|
||||||
|
const ref_log = read(t, 'log').replace(version_regex, '<version>')
|
||||||
|
const actual_log = execSync(command).toString().replace(version_regex, '<version>')
|
||||||
|
actual_log.should.equal(ref_log)
|
||||||
|
const comp_res = dircompare.compareSync(output_path, path.join(t, 'reference'), {
|
||||||
|
compareContent: true
|
||||||
|
})
|
||||||
|
comp_res.same.should.be.true
|
||||||
|
fs.removeSync(output_path)
|
||||||
|
} else {
|
||||||
|
const ref_error = read(t, 'error').replace(version_regex, '<version>')
|
||||||
|
try {
|
||||||
|
execSync(command, {stdio: 'pipe'})
|
||||||
|
throw 'should_have_thrown'
|
||||||
|
} catch (ex) {
|
||||||
|
if (ex === 'should_have_thrown') {
|
||||||
|
throw new Error('This command should have thrown!')
|
||||||
|
}
|
||||||
|
const actual_error = ex.stderr.toString().replace(version_regex, '<version>')
|
||||||
|
actual_error.should.equal(ref_error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
|
@ -13,6 +13,9 @@ const kle = load('atreus_kle.json')
|
||||||
|
|
||||||
describe('Interface', function() {
|
describe('Interface', function() {
|
||||||
|
|
||||||
|
this.timeout(120000)
|
||||||
|
this.slow(120000)
|
||||||
|
|
||||||
it('debug', async function() {
|
it('debug', async function() {
|
||||||
// to check whether the output has "private" exports
|
// to check whether the output has "private" exports
|
||||||
const underscore = obj => {
|
const underscore = obj => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue