Error while Adding expect library (https://github.com/mjackson/expect) in JSBin.com

234 Views Asked by At

While trying to add Expect library in Jsbin.com console, it return undefined.

var mylib = {
  text: 'My Category',
  scripts: [
    { text: 'My library', url: 'https://github.com/mjackson/expect/blob/master/modules/index.js' }
  ]
};
libraries.add(mylib);
2

There are 2 best solutions below

0
simbathesailor On

why don't you add script tag in the head. Try this in jsbin.com

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
  <script src="https://unpkg.com/expect@%3C21/umd/expect.min.js"></script>
</head>
<body>
  <script>
    console.log("expect", expect.createSpy)
  </script>
</body>
</html> 
0
Ali Baghban On

You may use this stand alone module:

<script src="https://wzrd.in/standalone/[email protected]"></script>

put it in your head tag of the HTML file.