GithubHelp home page GithubHelp logo

pixijs / floss Goto Github PK

View Code? Open in Web Editor NEW
28.0 36.0 9.0 378 KB

Unit-testing for those hard to reach places

Home Page: https://www.npmjs.com/package/floss

License: MIT License

JavaScript 18.39% HTML 2.75% TypeScript 78.86%
mocha unit-testing electron electron-mocha sinon coverage travis-ci

floss's Issues

display issue on window

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 ?

mocha args

Hello! Can we somehow pass args (like --exit or --timeout) to Mocha?

Uncaught Exception: TypeError: Cannot use 'in' operator to search for 'detach'

Steps:

  • Be on Electron v2.0.0-beta.8
  • floss -p test.js -d

Expect:

  • Should see window appear with Developer Tools open on the bottom

Actual

  • Get an error dialog

The bug:

mainWindow.webContents.openDevTools('bottom');

The fix:

mainWindow.webContents.openDevTools({ mode: 'bottom' });

The relevant WebContents docs

Maybe the openDevTools API changed slightly between Electron versions?

Will try to do a PR when I have more time to test a binary.

Effort to port to Jest?

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!

Supporting native ESM

Mocha as partial native support since 7.1.0, and seems to be full support since 8.0.0. Any chance of bumping mocha?

Running floss in Docker returns null

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 removes remote module

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.

Typescript example

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.