Skip to content

Instantly share code, notes, and snippets.

@eirikb
Last active June 11, 2017 21:30
Show Gist options
  • Save eirikb/d8d9a20673166c02bf62 to your computer and use it in GitHub Desktop.
Save eirikb/d8d9a20673166c02bf62 to your computer and use it in GitHub Desktop.
JSPM + AVA
  1. Download zip.
  2. npm install.
  3. npm test.
{
"presets": ["es2015"]
}
'use strict';
const glob = require('glob');
const Module = require('module');
const load = Module._load;
Module._load = (name, m) => {
try {
return load(name, m);
} catch (e) {
let files = glob(__dirname + '/jspm_packages/**/' + name + '*/', {sync: true});
if (files.length > 0) return load(files[0], m);
}
};
{
"name": "ava-test",
"version": "1.0.0",
"scripts": {
"postinstall": "jspm i -y",
"test": "ava"
},
"devDependencies": {
"ava": "^0.11.0",
"glob": "^6.0.4",
"jspm": "^0.16.27"
},
"jspm": {
"dependencies": {
"query-string": "npm:query-string@^3.0.0"
},
"devDependencies": {
"babel": "npm:babel-core@^5.8.24",
"babel-runtime": "npm:babel-runtime@^5.8.24",
"core-js": "npm:core-js@^1.1.4"
}
},
"ava": {
"files": [
"./query-test.js"
],
"require": [
"babel-core/register",
"./jspm-loader.js"
]
}
}
import test from 'ava';
import Query from './query';
test(t => {
let res = Query.stringify({
hello: 'world'
});
t.is('hello=world', res);
});
import queryString from 'query-string';
export default class Query {
static stringify(data) {
return queryString.stringify(data);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment