-
Couldn't load subscription status.
- Fork 33
feat(test): add raw browser testing #49
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| /jspm_bundles | ||
| /jspm.config.js |
| 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 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is fine, but should probably be a |
||
| ${JSPM_CMD} build tape jspm_bundles/tape.amd-bundle.min.js --format amd --skip-source-maps --skip-rollup --minify --log ok | ||
|
|
||
| cd .. | ||
| 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> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,26 +3,12 @@ | |
| var test = require('tape'); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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'); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This isn't necessary if it's running in jspm. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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'); | ||
| 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" | ||
| ] | ||
| } | ||
| } | ||
| } | ||
| } |
| 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); | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| 'use strict'; | ||
|
|
||
| // | ||
|
|
||
| require('./basic/index.js'); |
There was a problem hiding this comment.
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.jsserver test to avoidnpm install tape?