Flatten spec files, make them seem cleaner.
This commit is contained in:
parent
b431e96f9d
commit
2c672052e6
22 changed files with 155 additions and 151 deletions
|
@ -1,12 +1,13 @@
|
||||||
assert = require 'assert'
|
assert = require 'assert'
|
||||||
fs = require 'fs'
|
fs = require 'fs'
|
||||||
path = require 'path'
|
path = require 'path'
|
||||||
remote = require 'remote'
|
remote = require 'remote'
|
||||||
|
|
||||||
BrowserWindow = remote.require 'browser-window'
|
BrowserWindow = remote.require 'browser-window'
|
||||||
|
|
||||||
fixtures = path.resolve __dirname, '..', 'fixtures'
|
describe 'browser-window module', ->
|
||||||
|
fixtures = path.resolve __dirname, 'fixtures'
|
||||||
|
|
||||||
describe 'window module', ->
|
|
||||||
describe 'BrowserWindow.close()', ->
|
describe 'BrowserWindow.close()', ->
|
||||||
it 'should emit unload handler', (done) ->
|
it 'should emit unload handler', (done) ->
|
||||||
w = new BrowserWindow(show: false)
|
w = new BrowserWindow(show: false)
|
|
@ -1,13 +1,14 @@
|
||||||
assert = require 'assert'
|
assert = require 'assert'
|
||||||
path = require 'path'
|
path = require 'path'
|
||||||
http = require 'http'
|
http = require 'http'
|
||||||
remote = require 'remote'
|
remote = require 'remote'
|
||||||
formidable = require 'formidable'
|
formidable = require 'formidable'
|
||||||
|
|
||||||
BrowserWindow = remote.require 'browser-window'
|
BrowserWindow = remote.require 'browser-window'
|
||||||
|
|
||||||
fixtures = path.resolve __dirname, '..', 'fixtures'
|
|
||||||
|
|
||||||
describe 'crash-reporter module', ->
|
describe 'crash-reporter module', ->
|
||||||
|
fixtures = path.resolve __dirname, 'fixtures'
|
||||||
|
|
||||||
it 'should send minidump when renderer crashes', (done) ->
|
it 'should send minidump when renderer crashes', (done) ->
|
||||||
w = new BrowserWindow(show: false)
|
w = new BrowserWindow(show: false)
|
||||||
server = http.createServer (req, res) ->
|
server = http.createServer (req, res) ->
|
|
@ -1,13 +1,12 @@
|
||||||
assert = require 'assert'
|
assert = require 'assert'
|
||||||
ipc = require 'ipc'
|
ipc = require 'ipc'
|
||||||
path = require 'path'
|
path = require 'path'
|
||||||
remote = require 'remote'
|
remote = require 'remote'
|
||||||
|
|
||||||
BrowserWindow = remote.require 'browser-window'
|
BrowserWindow = remote.require 'browser-window'
|
||||||
|
|
||||||
fixtures = path.resolve __dirname, '..', 'fixtures'
|
describe 'ipc module', ->
|
||||||
|
fixtures = path.join __dirname, 'fixtures'
|
||||||
describe 'ipc', ->
|
|
||||||
fixtures = path.join __dirname, '..', 'fixtures'
|
|
||||||
|
|
||||||
describe 'remote.require', ->
|
describe 'remote.require', ->
|
||||||
it 'should returns same object for the same module', ->
|
it 'should returns same object for the same module', ->
|
|
@ -1,9 +1,10 @@
|
||||||
assert= require 'assert'
|
assert = require 'assert'
|
||||||
remote = require 'remote'
|
remote = require 'remote'
|
||||||
Menu = remote.require 'menu'
|
|
||||||
|
Menu = remote.require 'menu'
|
||||||
MenuItem = remote.require 'menu-item'
|
MenuItem = remote.require 'menu-item'
|
||||||
|
|
||||||
describe 'Menu API', ->
|
describe 'menu module', ->
|
||||||
describe 'Menu.buildFromTemplate', ->
|
describe 'Menu.buildFromTemplate', ->
|
||||||
it 'should be able to attach extra fields', ->
|
it 'should be able to attach extra fields', ->
|
||||||
menu = Menu.buildFromTemplate [label: 'text', extra: 'field']
|
menu = Menu.buildFromTemplate [label: 'text', extra: 'field']
|
|
@ -1,10 +1,10 @@
|
||||||
assert = require 'assert'
|
assert = require 'assert'
|
||||||
ipc = require 'ipc'
|
ipc = require 'ipc'
|
||||||
path = require 'path'
|
path = require 'path'
|
||||||
remote = require 'remote'
|
remote = require 'remote'
|
||||||
protocol = remote.require 'protocol'
|
protocol = remote.require 'protocol'
|
||||||
|
|
||||||
describe 'protocol API', ->
|
describe 'protocol module', ->
|
||||||
describe 'protocol.registerProtocol', ->
|
describe 'protocol.registerProtocol', ->
|
||||||
it 'throws error when scheme is already registered', (done) ->
|
it 'throws error when scheme is already registered', (done) ->
|
||||||
register = -> protocol.registerProtocol('test1', ->)
|
register = -> protocol.registerProtocol('test1', ->)
|
15
spec/chromium-spec.coffee
Normal file
15
spec/chromium-spec.coffee
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
describe 'chromium features', ->
|
||||||
|
describe 'heap snapshot', ->
|
||||||
|
it 'does not crash', ->
|
||||||
|
process.atomBinding('v8_util').takeHeapSnapshot()
|
||||||
|
|
||||||
|
describe 'sending request of http protocol urls', ->
|
||||||
|
it 'does not crash', ->
|
||||||
|
$.get 'https://api.github.com/zen'
|
||||||
|
|
||||||
|
describe 'navigator.webkitGetUserMedia', ->
|
||||||
|
it 'calls its callbacks', (done) ->
|
||||||
|
@timeout 5000
|
||||||
|
navigator.webkitGetUserMedia audio: true, video: false,
|
||||||
|
-> done()
|
||||||
|
-> done()
|
38
spec/modules-spec.coffee
Normal file
38
spec/modules-spec.coffee
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
assert = require 'assert'
|
||||||
|
fs = require 'fs'
|
||||||
|
path = require 'path'
|
||||||
|
|
||||||
|
describe 'third-party modules', ->
|
||||||
|
fixtures = path.join __dirname, 'fixtures'
|
||||||
|
|
||||||
|
describe 'd3', ->
|
||||||
|
it 'can be required', (done) ->
|
||||||
|
require 'd3'
|
||||||
|
done()
|
||||||
|
|
||||||
|
describe 'unzip', ->
|
||||||
|
unzip = require 'unzip'
|
||||||
|
|
||||||
|
it 'fires close event', (done) ->
|
||||||
|
fs.createReadStream(path.join(fixtures, 'zip', 'a.zip'))
|
||||||
|
.pipe(unzip.Parse())
|
||||||
|
.on('close', done)
|
||||||
|
|
||||||
|
describe 'int64-native', ->
|
||||||
|
it 'can be required in renderer', ->
|
||||||
|
Int64 = require 'int64-native'
|
||||||
|
x = new Int64()
|
||||||
|
y = new Int64(42)
|
||||||
|
z = new Int64(0xfedcba98, 0x76543210)
|
||||||
|
w = new Int64('fedcba9876543210')
|
||||||
|
assert.equal x.toString(), '0000000000000000'
|
||||||
|
assert.equal y.toString(), '000000000000002a'
|
||||||
|
assert.equal z.toString(), 'fedcba9876543210'
|
||||||
|
assert.equal w.toString(), 'fedcba9876543210'
|
||||||
|
|
||||||
|
it 'can be required in node binary', (done) ->
|
||||||
|
int64_native = path.join fixtures, 'module', 'int64_native.js'
|
||||||
|
child = require('child_process').fork int64_native
|
||||||
|
child.on 'message', (msg) ->
|
||||||
|
assert.equal msg, 'ok'
|
||||||
|
done()
|
|
@ -1,4 +0,0 @@
|
||||||
describe 'd3 module', ->
|
|
||||||
it 'can be required', (done) ->
|
|
||||||
require 'd3'
|
|
||||||
done()
|
|
|
@ -1,23 +0,0 @@
|
||||||
assert = require 'assert'
|
|
||||||
path = require 'path'
|
|
||||||
|
|
||||||
fixtures = path.resolve __dirname, '..', 'fixtures'
|
|
||||||
|
|
||||||
describe 'native module', ->
|
|
||||||
it 'can be required in renderer', ->
|
|
||||||
Int64 = require 'int64-native'
|
|
||||||
x = new Int64()
|
|
||||||
y = new Int64(42)
|
|
||||||
z = new Int64(0xfedcba98, 0x76543210)
|
|
||||||
w = new Int64('fedcba9876543210')
|
|
||||||
assert.equal x.toString(), '0000000000000000'
|
|
||||||
assert.equal y.toString(), '000000000000002a'
|
|
||||||
assert.equal z.toString(), 'fedcba9876543210'
|
|
||||||
assert.equal w.toString(), 'fedcba9876543210'
|
|
||||||
|
|
||||||
it 'can be required in node binary', (done) ->
|
|
||||||
int64_native = path.join fixtures, 'module', 'int64_native.js'
|
|
||||||
child = require('child_process').fork int64_native
|
|
||||||
child.on 'message', (msg) ->
|
|
||||||
assert.equal msg, 'ok'
|
|
||||||
done()
|
|
|
@ -1,12 +0,0 @@
|
||||||
assert = require 'assert'
|
|
||||||
fs = require 'fs'
|
|
||||||
path = require 'path'
|
|
||||||
unzip = require 'unzip'
|
|
||||||
|
|
||||||
fixtures = path.resolve __dirname, '..', 'fixtures'
|
|
||||||
|
|
||||||
describe 'unzip module', ->
|
|
||||||
it 'fires close event', (done) ->
|
|
||||||
fs.createReadStream(path.join(fixtures, 'zip', 'a.zip'))
|
|
||||||
.pipe(unzip.Parse())
|
|
||||||
.on('close', done)
|
|
70
spec/node-spec.coffee
Normal file
70
spec/node-spec.coffee
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
assert = require 'assert'
|
||||||
|
child_process = require 'child_process'
|
||||||
|
fs = require 'fs'
|
||||||
|
path = require 'path'
|
||||||
|
|
||||||
|
describe 'node features', ->
|
||||||
|
describe 'child_process', ->
|
||||||
|
fixtures = path.join __dirname, 'fixtures'
|
||||||
|
|
||||||
|
describe 'child_process.fork', ->
|
||||||
|
it 'works in current process', (done) ->
|
||||||
|
child = child_process.fork path.join(fixtures, 'module', 'ping.js')
|
||||||
|
child.on 'message', (msg) ->
|
||||||
|
assert.equal msg, 'message'
|
||||||
|
done()
|
||||||
|
child.send 'message'
|
||||||
|
|
||||||
|
it 'works in forked process', (done) ->
|
||||||
|
child = child_process.fork path.join(fixtures, 'module', 'fork_ping.js')
|
||||||
|
child.on 'message', (msg) ->
|
||||||
|
assert.equal msg, 'message'
|
||||||
|
done()
|
||||||
|
child.send 'message'
|
||||||
|
|
||||||
|
it 'works in forked process when options.env is specifed', (done) ->
|
||||||
|
child = child_process.fork path.join(fixtures, 'module', 'fork_ping.js'),
|
||||||
|
[],
|
||||||
|
path: process.env['PATH']
|
||||||
|
child.on 'message', (msg) ->
|
||||||
|
assert.equal msg, 'message'
|
||||||
|
done()
|
||||||
|
child.send 'message'
|
||||||
|
|
||||||
|
describe 'contexts', ->
|
||||||
|
describe 'setTimeout in fs callback', ->
|
||||||
|
it 'does not crash', (done) ->
|
||||||
|
fs.readFile __filename, ->
|
||||||
|
setTimeout done, 0
|
||||||
|
|
||||||
|
describe 'throw error in node context', ->
|
||||||
|
it 'gets caught', (done) ->
|
||||||
|
error = new Error('boo!')
|
||||||
|
lsts = process.listeners 'uncaughtException'
|
||||||
|
process.removeAllListeners 'uncaughtException'
|
||||||
|
process.on 'uncaughtException', (err) ->
|
||||||
|
process.removeAllListeners 'uncaughtException'
|
||||||
|
for lst in lsts
|
||||||
|
process.on 'uncaughtException', lst
|
||||||
|
done()
|
||||||
|
fs.readFile __filename, ->
|
||||||
|
throw error
|
||||||
|
|
||||||
|
describe 'message loop', ->
|
||||||
|
describe 'process.nextTick', ->
|
||||||
|
it 'emits the callback', (done) ->
|
||||||
|
process.nextTick done
|
||||||
|
|
||||||
|
it 'works in nested calls', (done) ->
|
||||||
|
process.nextTick ->
|
||||||
|
process.nextTick ->
|
||||||
|
process.nextTick done
|
||||||
|
|
||||||
|
describe 'setImmediate', ->
|
||||||
|
it 'emits the callback', (done) ->
|
||||||
|
setImmediate done
|
||||||
|
|
||||||
|
it 'works in nested calls', (done) ->
|
||||||
|
setImmediate ->
|
||||||
|
setImmediate ->
|
||||||
|
setImmediate done
|
|
@ -1,30 +0,0 @@
|
||||||
assert = require 'assert'
|
|
||||||
child_process = require 'child_process'
|
|
||||||
path = require 'path'
|
|
||||||
|
|
||||||
describe 'child_process', ->
|
|
||||||
fixtures = path.join __dirname, '..', 'fixtures'
|
|
||||||
|
|
||||||
describe 'child_process.fork', ->
|
|
||||||
it 'should work', (done) ->
|
|
||||||
child = child_process.fork path.join(fixtures, 'module', 'ping.js')
|
|
||||||
child.on 'message', (msg) ->
|
|
||||||
assert.equal msg, 'message'
|
|
||||||
done()
|
|
||||||
child.send 'message'
|
|
||||||
|
|
||||||
it 'should work in forked process', (done) ->
|
|
||||||
child = child_process.fork path.join(fixtures, 'module', 'fork_ping.js')
|
|
||||||
child.on 'message', (msg) ->
|
|
||||||
assert.equal msg, 'message'
|
|
||||||
done()
|
|
||||||
child.send 'message'
|
|
||||||
|
|
||||||
it 'should work in forked process when options.env is specifed', (done) ->
|
|
||||||
child = child_process.fork path.join(fixtures, 'module', 'fork_ping.js'),
|
|
||||||
[],
|
|
||||||
path: process.env['PATH']
|
|
||||||
child.on 'message', (msg) ->
|
|
||||||
assert.equal msg, 'message'
|
|
||||||
done()
|
|
||||||
child.send 'message'
|
|
|
@ -1,21 +0,0 @@
|
||||||
assert = require 'assert'
|
|
||||||
fs = require 'fs'
|
|
||||||
|
|
||||||
describe 'contexts', ->
|
|
||||||
describe 'setTimeout in fs callback', ->
|
|
||||||
it 'does not crash', (done) ->
|
|
||||||
fs.readFile __filename, ->
|
|
||||||
setTimeout done, 0
|
|
||||||
|
|
||||||
describe 'throw error in node context', ->
|
|
||||||
it 'get caught', (done) ->
|
|
||||||
error = new Error('boo!')
|
|
||||||
lsts = process.listeners 'uncaughtException'
|
|
||||||
process.removeAllListeners 'uncaughtException'
|
|
||||||
process.on 'uncaughtException', (err) ->
|
|
||||||
process.removeAllListeners 'uncaughtException'
|
|
||||||
for lst in lsts
|
|
||||||
process.on 'uncaughtException', lst
|
|
||||||
done()
|
|
||||||
fs.readFile __filename, ->
|
|
||||||
throw error
|
|
|
@ -1,18 +0,0 @@
|
||||||
describe 'message loop', ->
|
|
||||||
describe 'process.nextTick', ->
|
|
||||||
it 'should emit the callback', (done) ->
|
|
||||||
process.nextTick done
|
|
||||||
|
|
||||||
it 'should work in nested calls', (done) ->
|
|
||||||
process.nextTick ->
|
|
||||||
process.nextTick ->
|
|
||||||
process.nextTick done
|
|
||||||
|
|
||||||
describe 'setImmediate', ->
|
|
||||||
it 'should emit the callback', (done) ->
|
|
||||||
setImmediate done
|
|
||||||
|
|
||||||
it 'should work in nested calls', (done) ->
|
|
||||||
setImmediate ->
|
|
||||||
setImmediate ->
|
|
||||||
setImmediate done
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"name": "atom-shell-specs",
|
"name": "atom-shell-specs",
|
||||||
"main": "main.js",
|
"main": "static/main.js",
|
||||||
"version": "0.1.0"
|
"version": "0.1.0"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta name="referrer" content="always">
|
<meta name="referrer" content="always">
|
||||||
<link href="../node_modules/mocha/mocha.css" rel="stylesheet">
|
<link href="../../node_modules/mocha/mocha.css" rel="stylesheet">
|
||||||
<script src="jquery-2.0.3.min.js"></script>
|
<script src="jquery-2.0.3.min.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -54,10 +54,12 @@
|
||||||
if (query.invert) mocha.invert();
|
if (query.invert) mocha.invert();
|
||||||
|
|
||||||
// Read all test files.
|
// Read all test files.
|
||||||
var walker = require('walkdir').walk(__dirname);
|
var walker = require('walkdir').walk(require('path').dirname(__dirname), {
|
||||||
|
no_recurse: true
|
||||||
|
});
|
||||||
|
|
||||||
walker.on('file', function(file) {
|
walker.on('file', function(file) {
|
||||||
if (/.coffee$/.test(file))
|
if (/-spec.coffee$/.test(file))
|
||||||
mocha.addFile(file);
|
mocha.addFile(file);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
describe 'debugger', ->
|
|
||||||
describe 'heap snapshot', ->
|
|
||||||
it 'should not crash', ->
|
|
||||||
process.atomBinding('v8_util').takeHeapSnapshot()
|
|
|
@ -1,4 +0,0 @@
|
||||||
describe 'http', ->
|
|
||||||
describe 'sending request of http protocol urls', ->
|
|
||||||
it 'should not crash', ->
|
|
||||||
$.get 'https://api.github.com/zen'
|
|
|
@ -1,7 +0,0 @@
|
||||||
describe 'webrtc', ->
|
|
||||||
describe 'navigator.webkitGetUserMedia', ->
|
|
||||||
it 'should call its callbacks', (done) ->
|
|
||||||
@timeout 5000
|
|
||||||
navigator.webkitGetUserMedia audio: true, video: false,
|
|
||||||
-> done()
|
|
||||||
-> done()
|
|
Loading…
Add table
Add a link
Reference in a new issue