Iterate on test setup
This commit is contained in:
@@ -56,7 +56,7 @@ Dir['fixtures/*.html'].each do |file|
|
||||
|
||||
print logs[4]
|
||||
|
||||
f = File.open("../javascript/tests/Facebook.Yoga/#{name}.js", 'w')
|
||||
f = File.open("../javascript/tests/generated/#{name}.test.js", 'w')
|
||||
f.write eval(logs[3].message.sub(/^[^"]*/, '')).sub('YogaTest', name)
|
||||
f.close
|
||||
end
|
||||
|
@@ -37,7 +37,12 @@ import { loadYoga } from "yoga-layout/entrypoint/wasm-async";
|
||||
|
||||
## Contributing
|
||||
|
||||
`yoga-layout` may be locally built by running the following set of commands. The build requires that some dependencies be installed first.
|
||||
### Requirements
|
||||
|
||||
1. CMake >= 3.13
|
||||
1. (Optional) ninja, for faster builds
|
||||
|
||||
### Building
|
||||
|
||||
```bash
|
||||
git clone https://github.com/facebook/yoga.git
|
||||
@@ -46,7 +51,12 @@ yarn install
|
||||
yarn build
|
||||
```
|
||||
|
||||
### Requirements
|
||||
### Testing
|
||||
|
||||
1. CMake >= 3.13
|
||||
1. (Optional) ninja, for faster builds
|
||||
```bash
|
||||
# Build and test all entrypoints
|
||||
yarn test
|
||||
|
||||
# Build and test a specific entrypoint
|
||||
yarn test:asmjs-sync
|
||||
```
|
||||
|
@@ -9,6 +9,6 @@
|
||||
|
||||
module.exports = {
|
||||
setupFiles: ["./jest.setup.js", "./tests/tools.js"],
|
||||
testRegex: '/tests/Facebook.Yoga/.*\\.js$',
|
||||
testRegex: '/tests/.*\\.test\\.js$',
|
||||
watchman: false,
|
||||
}
|
||||
|
@@ -26,17 +26,17 @@
|
||||
"src_js/**"
|
||||
],
|
||||
"scripts": {
|
||||
"benchmark": "node tests/run-bench $(find tests/Benchmarks -name '*.js')",
|
||||
"build": "yarn build:native && yarn build:js",
|
||||
"benchmark": "yarn build && node tests/run-bench $(find tests/benchmarks -name '*.js')",
|
||||
"build": "yarn build:js && yarn build:native",
|
||||
"build:configure": "which ninja && emcmake cmake -S . -B build -G Ninja || emcmake cmake -S . -B build",
|
||||
"build:copy-dts": "cd src_js && find . -name '*.d.ts' | cpio -pdm ../dist",
|
||||
"build:js": "babel src_js --source-maps --out-dir dist && yarn build:copy-dts",
|
||||
"build:native": "yarn build:configure && cmake --build build",
|
||||
"test": "yarn test:asmjs && yarn test:asmjs-sync && yarn test:wasm && yarn test:wasm-sync",
|
||||
"test:asmjs": "WASM=0 SYNC=0 jest",
|
||||
"test:asmjs-sync": "WASM=0 SYNC=1 jest",
|
||||
"test:wasm": "WASM=1 SYNC=0 jest",
|
||||
"test:wasm-sync": "WASM=1 SYNC=1 jest"
|
||||
"test": "yarn test:asmjs-async && yarn test:asmjs-sync && yarn test:wasm-async && yarn test:wasm-sync",
|
||||
"test:asmjs-async": "yarn build --target asmjs-async && WASM=0 SYNC=0 jest",
|
||||
"test:asmjs-sync": "yarn build --target asmjs-sync && WASM=0 SYNC=1 jest",
|
||||
"test:wasm-async": "yarn build --target wasm-async && WASM=1 SYNC=0 jest",
|
||||
"test:wasm-sync": "yarn build --target wasm-sync && WASM=1 SYNC=1 jest"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.20.7",
|
||||
|
@@ -7,9 +7,9 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
const wrapAsm = require('./wrapAsm');
|
||||
const wrapAsm = require('../wrapAsm');
|
||||
|
||||
module.exports = (loadAsm) => ({
|
||||
loadYoga: () => loadAsm().then(wrapAsm),
|
||||
...require('./generated/YGEnums'),
|
||||
...require('../generated/YGEnums'),
|
||||
});
|
||||
|
@@ -7,5 +7,5 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
const wrapAsm = require('./wrapAsm');
|
||||
const wrapAsm = require('../wrapAsm');
|
||||
module.exports = (asm) => wrapAsm(asm());
|
||||
|
@@ -8,4 +8,4 @@
|
||||
*/
|
||||
|
||||
const asm = require('../build/asmjs-async');
|
||||
module.exports = require("./entryAsync")(asm);
|
||||
module.exports = require("./_entryAsync")(asm);
|
||||
|
@@ -8,4 +8,4 @@
|
||||
*/
|
||||
|
||||
const asm = require('../build/asmjs-sync');
|
||||
module.exports = require("./entrySync")(asm);
|
||||
module.exports = require("./_entrySync")(asm);
|
||||
|
@@ -8,4 +8,4 @@
|
||||
*/
|
||||
|
||||
const asm = require('../build/wasm-async');
|
||||
module.exports = require("./entryAsync")(asm);
|
||||
module.exports = require("./_entryAsync")(asm);
|
||||
|
@@ -8,4 +8,4 @@
|
||||
*/
|
||||
|
||||
const asm = require('../build/wasm-sync');
|
||||
module.exports = require("./entrySync")(asm);
|
||||
module.exports = require("./_entrySync")(asm);
|
||||
|
@@ -5,9 +5,8 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
var Yoga = Yoga || require("../../dist/entry-" + process.env.TEST_ENTRY);
|
||||
|
||||
var ITERATIONS = 2000;
|
||||
const ITERATIONS = 2000;
|
||||
const YGBENCHMARK = global.YGBENCHMARK ?? global.test;
|
||||
|
||||
YGBENCHMARK("Stack with flex", function() {
|
||||
var root = Yoga.Node.create();
|
@@ -1361,7 +1361,7 @@ it("align_baseline_multiline_column", function () {
|
||||
console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
||||
console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
||||
|
||||
console.assert(70 === root_child1.getComputedLeft(), "70 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");
|
||||
console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");
|
||||
console.assert(50 === root_child1.getComputedTop(), "50 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");
|
||||
console.assert(30 === root_child1.getComputedWidth(), "30 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");
|
||||
console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");
|
||||
@@ -1371,7 +1371,7 @@ it("align_baseline_multiline_column", function () {
|
||||
console.assert(20 === root_child1_child0.getComputedWidth(), "20 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")");
|
||||
console.assert(20 === root_child1_child0.getComputedHeight(), "20 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")");
|
||||
|
||||
console.assert(10 === root_child2.getComputedLeft(), "10 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");
|
||||
console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");
|
||||
console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");
|
||||
console.assert(40 === root_child2.getComputedWidth(), "40 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");
|
||||
console.assert(70 === root_child2.getComputedHeight(), "70 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");
|
||||
@@ -1481,7 +1481,7 @@ it("align_baseline_multiline_column2", function () {
|
||||
console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
||||
console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
||||
|
||||
console.assert(70 === root_child1.getComputedLeft(), "70 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");
|
||||
console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");
|
||||
console.assert(50 === root_child1.getComputedTop(), "50 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");
|
||||
console.assert(30 === root_child1.getComputedWidth(), "30 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");
|
||||
console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");
|
||||
@@ -1491,7 +1491,7 @@ it("align_baseline_multiline_column2", function () {
|
||||
console.assert(20 === root_child1_child0.getComputedWidth(), "20 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")");
|
||||
console.assert(20 === root_child1_child0.getComputedHeight(), "20 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")");
|
||||
|
||||
console.assert(10 === root_child2.getComputedLeft(), "10 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");
|
||||
console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");
|
||||
console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");
|
||||
console.assert(40 === root_child2.getComputedWidth(), "40 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");
|
||||
console.assert(70 === root_child2.getComputedHeight(), "70 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");
|
@@ -1,34 +0,0 @@
|
||||
<html>
|
||||
|
||||
<script>
|
||||
function it(name, func) {
|
||||
console.log(name);
|
||||
func();
|
||||
}
|
||||
function YGBENCHMARK(name, func) {
|
||||
console.log(name);
|
||||
func();
|
||||
}
|
||||
</script>
|
||||
|
||||
<script src="../dist/Yoga.bundle.js"></script>
|
||||
|
||||
<script src="./tools.js"></script>
|
||||
|
||||
<script src="./Facebook.Yoga/YGAbsolutePositionTest.js"></script>
|
||||
<script src="./Facebook.Yoga/YGAlignContentTest.js"></script>
|
||||
<script src="./Facebook.Yoga/YGAlignItemsTest.js"></script>
|
||||
<script src="./Facebook.Yoga/YGAlignSelfTest.js"></script>
|
||||
<script src="./Facebook.Yoga/YGBorderTest.js"></script>
|
||||
<script src="./Facebook.Yoga/YGFlexDirectionTest.js"></script>
|
||||
<script src="./Facebook.Yoga/YGFlexTest.js"></script>
|
||||
<script src="./Facebook.Yoga/YGFlexWrapTest.js"></script>
|
||||
<script src="./Facebook.Yoga/YGJustifyContentTest.js"></script>
|
||||
<script src="./Facebook.Yoga/YGMarginTest.js"></script>
|
||||
<script src="./Facebook.Yoga/YGMinMaxDimensionTest.js"></script>
|
||||
<script src="./Facebook.Yoga/YGPaddingTest.js"></script>
|
||||
<script src="./Facebook.Yoga/YGRoundingTest.js"></script>
|
||||
|
||||
<script src="./Benchmarks/YGBenchmark.js"></script>
|
||||
|
||||
</html>
|
Reference in New Issue
Block a user