pixijs / floss Goto Github PK
View Code? Open in Web Editor NEWUnit-testing for those hard to reach places
Home Page: https://www.npmjs.com/package/floss
License: MIT License
Unit-testing for those hard to reach places
Home Page: https://www.npmjs.com/package/floss
License: MIT License
See Electron's breaking changes list. This causes the script in index.html to break.
Simply adding contextIsolation: false
to the options object used to create an Electron window solved the issue for me, but I haven't looked at the security implications of that.
Hi !
Thank for this awesome repository ! =)
I have a display issue on window.
The reporter out this :
←[0m←[0m
←[0m _forEachDeep :: tag:String => Object => Function => undefined←[0m
←[32m ÔêÜ←[0m←[90m should call func in all children←[0m
←[0m _mapDeep :: tag:String => Object => Function => Object←[0m
←[32m ÔêÜ←[0m←[90m should call func in all children←[0m
←[32m ÔêÜ←[0m←[90m should return an object with the same structure←[0m
←[32m ÔêÜ←[0m←[90m should return an object with children name equal ok←[0m
←[0m .createFrom :: Object => Container←[0m
←[32m ÔêÜ←[0m←[90m should expose createFrom←[0m
←[31m 1) should return a Container←[0m
←[92m ←[0m←[32m 5 passing←[0m←[90m (59ms)←[0m
←[31m 1 failing←[0m
←[0m 1) .createFrom :: Object => Container should return a Container:
←[0m←[31m TypeError: Cannot read property 'should' of undefined←[0m←[90m
at Context.it (C:\Users\florian\Main\modules\pixi-createfrom\test\index.js:90:14)
at callFn (C:\Users\florian\Main\modules\pixi-createfrom\node_modules\floss\node_modules\mocha\lib\runnable.js:326:21)
Do you know where this issue come from ?
Hello! Can we somehow pass args (like --exit or --timeout) to Mocha?
I used Jest alone to test pixi.js project and encountered various problems and reported errors. When I saw pixi.js tested by electron, I thought this way was very special, but I still didn't quite understand the test principle of FLOSS.
Steps:
floss -p test.js -d
Expect:
Actual
The bug:
Line 73 in a35ee03
The fix:
mainWindow.webContents.openDevTools({ mode: 'bottom' });
Maybe the openDevTools
API changed slightly between Electron versions?
Will try to do a PR when I have more time to test a binary.
I'm pretty new to Pixi.js and was told that floss is the officially recommended way to test a Pixi.js app. Would love a couple of quick pointers/examples to get started.
Hello, you might remember me from such issues as pixijs/pixijs#7554
Just wanted to get a hot take about the effort it might require to port this to Jest testing / make this work to run Jest tests as well?
Thank you!
Mocha as partial native support since 7.1.0
, and seems to be full support since 8.0.0
. Any chance of bumping mocha?
We have a test suite that we call like this: ./node_modules/floss/bin/floss.js --path test/index.js
Running it locally on our dev machines outside Docker works like expected, it runs the test suite and returns correct exit code.
However, running it inside Docker fails and returns null
.
Here's the log:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'test' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'pretest', 'test', 'posttest' ]
5 info lifecycle [email protected]~pretest: [email protected]
6 info lifecycle [email protected]~test: [email protected]
7 verbose lifecycle [email protected]~test: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~test: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/frontend/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
9 verbose lifecycle [email protected]~test: CWD: /frontend
10 silly lifecycle [email protected]~test: Args: [ '-c',
10 silly lifecycle './node_modules/floss/bin/floss.js --path test/index.js' ]
11 silly lifecycle [email protected]~test: Returned: code: 1 signal: null
12 info lifecycle [email protected]~test: Failed to exec test script
13 verbose stack Error: [email protected] test: `./node_modules/floss/bin/floss.js --path test/index.js`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:304:16)
13 verbose stack at EventEmitter.emit (events.js:182:13)
13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:182:13)
13 verbose stack at maybeClose (internal/child_process.js:961:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:5)
14 verbose pkgid [email protected]
15 verbose cwd /frontend
16 verbose Linux 4.15.0-42-generic
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "test"
18 verbose node v10.4.1
19 verbose npm v6.1.0
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] test: `./node_modules/floss/bin/floss.js --path test/index.js`
22 error Exit status 1
23 error Failed at the [email protected] test script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
node_modules/floss/bin/floss.js
exists on path in Docker and so does test/index.js
.
Is there a special set-up for floss in Docker, or is that a bug in floss?
If you need more info to reproduce this issue, just let me know, I am floss and Docker newbie. :)
Electron 14 has breaking changes for floss. Electron docs here https://github.com/electron/electron/blob/v13.1.4/docs/api/remote.md
Electron 14 is also the first version that allows you to enable webgpu by doing:
const {app, BrowserWindow} = require('electron')
app.commandLine.appendSwitch('enable-unsafe-webgpu')
(being able to test webgpu is really the only reason why it matters to me)
As you may guess, I'd like to have webgpu enabled in floss if possible too! I'm willing to fix and send a pr for both , but would like some guidance on what'd be acceptable to you. Just a fyi, browsing random sites with enable-unsafe-webgpu is supposedly unsafe because cross origin can read gpu data, i seriously dont think that matters though, especially for local testing.
The easiest thing to get floss working with v14 would be to just change the remote import to "@electron/remote" , so like a 1 line change.
enabling webgpu is also just 1 line, but the decision may or may not require some discussion with others.
Regarding use of typescript with floss (mentioned in #29), I find the example in the wiki to be a bit confusing:
https://github.com/pixijs/floss/wiki/Running-TypeScript-with-Floss
If I am used to run mocha tests with ts-loader, and I have all my .ts tests defined in the "<project_dir>/test" folder, I can run mocha like this:
mocha -r ts-node/register "test/**/*.ts"
What would be the equivalent for floss?
This project is written in typescript, yet there is no example as to how to run floss (using NPM or otherwise) with ts-node as a require as with regular mocha mocha -r ts-node/register /path/to/code/**.*.ts
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.