test: move remote specs to main process (#21387)
This commit is contained in:
parent
409ef49d3a
commit
7f6b308bf1
27 changed files with 702 additions and 633 deletions
7
spec-main/fixtures/module/call.js
Normal file
7
spec-main/fixtures/module/call.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
exports.call = function (func) {
|
||||
return func()
|
||||
}
|
||||
|
||||
exports.constructor = function () {
|
||||
this.test = 'test'
|
||||
}
|
3
spec-main/fixtures/module/circular.js
Normal file
3
spec-main/fixtures/module/circular.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
exports.returnArgs = function (...args) {
|
||||
return args
|
||||
}
|
29
spec-main/fixtures/module/class.js
Normal file
29
spec-main/fixtures/module/class.js
Normal file
|
@ -0,0 +1,29 @@
|
|||
'use strict'
|
||||
|
||||
let value = 'old'
|
||||
|
||||
class BaseClass {
|
||||
method () {
|
||||
return 'method'
|
||||
}
|
||||
|
||||
get readonly () {
|
||||
return 'readonly'
|
||||
}
|
||||
|
||||
get value () {
|
||||
return value
|
||||
}
|
||||
|
||||
set value (val) {
|
||||
value = val
|
||||
}
|
||||
}
|
||||
|
||||
class DerivedClass extends BaseClass {
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
base: new BaseClass(),
|
||||
derived: new DerivedClass()
|
||||
}
|
11
spec-main/fixtures/module/error-properties.js
Normal file
11
spec-main/fixtures/module/error-properties.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
class Foo {
|
||||
set bar (value) {
|
||||
throw new Error('setting error')
|
||||
}
|
||||
|
||||
get bar () {
|
||||
throw new Error('getting error')
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = new Foo()
|
3
spec-main/fixtures/module/exception.js
Normal file
3
spec-main/fixtures/module/exception.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
module.exports = function (error) {
|
||||
throw error
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
function foo () {}
|
||||
foo.bar = 'baz'
|
||||
|
||||
module.exports = foo
|
3
spec-main/fixtures/module/function-with-args.js
Normal file
3
spec-main/fixtures/module/function-with-args.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
module.exports = function (cb) {
|
||||
return cb.length
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
exports.setup = function () {
|
||||
const foo = {}
|
||||
|
||||
foo.bar = function () {
|
||||
return delete foo.bar.baz && delete foo.bar
|
||||
}
|
||||
|
||||
foo.bar.baz = function () {
|
||||
return 3
|
||||
}
|
||||
|
||||
return foo
|
||||
}
|
17
spec-main/fixtures/module/function-with-properties.js
Normal file
17
spec-main/fixtures/module/function-with-properties.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
function foo () {
|
||||
return 'hello'
|
||||
}
|
||||
foo.bar = 'baz'
|
||||
foo.nested = {
|
||||
prop: 'yes'
|
||||
}
|
||||
foo.method1 = function () {
|
||||
return 'world'
|
||||
}
|
||||
foo.method1.prop1 = function () {
|
||||
return 123
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
foo: foo
|
||||
}
|
1
spec-main/fixtures/module/function.js
Normal file
1
spec-main/fixtures/module/function.js
Normal file
|
@ -0,0 +1 @@
|
|||
exports.aFunction = function () { return 1127 }
|
1
spec-main/fixtures/module/id.js
Normal file
1
spec-main/fixtures/module/id.js
Normal file
|
@ -0,0 +1 @@
|
|||
exports.id = 1127
|
11
spec-main/fixtures/module/no-prototype.js
Normal file
11
spec-main/fixtures/module/no-prototype.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
const foo = Object.create(null)
|
||||
foo.bar = 'baz'
|
||||
foo.baz = false
|
||||
module.exports = {
|
||||
foo: foo,
|
||||
bar: 1234,
|
||||
anonymous: new (class {})(),
|
||||
getConstructorName: function (value) {
|
||||
return value.constructor.name
|
||||
}
|
||||
}
|
5
spec-main/fixtures/module/promise.js
Normal file
5
spec-main/fixtures/module/promise.js
Normal file
|
@ -0,0 +1,5 @@
|
|||
exports.twicePromise = function (promise) {
|
||||
return promise.then(function (value) {
|
||||
return value * 2
|
||||
})
|
||||
}
|
11
spec-main/fixtures/module/property.js
Normal file
11
spec-main/fixtures/module/property.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
exports.property = 1127
|
||||
|
||||
function func () {
|
||||
|
||||
}
|
||||
func.property = 'foo'
|
||||
exports.func = func
|
||||
|
||||
exports.getFunctionProperty = () => {
|
||||
return `${func.property}-${process.type}`
|
||||
}
|
5
spec-main/fixtures/module/rejected-promise.js
Normal file
5
spec-main/fixtures/module/rejected-promise.js
Normal file
|
@ -0,0 +1,5 @@
|
|||
exports.reject = function (promise) {
|
||||
return promise.then(function () {
|
||||
throw Error('rejected')
|
||||
})
|
||||
}
|
11
spec-main/fixtures/module/remote-object-set.js
Normal file
11
spec-main/fixtures/module/remote-object-set.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
const { BrowserWindow } = require('electron')
|
||||
|
||||
class Foo {
|
||||
set bar (value) {
|
||||
if (!(value instanceof BrowserWindow)) {
|
||||
throw new Error('setting error')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = new Foo()
|
15
spec-main/fixtures/module/remote-static.js
Normal file
15
spec-main/fixtures/module/remote-static.js
Normal file
|
@ -0,0 +1,15 @@
|
|||
class Foo {
|
||||
static foo () {
|
||||
return 3
|
||||
}
|
||||
|
||||
baz () {
|
||||
return 123
|
||||
}
|
||||
}
|
||||
|
||||
Foo.bar = 'baz'
|
||||
|
||||
module.exports = {
|
||||
Foo: Foo
|
||||
}
|
4
spec-main/fixtures/module/to-string-non-function.js
Normal file
4
spec-main/fixtures/module/to-string-non-function.js
Normal file
|
@ -0,0 +1,4 @@
|
|||
function hello () {
|
||||
}
|
||||
hello.toString = 'hello'
|
||||
module.exports = { functionWithToStringProperty: hello }
|
3
spec-main/fixtures/module/unhandled-rejection.js
Normal file
3
spec-main/fixtures/module/unhandled-rejection.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
exports.reject = function () {
|
||||
return Promise.reject(new Error('rejected'))
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue