
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
learn-browser
Advanced tools
Test Flatiron School's JavaScript curriculum with a browser-based Mocha runner.
This package is for testing Flatiron School's JavaScript curriculum with a hot-reloading dev server and browser-based Mocha runner.
The script is invoked when the window.onload
event fires. In rough order, this is what happens:
results
object that mirrors the object sent to Ironbroker by the old, Node-based Mocha / Mocha Multi test strategy. The results object is poorly structured, containing some duplicate information and some very odd nesting, but I matched it up exactly with the old payloads for data consistency. Eventually, it would be cool to rethink the payload structure to make it easier to look at granular data on how students are interacting with our tests.results
object, creates the payload that will be transmitted to Ironbroker, and then sends it off.To use Learn Browser to test a new lab or code-along, add the package as a project dependency with Yarn:
yarn add learn-browser
or with NPM:
npm i --save learn-browser
In the lesson's index.html
file, add the minified version of Learn Browser in a script tag:
<!DOCTYPE html>
<html lang="en">
<head>
<!-- *snip* -->
</head>
<body>
<!-- *snip* -->
<!-- Include Flatiron School's minified test runner to push results to Learn. -->
<script src="node_modules/learn-browser/learnBrowser.min.js"></script>
</body>
</html>
The minified copy of Learn Browser should be the last thing loaded in index.html
. The script has some basic dependency checking built-in, but, in general, the index.html
file should look like this:
<!DOCTYPE html>
<html lang="en">
<head>
<!-- <title> and <meta> tags -->
<!-- Include Mocha's stylesheet to style test results -->
<link rel="stylesheet" href="node_modules/mocha/mocha.css">
</head>
<body>
<!-- <div> for Mocha to display test results. -->
<div id="mocha"></div>
<!-- Include Mocha and set it up for BDD-style testing. -->
<script src="node_modules/mocha/mocha.js"></script>
<script>mocha.setup('bdd');</script>
<!-- Include Chai as the matcher library. -->
<script src="node_modules/chai/chai.js"></script>
<!-- Include Sinon as the library for spies, stubs, and mocks. -->
<script src="node_modules/sinon/pkg/sinon.js"></script>
<!-- Include the student's JavaScript file. -->
<script src="index.js"></script>
<!-- Include the JavaScript file containing the tests. -->
<script src="test/indexTest.js"></script>
<!-- Include Flatiron School's minified test runner to push results to Learn. -->
<script src="node_modules/learn-browser/learnBrowser.min.js"></script>
</body>
</html>
Bug reports and pull requests are welcome on GitHub.
The package is available as open source under the terms of the MIT License.
FAQs
Test Flatiron School's JavaScript curriculum with a browser-based Mocha runner.
The npm package learn-browser receives a total of 1 weekly downloads. As such, learn-browser popularity was classified as not popular.
We found that learn-browser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.