Closed erikringsmuth closed 9 years ago
Currently you have to run tests from the browser. https://github.com/erikringsmuth/app-router#build-test-and-debug-
Tests can't be run in Node.js test runners (Jasmine, Mocha) or PhantomJS test runners because none of them support custom elements.
The problem can be partially mitigated by moving "utility" functions to a different file. These are the functions that don't rely on DOM APIs.
parseUrlPath(url) https://github.com/erikringsmuth/app-router/blob/master/src/app-router.js#L183
parseUrlPath(url)
testRoute(routePath, urlPath, trailingSlashOption, isRegExp) https://github.com/erikringsmuth/app-router/blob/master/src/app-router.js#L214
testRoute(routePath, urlPath, trailingSlashOption, isRegExp)
routeArguments(routePath, urlPath, url, isRegExp) https://github.com/erikringsmuth/app-router/blob/master/src/app-router.js#L214
routeArguments(routePath, urlPath, url, isRegExp)
I don't want create globals so loading a <script src="..."> is out of the question. I'd like to move to ES6 modules and add a transpile step to gulp. This would allow some code to be tested with Jasmine or Mocha and run from gulp.
<script src="...">
I can setup gulp-karma to run jasmine
https://www.npmjs.org/package/gulp-karma
The karma-config can choose a browser to test again
That'd be awesome!
Currently you have to run tests from the browser. https://github.com/erikringsmuth/app-router#build-test-and-debug-
Tests can't be run in Node.js test runners (Jasmine, Mocha) or PhantomJS test runners because none of them support custom elements.
The problem can be partially mitigated by moving "utility" functions to a different file. These are the functions that don't rely on DOM APIs.
parseUrlPath(url)
https://github.com/erikringsmuth/app-router/blob/master/src/app-router.js#L183testRoute(routePath, urlPath, trailingSlashOption, isRegExp)
https://github.com/erikringsmuth/app-router/blob/master/src/app-router.js#L214routeArguments(routePath, urlPath, url, isRegExp)
https://github.com/erikringsmuth/app-router/blob/master/src/app-router.js#L214I don't want create globals so loading a
<script src="...">
is out of the question. I'd like to move to ES6 modules and add a transpile step to gulp. This would allow some code to be tested with Jasmine or Mocha and run from gulp.