3

我一直在尝试在 Phantom 中进行一些测试,但 Aurelia/SystemJS 似乎在 Phantom 中出现了问题。

我已经用我自己的应用程序和 Aurelia 联系人应用程序示例对其进行了测试,它们略有不同。我将在这里列出我捕获的输出:

应用程序联系人:

CONSOLE: INFO [aurelia] Aurelia Starting (from line #undefined in "undefined")
CONSOLE: DEBUG [aurelia] Loading plugin github:aurelia/templating-binding@0.11.0. (from line #undefined in "undefined")
TypeError: Attempting to define property on object that is not extensible.

  http://localhost:9001/:48 in defineProperty
  http://localhost:9001/:36
  http://localhost:9001/:29 in fastKey
  http://localhost:9001/:115
  http://localhost:9001/:10 in set
  http://localhost:9001/:51 in set
  http://localhost:9001/:14 in ensureOriginOnExports
  http://localhost:9001/:131
  http://localhost:9001/jspm_packages/es6-module-loader.js:7 in O
  http://localhost:9001/jspm_packages/es6-module-loader.js:7 in K
  http://localhost:9001/jspm_packages/es6-module-loader.js:7
  http://localhost:9001/jspm_packages/es6-module-loader.js:7
  http://localhost:9001/jspm_packages/es6-module-loader.js:7
  http://localhost:9001/jspm_packages/es6-module-loader.js:7

我的应用程序:

CONSOLE: Potentially unhandled rejection [2] ReferenceError: Can't find variable: Map
    at http://127.0.0.1:8380/web-admin/:22
    at p (http://127.0.0.1:8380/web-admin/jspm_packages/system.js:1)
    at p (http://127.0.0.1:8380/web-admin/jspm_packages/system.js:1)
    at p (http://127.0.0.1:8380/web-admin/jspm_packages/system.js:1)
    at p (http://127.0.0.1:8380/web-admin/jspm_packages/system.js:1)
    at p (http://127.0.0.1:8380/web-admin/jspm_packages/system.js:1)
    at p (http://127.0.0.1:8380/web-admin/jspm_packages/system.js:1)
    at p (http://127.0.0.1:8380/web-admin/jspm_packages/system.js:1)
    at http://127.0.0.1:8380/web-admin/jspm_packages/system.js:1
    at o (http://127.0.0.1:8380/web-admin/jspm_packages/es6-module-loader.js:7)
    at p (http://127.0.0.1:8380/web-admin/jspm_packages/es6-module-loader.js:7)
    at j (http://127.0.0.1:8380/web-admin/jspm_packages/es6-module-loader.js:7)
    at k (http://127.0.0.1:8380/web-admin/jspm_packages/es6-module-loader.js:7)
    at http://127.0.0.1:8380/web-admin/jspm_packages/es6-module-loader.js:7
    at O (http://127.0.0.1:8380/web-admin/jspm_packages/es6-module-loader.js:7)
    at K (http://127.0.0.1:8380/web-admin/jspm_packages/es6-module-loader.js:7)
    at http://127.0.0.1:8380/web-admin/jspm_packages/es6-module-loader.js:7
    at http://127.0.0.1:8380/web-admin/jspm_packages/es6-module-loader.js:7
    at http://127.0.0.1:8380/web-admin/jspm_packages/es6-module-loader.js:7
    at http://127.0.0.1:8380/web-admin/jspm_packages/es6-module-loader.js:7 (from line #undefined in "undefined")

FWIW 这些都在 Chrome/FF 中运行良好,我在 OS X 10.10 上运行 PhantomJS 1.9.8

这也是我用来测试这些和从控制台输出的幻影脚本:

var webPage = require('webpage');
var page = webPage.create();

page.open('http://localhost:9001/', function() {
  page.onConsoleMessage = function(msg, lineNum, sourceId) {
    console.log('CONSOLE: ' + msg + ' (from line #' + lineNum + ' in "' + sourceId + '")');
  };
});

要运行联系人应用程序(第一个示例),请运行以下命令:

git clone git@github.com:aurelia/app-contacts.git
cd app-contacts
npm install && jspm install
gulp watch

这假设您已经安装了node,jspmgulp安装了。然后就可以运行上面的 phantomjs 脚本了。

有任何想法吗?

4

1 回答 1

2

Map是一个相当新的结构。使用npm install harmony-collections --save-dev并添加"node_modules/harmony-collections/harmony-collections.min.js",到业力配置。

于 2015-07-28T08:21:29.820 回答