Coder Social home page Coder Social logo

jonathanwolfe / open-polymer-tester Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 220 KB

Alternative test runner for Polymer 1 (and probably more) components based on Puppeteer. Provides latest Mocha, Chai, and support for NYC (formerly Istanbul) code coverage.

License: MIT License

JavaScript 97.29% HTML 2.71%

open-polymer-tester's Introduction

Open-Polymer-Tester

Provides the opt server and test runner.

serverMappings.json

To correctly host files, you need to provide mappings between the url paths and the actual folder paths. This is will vary depending on your project, but a sample below is provided:

  • rootPaths: paths that should show up at the root of the server
  • mappings: url to folder redirects/pointers
{
	"rootPaths": [
		"./build/test",
		"./node_modules/omneo-globals/dist/static"
	],
	"mappings": {
		"/bower_components": "./bower_components",
		"/node_modules": "./node_modules",
		"/node_modules/omneo-elements/dist": "./build/inline",
		"/build": "./build",
		"/test": "./build/test"
	}
}

Usage

See the tools help output for all commands and options

yarn run opt --help

Using the Server Directly

You can also start the server directly if you would like to use it as a lightweight testing environement. It is useful to add this to your npm-scripts.

node ./node_modules/open-polymer-tester/server.js start --port 3333
{
	"scripts": {
		"server": "node ./node_modules/open-polymer-tester/server.js start --port 3333"
	}
}

Linux Issues

Chrome on linux spams /tmp with stuff, so it's recommended to nuke the directory before doing a run. Eventually this build up will cause random failures because chrome closed itself from some internal error.

rm -rf /tmp
mkdir /tmp

Chrome on linux is a fickle beast and does not behave the same way as it does on windows, especially when it comes to timers and microtasks. If you encounter issues of tests failing on linux that don't on windows, then you need to reduce your concurrency limit, probably all the way down to 1. Easiest way to do this is with the environment flag, but you can use the cli flag too.

# environment variable
export OPT_CONCURRENT=1

# cli flag
$ opt run --concurrent 1

If it yells at you about being or running as root, you need to use the no-sandbox setting.

# environment variable
export OPT_NO_SANDBOX='true'

$ opt run --no-sandbox

open-polymer-tester's People

Contributors

jonathanwolfe avatar

Watchers

 avatar

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.