fix(zone.js): zone-mix should import correct browser module (#31628)
Close #31626 PR Close #31628
This commit is contained in:
parent
2bb9a65351
commit
87ce4e997b
|
@ -673,6 +673,10 @@ jobs:
|
||||||
# Run zone.js tools tests
|
# Run zone.js tools tests
|
||||||
- run: yarn --cwd packages/zone.js promisetest
|
- run: yarn --cwd packages/zone.js promisetest
|
||||||
- run: yarn --cwd packages/zone.js promisefinallytest
|
- run: yarn --cwd packages/zone.js promisefinallytest
|
||||||
|
- run: yarn bazel build //packages/zone.js:npm_package &&
|
||||||
|
cp dist/bin/packages/zone.js/npm_package/dist/zone-mix.js ./packages/zone.js/test/extra/ &&
|
||||||
|
cp dist/bin/packages/zone.js/npm_package/dist/zone-patch-electron.js ./packages/zone.js/test/extra/ &&
|
||||||
|
yarn --cwd packages/zone.js electrontest
|
||||||
|
|
||||||
workflows:
|
workflows:
|
||||||
version: 2
|
version: 2
|
||||||
|
|
|
@ -6,8 +6,5 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import '../zone';
|
import '../browser/rollup-main';
|
||||||
import '../common/promise';
|
|
||||||
import '../common/to-string';
|
|
||||||
import '../browser/browser';
|
|
||||||
import '../node/node';
|
import '../node/node';
|
||||||
|
|
|
@ -15,13 +15,16 @@
|
||||||
"test": "test"
|
"test": "test"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"domino": "2.1.2",
|
||||||
"mocha": "^3.1.2",
|
"mocha": "^3.1.2",
|
||||||
|
"mock-require": "3.0.3",
|
||||||
"promises-aplus-tests": "^2.1.2",
|
"promises-aplus-tests": "^2.1.2",
|
||||||
"typescript": "~3.4.2"
|
"typescript": "~3.4.2"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"promisetest": "tsc -p . && node ./promise-test.js",
|
"promisetest": "tsc -p . && node ./promise-test.js",
|
||||||
"promisefinallytest": "tsc -p . && mocha promise.finally.spec.js"
|
"promisefinallytest": "tsc -p . && mocha promise.finally.spec.js",
|
||||||
|
"electrontest": "cd test/extra && node electron.js"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright Google Inc. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Use of this source code is governed by an MIT-style license that can be
|
||||||
|
* found in the LICENSE file at https://angular.io/license
|
||||||
|
*/
|
||||||
|
var domino = require('domino');
|
||||||
|
var mockRequire = require('mock-require');
|
||||||
|
var nativeTimeout = setTimeout;
|
||||||
|
require('./zone-mix');
|
||||||
|
mockRequire('electron', {
|
||||||
|
desktopCapturer: {getSources: function(callback) { nativeTimeout(callback); }},
|
||||||
|
shell: {openExternal: function(callback) { nativeTimeout(callback); }},
|
||||||
|
ipcRenderer: {on: function(callback) { nativeTimeout(callback); }},
|
||||||
|
});
|
||||||
|
require('./zone-patch-electron');
|
||||||
|
var electron = require('electron');
|
||||||
|
var zone = Zone.current.fork({name: 'zone'});
|
||||||
|
zone.run(function() {
|
||||||
|
electron.desktopCapturer.getSources(function() {
|
||||||
|
if (Zone.current.name !== 'zone') {
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
electron.shell.openExternal(function() {
|
||||||
|
console.log('shell', Zone.current.name);
|
||||||
|
if (Zone.current.name !== 'zone') {
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
electron.ipcRenderer.on(function() {
|
||||||
|
if (Zone.current.name !== 'zone') {
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue