Coder Social home page Coder Social logo

vunit's People

Contributors

peripateticus avatar zcrumbo avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vunit's Issues

Run mocha only if only vanilla js tests

Currently all tests require webpack build and jsdom. We'd like to run mocha only if you are only testing vanilla js.

Here are example test scripts of the capability we want to capture:

"test-coverage": "vunit --coverage --spec=\"./src/test/js/**/*.?(vue-)spec.js\"",
    "test-js": "cross-env BABEL_ENV=test mocha --require @babel/register --recursive src/test/js/**/*.spec.js",
    "test-js-coverage": "cross-env BABEL_ENV=test nyc mocha --require @babel/register --recursive src/test/js/**/*.spec.js",
    "test-js-coverage-report": "cross-env NODE_ENV=test nyc --reporter=lcov mocha --recursive src/test/js/**/*.spec.js",
    "test-js-watch": "cross-env BABEL_ENV=test mocha --require @babel/register --watch --recursive src/test/js/**/*.spec.js",

expose jsdom instance for config in tests

This popped up while trying to write tests that involved sessionStorage - there's no way to do things like change jsdom's window.location.href without having access to the jsdom instance itself.
Can we expose a reference to it as a global in setup script?

Add support for --require cli argument

Can we whitelist --require as an accepted cli argument so users can configure mocha with additional global setup files?

Desired functionality
Be able to add the following script to the package.json file and have it pull in a config file for mocha

"scripts" : {
  "test": "vunit --spec=./test/**/*.spec.js --require=./test/setup.js" 
}

Current functionality
Adding the script returns Invalid option given: require

CSS not being extracted when using @import

Getting below error as a result of an @import ... in <style> section:

watched directories: 
webpack config: ...frontend/node_modules/@rei/vunit/webpack.config.js
specGlob: ./test/**/*.spec.js
--------------------------------
Setting up JSDOM...OK.
 WEBPACK  Compiling...
 WEBPACK  Compiled successfully in 1090ms
 MOCHA  Testing...
 RUNTIME EXCEPTION  Exception occurred while loading your tests

.../frontend/node_modules/@rei/cdr-icon/dist/cdr-icon.css:1
(function (exports, require, module, __filename, __dirname) { .cdr-icon-sprite{display:none}.cdr-icon_1\.0\.0{display:inline-block;vertical-align:middle;-ms-flex:0 0 auto;flex:0 0 auto;width:2.4rem;height:2.4rem;fill:#292929}.cdr-icon--sm_1\.0\.0{width:1.6rem;height:1.6rem}.cdr-icon--lg_1\.0\.0{width:3.2rem;height:3.2rem}.cdr-icon--inherit-color_1\.0\.0{fill:inherit}
                                                              ^

SyntaxError: Unexpected token .
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:616:28)
    at Module._extensions..js (module.js:663:10)
    at Object._module2.default._extensions.(anonymous function) [as .js] (..../frontend/node_modules/mocha-webpack/lib/util/registerRequireHook.js:140:62)

Webpack override (partial) config

I've added a webpack.overrides.conf.js file for febs to add a resolve alias but it looks like vunit doesn't use that file and only has an option to provide a full webpack config.

Is there some way to add just a partial config that would merge with the default one? Or do I have to get the full config from febs somehow to pass to this?

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.