Skip to content
This repository was archived by the owner on Oct 9, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
---
addons:
apt:
packages:
- xvfb
git:
depth: 1
sudo: false
cache:
directories:
- node_modules
- build-babel/node_modules
- build-babel/jspm_packages
- build-babel/node_modules
- node_modules
- test/jspm_packages
- test/jspm_bundles
- test/node_modules
language: node_js
matrix:
include:
Expand All @@ -15,6 +22,11 @@ matrix:
- node_js: '4'
- node_js: '5'
- node_js: '6'
install:
- export DISPLAY=':99.0'
- Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
- npm install
before_script:
- "npm i jspm@beta --prefix build-babel" # Force install in build-babel/node_modules
- "npm run build:tape"
- "npm run build"
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
"jspmPackage": true,
"scripts": {
"build": "./build.sh",
"build:tape": "test/bundleTape.sh",
"clear": "rm -rf build-babel/node_modules build-babel/jspm_packages regenerator-runtime.js systemjs-babel-node.js systemjs-babel-browser.js",
"prepublish": "npm run build",
"preversion": "npm run test",
"test": "node test/index.js"
"test": "npm run test:node && npm run test:browser",
"test:node": "node test/index.js",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's rather make this a jspm run test/index.js server test to avoid npm install tape?

"test:browser": "cat test/index.html | browser-run --input html --static ./"
},
"main": "plugin-babel.js",
"map": {
Expand Down
2 changes: 2 additions & 0 deletions test/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/jspm_bundles
/jspm.config.js
19 changes: 19 additions & 0 deletions test/bundleTape.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash -xv

NODE_CWD=./node_modules/.bin
JSPM_CMD=${NODE_CWD}/jspm

TMP_DIR=test
BUNDLE_DEST_DIR=test
JSPM_VERSION=beta

#

cd $TMP_DIR

npm install jspm@${JSPM_VERSION} --cache-min=Infinity

${JSPM_CMD} install tape=npm:tape --yes --quick --log err
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine, but should probably be a --dev install.

${JSPM_CMD} build tape jspm_bundles/tape.amd-bundle.min.js --format amd --skip-source-maps --skip-rollup --minify --log ok

cd ..
37 changes: 37 additions & 0 deletions test/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<script src="test/jspm_packages/system.src.js"></script>
<script type="text/javascript">
System.config({
'map': {
'tape': './test/jspm_bundles/tape.amd-bundle.min.js',
'systemjs': './test/jspm_packages/system.src.js'
},
'packages': {
'systemjs': {
format: 'global'
}
}
})

System.config({
map: {
'plugin-babel': './plugin-babel.js',
'systemjs-babel-build': './systemjs-babel-browser.js'
},
transpiler: 'plugin-babel'
});
</script>

<script type="text/javascript">
SystemJS
.import('./test/scenarios/index.js')
.then(registerTapeOnFinish, window.close);

//

function registerTapeOnFinish() {
SystemJS.import('tape')
.then(function (tape$m) {
tape$m.onFinish(window.close)
})
}
</script>
30 changes: 8 additions & 22 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,12 @@
var test = require('tape');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No reason not to make the test loader itself an ES module, and to use eg async functions even in due course too.

var SystemJS = require('systemjs');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't necessary if it's running in jspm.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

K


test('systemjs-plugin-babel', function (t) {
t.plan(1);

// given
System.config({
map: {
'plugin-babel': './plugin-babel.js',
'systemjs-babel-build': './systemjs-babel-node.js'
},
transpiler: 'plugin-babel'
});

// when
System.import('test/testing-code.js')

// then
.then(function(m) {
return m.p().then(function (message) {
t.equal(message, 'Rocks :)');
});
})
.then(t.end, t.end);
System.config({
map: {
'plugin-babel': './plugin-babel.js',
'systemjs-babel-build': './systemjs-babel-node.js'
},
transpiler: 'plugin-babel'
});

require('./scenarios/index.js');
27 changes: 27 additions & 0 deletions test/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"jspm": {
"dependencies": {
"tape": "npm:tape"
},
"peerDependencies": {
"assert": "github:jspm/nodelibs-assert@^0.2.0-alpha",
"buffer": "github:jspm/nodelibs-buffer@^0.2.0-alpha",
"child_process": "github:jspm/nodelibs-child_process@^0.2.0-alpha",
"events": "github:jspm/nodelibs-events@^0.2.0-alpha",
"fs": "github:jspm/nodelibs-fs@^0.2.0-alpha",
"http": "github:jspm/nodelibs-http@^0.2.0-alpha",
"path": "github:jspm/nodelibs-path@^0.2.0-alpha",
"process": "github:jspm/nodelibs-process@^0.2.0-alpha",
"stream": "github:jspm/nodelibs-stream@^0.2.0-alpha",
"url": "github:jspm/nodelibs-url@^0.2.0-alpha",
"util": "github:jspm/nodelibs-util@^0.2.0-alpha"
},
"overrides": {
"npm:[email protected]": {
"ignore": [
"test.js"
]
}
}
}
}
File renamed without changes.
21 changes: 21 additions & 0 deletions test/scenarios/basic/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
'use strict';

var test = require('tape');
var SystemJS = require('systemjs');

test('systemjs-plugin-babel', function (t) {
t.plan(1);

// given

// when
System.import(__dirname + '/actual.js')

// then
.then(function(m) {
return m.p().then(function (message) {
t.equal(message, 'Rocks :)');
});
})
.then(t.end, t.end);
});
5 changes: 5 additions & 0 deletions test/scenarios/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict';

//

require('./basic/index.js');