Comments (6)
The proposed strategy may also provide a straightforward way to be able to run unit tests in requirejs mode as well as in compiled mode.
UPDATE: Except we would need to bundle QUnit into our build as a preload or link to an online one.
UPDATE: Also it would be best if unit tests are stripped out during the build.
from aqua.
The proposed strategy also provides a straightforward way to run certain tests in PhET-iO mode.
from aqua.
I experimented with running tests from main and will put my results here as a "poor man's branch". But I think we should instead investigate generating a new sim-config.js file and sim-test.html file from grunt that are parallel to the existing ones.
from aqua.
// faraday's law main:
if ( phet.chipper.queryParameters.unitTests ) {
return runUnitTests( faradaysLawUnitTests );
}
runUnitTests.js
// Copyright 2017, University of Colorado Boulder
/**
*
*
* @author Sam Reid (PhET Interactive Simulations)
*/
define( function( require ) {
'use strict';
// modules
var faradaysLaw = require( 'FARADAYS_LAW/faradaysLaw' );
var runUnitTests = function( tests ) {
var script = document.createElement( 'script' );
script.onload = function() {
tests();
// Start the tests
QUnit.start();
};
var qunitDiv = document.createElement( 'div' );
qunitDiv.id = 'qunit';
document.body.appendChild( qunitDiv );
var fixtureDiv = document.createElement( 'div' );
fixtureDiv.id = 'qunit-fixture';
// document.body.appendChild( fixtureDiv );
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = '../sherpa/lib/qunit-2.0.1.css';
link.media = 'all';
document.head.appendChild( link );
script.src = '../sherpa/lib/qunit-2.0.1.js';
document.head.appendChild( script ); //or something of the likes
document.body.removeChild( document.getElementById( 'splash-container' ) ); //or something of the likes
};
faradaysLaw.register( 'runUnitTests', runUnitTests );
return runUnitTests;
} );
faradaysLawUnitTests.js
// Copyright 2017, University of Colorado Boulder
/**
*
*
* @author Sam Reid (PhET Interactive Simulations)
*/
define( function( require ) {
'use strict';
// modules
var faradaysLaw = require( 'FARADAYS_LAW/faradaysLaw' );
var faradaysLawUnitTests = function() {
QUnit.test( 'hello test', function( assert ) {
assert.ok( false, 'false should not be true' );
} );
};
faradaysLaw.register( 'faradaysLawUnitTests', faradaysLawUnitTests );
return faradaysLawUnitTests;
} );
from aqua.
Initial investigation in phetsims/chipper#624 (comment) looks promising, we may continue discussion over there.
from aqua.
Let's continue in phetsims/chipper#624 (comment), closing.
from aqua.
Related Issues (20)
- CTQ status is not reliably reported to Slack#continouous-testing HOT 13
- Make this repo private HOT 3
- pm2 in cluster mode instead of `grunt client-server`? HOT 1
- Improve ct-main server HOT 2
- ct-chrome-clients should run on sparky and bayes together HOT 2
- report should show percent of tests completed in column heading HOT 3
- Increase the size of `/tmp` in sparky HOT 3
- Better error reporting for window.location probably changed (onbeforeunload handler) HOT 11
- Support WebGL on sparky HOT 3
- CTQ should slack report when erroring out or quiting
- CT: Improve memory testing
- CT report filter should match on error messages too HOT 1
- Make a Node-based CT client HOT 15
- Investigate tests that are not completing: HOT 3
- New snapshots should be transpiled before starting tests HOT 1
- Handle 414 errors HOT 4
- CT: `TypeError: tn() is not a constructor` HOT 1
- CT: unhandledRejection from non 200 status code
- CT: net::ERR_FAILED in phet-io-wrappers-tests HOT 20
- QuickServer should always lint without cache HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aqua.